puppet 3.5.1-x86-mingw32 → 3.6.0.rc1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CONTRIBUTING.md +5 -0
- data/Gemfile +17 -9
- data/README.md +1 -0
- data/conf/fileserver.conf +4 -3
- data/ext/README.environment +8 -0
- data/ext/build_defaults.yaml +1 -1
- data/ext/debian/control +2 -2
- data/ext/debian/puppet-common.dirs +4 -0
- data/ext/debian/rules +4 -0
- data/ext/emacs/puppet-mode-init.el +1 -1
- data/ext/emacs/puppet-mode.el +36 -17
- data/ext/redhat/client.init +3 -3
- data/ext/redhat/puppet.spec.erb +9 -0
- data/ext/systemd/puppet.service +3 -4
- data/ext/systemd/puppetmaster.service +1 -3
- data/install.rb +1 -1
- data/lib/puppet.rb +2 -1
- data/lib/puppet/agent.rb +1 -1
- data/lib/puppet/application.rb +17 -17
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/configurer.rb +4 -1
- data/lib/puppet/configurer/downloader.rb +13 -12
- data/lib/puppet/configurer/plugin_handler.rb +3 -3
- data/lib/puppet/context.rb +6 -1
- data/lib/puppet/defaults.rb +82 -12
- data/lib/puppet/environments.rb +169 -13
- data/lib/puppet/external/nagios/grammar.ry +2 -0
- data/lib/puppet/external/nagios/parser.rb +28 -19
- data/lib/puppet/face/config.rb +19 -6
- data/lib/puppet/face/module/generate.rb +209 -7
- data/lib/puppet/face/module/install.rb +17 -16
- data/lib/puppet/face/module/list.rb +83 -82
- data/lib/puppet/face/module/search.rb +1 -1
- data/lib/puppet/face/module/upgrade.rb +10 -9
- data/lib/puppet/face/parser.rb +3 -2
- data/lib/puppet/face/plugin.rb +8 -4
- data/lib/puppet/file_bucket/dipper.rb +6 -3
- data/lib/puppet/file_bucket/file.rb +4 -2
- data/lib/puppet/file_serving/metadata.rb +1 -1
- data/lib/puppet/file_system/memory_file.rb +27 -1
- data/lib/puppet/file_system/memory_impl.rb +15 -1
- data/lib/puppet/forge.rb +148 -52
- data/lib/puppet/forge/cache.rb +5 -1
- data/lib/puppet/forge/errors.rb +10 -0
- data/lib/puppet/forge/repository.rb +61 -26
- data/lib/puppet/functions.rb +548 -0
- data/lib/puppet/functions/assert_type.rb +42 -0
- data/lib/puppet/functions/import.rb +7 -0
- data/lib/puppet/indirector/facts/facter.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +3 -2
- data/lib/puppet/indirector/rest.rb +18 -0
- data/lib/puppet/loaders.rb +20 -0
- data/lib/puppet/module.rb +2 -2
- data/lib/puppet/module_tool.rb +40 -14
- data/lib/puppet/module_tool/applications.rb +0 -1
- data/lib/puppet/module_tool/applications/application.rb +35 -26
- data/lib/puppet/module_tool/applications/builder.rb +16 -6
- data/lib/puppet/module_tool/applications/checksummer.rb +25 -19
- data/lib/puppet/module_tool/applications/installer.rb +196 -35
- data/lib/puppet/module_tool/applications/searcher.rb +1 -0
- data/lib/puppet/module_tool/applications/uninstaller.rb +7 -1
- data/lib/puppet/module_tool/applications/unpacker.rb +57 -31
- data/lib/puppet/module_tool/applications/upgrader.rb +221 -65
- data/lib/puppet/module_tool/checksums.rb +5 -8
- data/lib/puppet/module_tool/errors/installer.rb +12 -44
- data/lib/puppet/module_tool/errors/shared.rb +84 -11
- data/lib/puppet/module_tool/errors/upgrader.rb +16 -45
- data/lib/puppet/module_tool/install_directory.rb +7 -6
- data/lib/puppet/module_tool/installed_modules.rb +92 -0
- data/lib/puppet/module_tool/local_tarball.rb +91 -0
- data/lib/puppet/module_tool/metadata.rb +119 -115
- data/lib/puppet/module_tool/modulefile.rb +9 -9
- data/lib/puppet/module_tool/shared_behaviors.rb +19 -7
- data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +79 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/Rakefile +18 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/metadata.json.erb +1 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/spec/classes/init_spec.rb.erb +7 -0
- data/lib/puppet/module_tool/tar.rb +3 -7
- data/lib/puppet/module_tool/tar/gnu.rb +21 -9
- data/lib/puppet/module_tool/tar/mini.rb +2 -8
- data/lib/puppet/network/http/api/v1.rb +1 -1
- data/lib/puppet/network/http/api/v2/authorization.rb +4 -2
- data/lib/puppet/network/http/issues.rb +1 -0
- data/lib/puppet/network/http_pool.rb +15 -6
- data/lib/puppet/node/environment.rb +91 -20
- data/lib/puppet/parser/ast/pops_bridge.rb +44 -3
- data/lib/puppet/parser/collector.rb +1 -1
- data/lib/puppet/parser/compiler.rb +50 -7
- data/lib/puppet/parser/functions.rb +6 -0
- data/lib/puppet/parser/functions/generate.rb +1 -1
- data/lib/puppet/parser/resource.rb +1 -1
- data/lib/puppet/pops.rb +22 -1
- data/lib/puppet/pops/adapters.rb +8 -1
- data/lib/puppet/pops/binder/bindings_composer.rb +1 -1
- data/lib/puppet/pops/binder/bindings_factory.rb +1 -1
- data/lib/puppet/pops/binder/config/binder_config_checker.rb +1 -1
- data/lib/puppet/pops/binder/producers.rb +2 -2
- data/lib/puppet/pops/evaluator/access_operator.rb +65 -25
- data/lib/puppet/pops/evaluator/callable_signature.rb +101 -0
- data/lib/puppet/pops/evaluator/closure.rb +57 -2
- data/lib/puppet/pops/evaluator/compare_operator.rb +1 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +9 -11
- data/lib/puppet/pops/evaluator/runtime3_support.rb +72 -21
- data/lib/puppet/pops/functions/dispatch.rb +71 -0
- data/lib/puppet/pops/functions/dispatcher.rb +237 -0
- data/lib/puppet/pops/functions/function.rb +77 -0
- data/lib/puppet/pops/issues.rb +12 -0
- data/lib/puppet/pops/loader/base_loader.rb +102 -0
- data/lib/puppet/pops/loader/dependency_loader.rb +60 -0
- data/lib/puppet/pops/loader/gem_support.rb +49 -0
- data/lib/puppet/pops/loader/loader.rb +180 -0
- data/lib/puppet/pops/loader/loader_paths.rb +137 -0
- data/lib/puppet/pops/loader/module_loaders.rb +242 -0
- data/lib/puppet/pops/loader/null_loader.rb +44 -0
- data/lib/puppet/pops/loader/ruby_function_instantiator.rb +34 -0
- data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +109 -0
- data/lib/puppet/pops/loader/simple_environment_loader.rb +20 -0
- data/lib/puppet/pops/loader/static_loader.rb +69 -0
- data/lib/puppet/pops/loader/uri_helper.rb +22 -0
- data/lib/puppet/pops/loaders.rb +240 -0
- data/lib/puppet/pops/model/factory.rb +13 -5
- data/lib/puppet/pops/model/model_tree_dumper.rb +12 -4
- data/lib/puppet/pops/parser/egrammar.ra +31 -18
- data/lib/puppet/pops/parser/eparser.rb +1137 -1106
- data/lib/puppet/pops/parser/lexer2.rb +17 -16
- data/lib/puppet/pops/semantic_error.rb +17 -0
- data/lib/puppet/pops/types/type_calculator.rb +150 -15
- data/lib/puppet/pops/types/type_factory.rb +69 -0
- data/lib/puppet/pops/types/type_parser.rb +9 -0
- data/lib/puppet/pops/types/types.rb +65 -4
- data/lib/puppet/pops/validation/checker4_0.rb +1 -1
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -1
- data/lib/puppet/property/list.rb +1 -1
- data/lib/puppet/provider/augeas/augeas.rb +2 -2
- data/lib/puppet/provider/cron/crontab.rb +13 -2
- data/lib/puppet/provider/package.rb +24 -0
- data/lib/puppet/provider/package/apt.rb +6 -1
- data/lib/puppet/provider/package/gem.rb +8 -2
- data/lib/puppet/provider/package/msi.rb +0 -15
- data/lib/puppet/provider/package/openbsd.rb +0 -24
- data/lib/puppet/provider/package/rpm.rb +3 -29
- data/lib/puppet/provider/package/windows.rb +0 -15
- data/lib/puppet/provider/package/yum.rb +101 -24
- data/lib/puppet/provider/package/yumhelper.py +31 -1
- data/lib/puppet/provider/package/zypper.rb +10 -28
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/init.rb +3 -0
- data/lib/puppet/provider/service/openbsd.rb +318 -0
- data/lib/puppet/provider/service/redhat.rb +6 -3
- data/lib/puppet/provider/service/systemd.rb +2 -2
- data/lib/puppet/provider/yumrepo/inifile.rb +115 -42
- data/lib/puppet/resource.rb +13 -9
- data/lib/puppet/resource/catalog.rb +12 -6
- data/lib/puppet/resource/type_collection.rb +3 -3
- data/lib/puppet/settings.rb +57 -36
- data/lib/puppet/settings/config_file.rb +5 -0
- data/lib/puppet/settings/environment_conf.rb +147 -0
- data/lib/puppet/settings/ttl_setting.rb +48 -0
- data/lib/puppet/ssl/certificate_authority.rb +2 -3
- data/lib/puppet/ssl/certificate_authority/autosign_command.rb +1 -1
- data/lib/puppet/ssl/certificate_request.rb +4 -4
- data/lib/puppet/ssl/validator/default_validator.rb +2 -2
- data/lib/puppet/status.rb +1 -1
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/type/augeas.rb +13 -1
- data/lib/puppet/type/cron.rb +32 -18
- data/lib/puppet/type/file.rb +4 -2
- data/lib/puppet/type/file/checksum.rb +15 -5
- data/lib/puppet/type/file/content.rb +3 -1
- data/lib/puppet/type/file/source.rb +5 -5
- data/lib/puppet/type/package.rb +12 -17
- data/lib/puppet/type/resources.rb +3 -1
- data/lib/puppet/type/scheduled_task.rb +4 -5
- data/lib/puppet/type/service.rb +12 -2
- data/lib/puppet/type/user.rb +106 -0
- data/lib/puppet/type/yumrepo.rb +9 -1
- data/lib/puppet/util/checksums.rb +60 -1
- data/lib/puppet/util/diff.rb +3 -1
- data/lib/puppet/util/execution.rb +20 -16
- data/lib/puppet/util/feature.rb +3 -0
- data/lib/puppet/util/logging.rb +19 -12
- data/lib/puppet/util/rubygems.rb +10 -0
- data/lib/puppet/util/watched_file.rb +1 -1
- data/lib/puppet/util/windows/security.rb +5 -3
- data/lib/puppet/vendor/load_semantic.rb +1 -0
- data/lib/puppet/vendor/require_vendored.rb +2 -0
- data/lib/puppet/vendor/semantic/Gemfile +20 -0
- data/lib/puppet/vendor/semantic/Rakefile +69 -0
- data/lib/puppet/vendor/semantic/lib/semantic.rb +7 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency.rb +181 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/graph.rb +60 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/graph_node.rb +117 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb +46 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/source.rb +25 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/unsatisfiable_graph.rb +31 -0
- data/lib/puppet/vendor/semantic/lib/semantic/version.rb +168 -0
- data/lib/puppet/vendor/semantic/lib/semantic/version_range.rb +424 -0
- data/lib/puppet/vendor/semantic/spec/spec_helper.rb +24 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_node_spec.rb +141 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_spec.rb +162 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/module_release_spec.rb +143 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/source_spec.rb +5 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/unsatisfiable_graph_spec.rb +44 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency_spec.rb +383 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/version_range_spec.rb +307 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/version_spec.rb +608 -0
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/java.tgz +0 -0
- data/spec/fixtures/stdlib.tgz +0 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/usee/lib/puppet/functions/usee/callee.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/user/lib/puppet/functions/user/caller.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/user/metadata.json +9 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/modulea/rb_func_a.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/rb_func_a.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/manifests/init.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/metadata.json +19 -0
- data/spec/fixtures/unit/pops/loaders/loaders/wo_metadata_module/modules/moduleb/lib/puppet/functions/moduleb/rb_func_b.rb +6 -0
- data/spec/fixtures/unit/pops/loaders/loaders/wo_metadata_module/modules/moduleb/manifests/init.pp +3 -0
- data/spec/fixtures/unit/provider/naginator/define_empty_param +6 -0
- data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services +7 -0
- data/spec/fixtures/unit/type/user/authorized_keys +5 -0
- data/spec/integration/application/apply_spec.rb +1 -2
- data/spec/integration/configurer_spec.rb +2 -2
- data/spec/integration/faces/plugin_spec.rb +62 -0
- data/spec/integration/indirector/catalog/compiler_spec.rb +1 -1
- data/spec/integration/indirector/catalog/queue_spec.rb +1 -1
- data/spec/integration/node/environment_spec.rb +2 -2
- data/spec/integration/parser/future_compiler_spec.rb +96 -142
- data/spec/integration/parser/ruby_manifest_spec.rb +0 -5
- data/spec/integration/provider/cron/crontab_spec.rb +35 -0
- data/spec/integration/type/file_spec.rb +74 -72
- data/spec/integration/util/windows/security_spec.rb +17 -0
- data/spec/lib/matchers/resource.rb +45 -13
- data/spec/lib/puppet_spec/files.rb +18 -0
- data/spec/lib/puppet_spec/module_tool/shared_functions.rb +56 -0
- data/spec/lib/puppet_spec/module_tool/stub_source.rb +133 -0
- data/spec/shared_contexts/checksums.rb +55 -0
- data/spec/unit/application/apply_spec.rb +10 -7
- data/spec/unit/application/doc_spec.rb +17 -10
- data/spec/unit/application/indirection_base_spec.rb +18 -10
- data/spec/unit/application/inspect_spec.rb +22 -20
- data/spec/unit/configurer/downloader_spec.rb +7 -6
- data/spec/unit/configurer/plugin_handler_spec.rb +5 -8
- data/spec/unit/configurer_spec.rb +1 -1
- data/spec/unit/context_spec.rb +23 -0
- data/spec/unit/environments_spec.rb +274 -16
- data/spec/unit/face/config_spec.rb +111 -11
- data/spec/unit/face/module/install_spec.rb +14 -85
- data/spec/unit/face/module/list_spec.rb +108 -62
- data/spec/unit/face/module/search_spec.rb +1 -1
- data/spec/unit/face/module/uninstall_spec.rb +21 -42
- data/spec/unit/face/parser_spec.rb +5 -2
- data/spec/unit/file_bucket/dipper_spec.rb +92 -86
- data/spec/unit/file_bucket/file_spec.rb +23 -75
- data/spec/unit/file_serving/metadata_spec.rb +74 -74
- data/spec/unit/forge/module_release_spec.rb +131 -0
- data/spec/unit/forge/repository_spec.rb +21 -20
- data/spec/unit/forge_spec.rb +99 -23
- data/spec/unit/functions/assert_type_spec.rb +59 -0
- data/spec/unit/functions4_spec.rb +671 -0
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +2 -2
- data/spec/unit/indirector/facts/facter_spec.rb +9 -3
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +156 -155
- data/spec/unit/indirector/rest_spec.rb +8 -0
- data/spec/unit/interface/face_collection_spec.rb +35 -23
- data/spec/unit/module_spec.rb +20 -8
- data/spec/unit/module_tool/applications/builder_spec.rb +40 -12
- data/spec/unit/module_tool/applications/checksummer_spec.rb +86 -105
- data/spec/unit/module_tool/applications/installer_spec.rb +293 -261
- data/spec/unit/module_tool/applications/searcher_spec.rb +1 -1
- data/spec/unit/module_tool/applications/uninstaller_spec.rb +90 -154
- data/spec/unit/module_tool/applications/unpacker_spec.rb +12 -12
- data/spec/unit/module_tool/applications/upgrader_spec.rb +286 -18
- data/spec/unit/module_tool/metadata_spec.rb +223 -14
- data/spec/unit/module_tool/tar/gnu_spec.rb +12 -9
- data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
- data/spec/unit/module_tool/tar_spec.rb +4 -18
- data/spec/unit/module_tool_spec.rb +123 -27
- data/spec/unit/network/formats_spec.rb +2 -2
- data/spec/unit/network/http_pool_spec.rb +21 -0
- data/spec/unit/network/rights_spec.rb +10 -8
- data/spec/unit/node/environment_spec.rb +27 -2
- data/spec/unit/parser/collector_spec.rb +1 -1
- data/spec/unit/parser/compiler_spec.rb +1 -1
- data/spec/unit/parser/functions/generate_spec.rb +4 -0
- data/spec/unit/pops/evaluator/access_ops_spec.rb +50 -11
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +25 -0
- data/spec/unit/pops/loaders/dependency_loader_spec.rb +44 -0
- data/spec/unit/pops/loaders/loader_paths_spec.rb +66 -0
- data/spec/unit/pops/loaders/loaders_spec.rb +105 -0
- data/spec/unit/pops/loaders/module_loaders_spec.rb +119 -0
- data/spec/unit/pops/loaders/static_loader_spec.rb +46 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +145 -10
- data/spec/unit/pops/types/type_factory_spec.rb +101 -0
- data/spec/unit/pops/types/type_parser_spec.rb +22 -0
- data/spec/unit/property/list_spec.rb +9 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +58 -11
- data/spec/unit/provider/cron/crontab_spec.rb +1 -0
- data/spec/unit/provider/cron/parsed_spec.rb +15 -0
- data/spec/unit/provider/naginator_spec.rb +14 -0
- data/spec/unit/provider/package/apt_spec.rb +78 -64
- data/spec/unit/provider/package/gem_spec.rb +15 -0
- data/spec/unit/provider/package/rpm_spec.rb +6 -6
- data/spec/unit/provider/package/windows_spec.rb +1 -1
- data/spec/unit/provider/package/yum_spec.rb +199 -104
- data/spec/unit/provider/package/zypper_spec.rb +41 -15
- data/spec/unit/provider/service/openbsd_spec.rb +129 -22
- data/spec/unit/provider/service/redhat_spec.rb +18 -4
- data/spec/unit/provider/service/systemd_spec.rb +5 -9
- data/spec/unit/provider/service/upstart_spec.rb +1 -1
- data/spec/unit/provider/user/directoryservice_spec.rb +10 -0
- data/spec/unit/provider/yumrepo/inifile_spec.rb +171 -15
- data/spec/unit/resource/catalog_spec.rb +20 -104
- data/spec/unit/resource/type_collection_spec.rb +10 -9
- data/spec/unit/settings/config_file_spec.rb +29 -6
- data/spec/unit/settings/environment_conf_spec.rb +51 -0
- data/spec/unit/settings_spec.rb +97 -12
- data/spec/unit/ssl/certificate_authority_spec.rb +2 -0
- data/spec/unit/type/augeas_spec.rb +1 -1
- data/spec/unit/type/cron_spec.rb +6 -7
- data/spec/unit/type/file/checksum_spec.rb +6 -0
- data/spec/unit/type/file/content_spec.rb +277 -207
- data/spec/unit/type/file_spec.rb +9 -7
- data/spec/unit/type/user_spec.rb +106 -18
- data/spec/unit/type/yumrepo_spec.rb +8 -0
- data/spec/unit/util/checksums_spec.rb +12 -5
- data/spec/unit/util/diff_spec.rb +8 -0
- data/spec/unit/util/execution_spec.rb +4 -4
- data/spec/unit/util/feature_spec.rb +2 -0
- data/spec/unit/util/logging_spec.rb +14 -4
- data/spec/unit/util/rdoc/parser_spec.rb +5 -4
- data/spec/unit/util/rubygems_spec.rb +14 -0
- data/tasks/parallel.rake +2 -2
- metadata +154 -21
- checksums.yaml +0 -7
- data/lib/puppet/module_tool/applications/generator.rb +0 -142
- data/lib/puppet/module_tool/skeleton.rb +0 -37
- data/lib/puppet/module_tool/skeleton/templates/generator/Modulefile.erb +0 -11
- data/lib/puppet/module_tool/skeleton/templates/generator/README.erb +0 -16
- data/lib/puppet/module_tool/tar/solaris.rb +0 -5
- data/spec/fixtures/unit/provider/service/systemd/list_units_services +0 -17
- data/spec/unit/module_tool/tar/solaris_spec.rb +0 -22
@@ -17,6 +17,10 @@ describe provider_class do
|
|
17
17
|
provider
|
18
18
|
end
|
19
19
|
|
20
|
+
before :each do
|
21
|
+
resource.provider = provider
|
22
|
+
end
|
23
|
+
|
20
24
|
describe "when installing" do
|
21
25
|
it "should use the path to the gem" do
|
22
26
|
provider_class.stubs(:command).with(:gemcmd).returns "/my/gem"
|
@@ -44,6 +48,17 @@ describe provider_class do
|
|
44
48
|
provider.install
|
45
49
|
end
|
46
50
|
|
51
|
+
it "should not append install_options by default" do
|
52
|
+
provider.expects(:execute).with { |args| args.length == 5 }.returns ""
|
53
|
+
provider.install
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should allow setting an install_options parameter" do
|
57
|
+
resource[:install_options] = [ '--force', {'--bindir' => '/usr/bin' } ]
|
58
|
+
provider.expects(:execute).with { |args| args[5] == '--force' && args[6] == '--bindir=/usr/bin' }.returns ''
|
59
|
+
provider.install
|
60
|
+
end
|
61
|
+
|
47
62
|
describe "when a source is specified" do
|
48
63
|
describe "as a normal file" do
|
49
64
|
it "should use the file name instead of the gem name" do
|
@@ -299,8 +299,8 @@ describe provider_class do
|
|
299
299
|
end
|
300
300
|
|
301
301
|
describe "#install_options" do
|
302
|
-
it "returns
|
303
|
-
expect(provider.install_options).to eq(
|
302
|
+
it "returns nil by default" do
|
303
|
+
expect(provider.install_options).to eq(nil)
|
304
304
|
end
|
305
305
|
|
306
306
|
it "returns install_options when set" do
|
@@ -314,7 +314,7 @@ describe provider_class do
|
|
314
314
|
end
|
315
315
|
|
316
316
|
it 'returns install_options when set as hash' do
|
317
|
-
provider.resource[:install_options] = { '-Darch' => 'vax' }
|
317
|
+
provider.resource[:install_options] = [{ '-Darch' => 'vax' }]
|
318
318
|
expect(provider.install_options).to eq(['-Darch=vax'])
|
319
319
|
end
|
320
320
|
|
@@ -325,8 +325,8 @@ describe provider_class do
|
|
325
325
|
end
|
326
326
|
|
327
327
|
describe "#uninstall_options" do
|
328
|
-
it "returns
|
329
|
-
expect(provider.uninstall_options).to eq(
|
328
|
+
it "returns nil by default" do
|
329
|
+
expect(provider.uninstall_options).to eq(nil)
|
330
330
|
end
|
331
331
|
|
332
332
|
it "returns uninstall_options when set" do
|
@@ -340,7 +340,7 @@ describe provider_class do
|
|
340
340
|
end
|
341
341
|
|
342
342
|
it 'returns uninstall_options when set as hash' do
|
343
|
-
provider.resource[:uninstall_options] = { '-Darch' => 'vax' }
|
343
|
+
provider.resource[:uninstall_options] = [{ '-Darch' => 'vax' }]
|
344
344
|
expect(provider.uninstall_options).to eq(['-Darch=vax'])
|
345
345
|
end
|
346
346
|
it 'returns uninstall_options when an array with hashes' do
|
@@ -241,7 +241,7 @@ describe Puppet::Type.type(:package).provider(:windows) do
|
|
241
241
|
end
|
242
242
|
|
243
243
|
it 'should sort hash keys' do
|
244
|
-
provider.join_options([{'b' => '2', 'a' => '1', 'c' => '3'}]).should == ['a=1 b=2 c=3']
|
244
|
+
provider.join_options([{'b' => '2', 'a' => '1', 'c' => '3'}]).should == ['a=1', 'b=2', 'c=3']
|
245
245
|
end
|
246
246
|
|
247
247
|
it 'should return strings and hashes' do
|
@@ -1,26 +1,36 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
|
4
|
+
provider_class = Puppet::Type.type(:package).provider(:yum)
|
5
|
+
|
6
|
+
describe provider_class do
|
7
|
+
let(:name) { 'mypackage' }
|
8
|
+
let(:resource) do
|
9
|
+
Puppet::Type.type(:package).new(
|
10
|
+
:name => name,
|
11
|
+
:ensure => :installed,
|
12
|
+
:provider => 'yum'
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:provider) do
|
17
|
+
provider = provider_class.new
|
18
|
+
provider.resource = resource
|
19
|
+
provider
|
20
|
+
end
|
5
21
|
|
6
|
-
describe provider do
|
7
22
|
before do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@provider.stubs(:yum).returns 'yum'
|
14
|
-
@provider.stubs(:rpm).returns 'rpm'
|
15
|
-
@provider.stubs(:get).with(:name).returns 'mypackage'
|
16
|
-
@provider.stubs(:get).with(:version).returns '1'
|
17
|
-
@provider.stubs(:get).with(:release).returns '1'
|
18
|
-
@provider.stubs(:get).with(:arch).returns 'i386'
|
23
|
+
provider.stubs(:yum).returns 'yum'
|
24
|
+
provider.stubs(:rpm).returns 'rpm'
|
25
|
+
provider.stubs(:get).with(:version).returns '1'
|
26
|
+
provider.stubs(:get).with(:release).returns '1'
|
27
|
+
provider.stubs(:get).with(:arch).returns 'i386'
|
19
28
|
end
|
29
|
+
|
20
30
|
# provider should repond to the following methods
|
21
|
-
[:install, :latest, :update, :purge].each do |method|
|
31
|
+
[:install, :latest, :update, :purge, :install_options].each do |method|
|
22
32
|
it "should have a(n) #{method}" do
|
23
|
-
|
33
|
+
provider.should respond_to(method)
|
24
34
|
end
|
25
35
|
end
|
26
36
|
|
@@ -32,35 +42,45 @@ describe provider do
|
|
32
42
|
end
|
33
43
|
|
34
44
|
it 'should call yum install for :installed' do
|
35
|
-
|
36
|
-
|
37
|
-
|
45
|
+
resource.stubs(:should).with(:ensure).returns :installed
|
46
|
+
provider.expects(:yum).with('-d', '0', '-e', '0', '-y', :install, 'mypackage')
|
47
|
+
provider.install
|
38
48
|
end
|
39
49
|
|
40
50
|
it 'should use :install to update' do
|
41
|
-
|
42
|
-
|
51
|
+
provider.expects(:install)
|
52
|
+
provider.update
|
43
53
|
end
|
44
54
|
|
45
55
|
it 'should be able to set version' do
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
56
|
+
resource[:ensure] = '1.2'
|
57
|
+
|
58
|
+
provider.expects(:yum).with('-d', '0', '-e', '0', '-y', :install, 'mypackage-1.2')
|
59
|
+
provider.stubs(:query).returns :ensure => '1.2'
|
60
|
+
provider.install
|
50
61
|
end
|
51
62
|
|
52
63
|
it 'should be able to downgrade' do
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
64
|
+
resource[:ensure] = '1.0'
|
65
|
+
|
66
|
+
provider.expects(:yum).with('-d', '0', '-e', '0', '-y', :downgrade, 'mypackage-1.0')
|
67
|
+
provider.stubs(:query).returns(:ensure => '1.2').then.returns(:ensure => '1.0')
|
68
|
+
provider.install
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should accept install options' do
|
72
|
+
resource[:ensure] = :installed
|
73
|
+
resource[:install_options] = ['-t', {'-x' => 'expackage'}]
|
74
|
+
|
75
|
+
provider.expects(:yum).with('-d', '0', '-e', '0', '-y', ['-t', '-x=expackage'], :install, 'mypackage')
|
76
|
+
provider.install
|
57
77
|
end
|
58
78
|
end
|
59
79
|
|
60
80
|
describe 'when uninstalling' do
|
61
81
|
it 'should use erase to purge' do
|
62
|
-
|
63
|
-
|
82
|
+
provider.expects(:yum).with('-y', :erase, 'mypackage')
|
83
|
+
provider.purge
|
64
84
|
end
|
65
85
|
end
|
66
86
|
|
@@ -68,61 +88,132 @@ describe provider do
|
|
68
88
|
provider.should be_versionable
|
69
89
|
end
|
70
90
|
|
71
|
-
describe '
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
91
|
+
describe 'determining the latest version available for a package' do
|
92
|
+
|
93
|
+
it "passes the value of enablerepo install_options when querying" do
|
94
|
+
resource[:install_options] = [
|
95
|
+
{'--enablerepo' => 'contrib'},
|
96
|
+
{'--enablerepo' => 'centosplus'},
|
97
|
+
]
|
98
|
+
provider.stubs(:properties).returns({:ensure => '3.4.5'})
|
99
|
+
|
100
|
+
described_class.expects(:latest_package_version).with('mypackage', ['contrib', 'centosplus'], [])
|
101
|
+
provider.latest
|
102
|
+
end
|
76
103
|
|
77
|
-
|
78
|
-
|
104
|
+
it "passes the value of disablerepo install_options when querying" do
|
105
|
+
resource[:install_options] = [
|
106
|
+
{'--disablerepo' => 'updates'},
|
107
|
+
{'--disablerepo' => 'centosplus'},
|
108
|
+
]
|
109
|
+
provider.stubs(:properties).returns({:ensure => '3.4.5'})
|
79
110
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
111
|
+
described_class.expects(:latest_package_version).with('mypackage', [], ['updates', 'centosplus'])
|
112
|
+
provider.latest
|
113
|
+
end
|
114
|
+
|
115
|
+
describe 'and a newer version is not available' do
|
116
|
+
before :each do
|
117
|
+
described_class.stubs(:latest_package_version).with('mypackage', [], []).returns nil
|
84
118
|
end
|
85
119
|
|
86
|
-
it '
|
87
|
-
|
120
|
+
it 'raises an error the package is not installed' do
|
121
|
+
provider.stubs(:properties).returns({:ensure => :absent})
|
122
|
+
expect {
|
123
|
+
provider.latest
|
124
|
+
}.to raise_error(Puppet::DevError, 'Tried to get latest on a missing package')
|
125
|
+
end
|
88
126
|
|
89
|
-
|
127
|
+
it 'returns version of the currently installed package' do
|
128
|
+
provider.stubs(:properties).returns({:ensure => '3.4.5'})
|
129
|
+
provider.latest.should == '3.4.5'
|
90
130
|
end
|
91
131
|
end
|
92
132
|
|
93
|
-
describe '
|
94
|
-
|
95
|
-
|
133
|
+
describe 'and a newer version is available' do
|
134
|
+
let(:latest_version) do
|
135
|
+
{
|
96
136
|
:name => 'mypackage',
|
97
137
|
:epoch => '1',
|
98
138
|
:version => '2.3.4',
|
99
139
|
:release => '5',
|
100
140
|
:arch => 'i686',
|
101
|
-
|
102
|
-
:ensure => '2.3.4-5'
|
103
|
-
})
|
141
|
+
}
|
104
142
|
end
|
105
143
|
|
106
144
|
it 'includes the epoch in the version string' do
|
107
|
-
|
145
|
+
described_class.stubs(:latest_package_version).with('mypackage', [], []).returns(latest_version)
|
146
|
+
provider.latest.should == '1:2.3.4-5'
|
108
147
|
end
|
109
148
|
end
|
110
149
|
end
|
111
150
|
|
112
|
-
describe
|
113
|
-
|
151
|
+
describe "lazy loading of latest package versions" do
|
152
|
+
before { described_class.clear }
|
153
|
+
after { described_class.clear }
|
114
154
|
|
115
|
-
let(:
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
155
|
+
let(:mypackage_version) do
|
156
|
+
{
|
157
|
+
:name => 'mypackage',
|
158
|
+
:epoch => '1',
|
159
|
+
:version => '2.3.4',
|
160
|
+
:release => '5',
|
161
|
+
:arch => 'i686',
|
162
|
+
}
|
123
163
|
end
|
124
164
|
|
125
|
-
let(:
|
165
|
+
let(:mypackage_newerversion) do
|
166
|
+
{
|
167
|
+
:name => 'mypackage',
|
168
|
+
:epoch => '1',
|
169
|
+
:version => '4.5.6',
|
170
|
+
:release => '7',
|
171
|
+
:arch => 'i686',
|
172
|
+
}
|
173
|
+
end
|
174
|
+
|
175
|
+
let(:latest_versions) { {'mypackage' => [mypackage_version]} }
|
176
|
+
let(:enabled_versions) { {'mypackage' => [mypackage_newerversion]} }
|
177
|
+
|
178
|
+
it "returns the version hash if the package was found" do
|
179
|
+
described_class.expects(:fetch_latest_versions).with([], []).once.returns(latest_versions)
|
180
|
+
version = described_class.latest_package_version('mypackage', [], [])
|
181
|
+
expect(version).to eq(mypackage_version)
|
182
|
+
end
|
183
|
+
|
184
|
+
it "is nil if the package was not found in the query" do
|
185
|
+
described_class.expects(:fetch_latest_versions).with([], []).once.returns(latest_versions)
|
186
|
+
version = described_class.latest_package_version('nopackage', [], [])
|
187
|
+
expect(version).to be_nil
|
188
|
+
end
|
189
|
+
|
190
|
+
it "caches the package list and reuses that for subsequent queries" do
|
191
|
+
described_class.expects(:fetch_latest_versions).with([], []).once.returns(latest_versions)
|
192
|
+
|
193
|
+
2.times {
|
194
|
+
version = described_class.latest_package_version('mypackage', [], [])
|
195
|
+
expect(version).to eq mypackage_version
|
196
|
+
}
|
197
|
+
end
|
198
|
+
|
199
|
+
it "caches separate lists for each combination of 'enablerepo' and 'disablerepo'" do
|
200
|
+
described_class.expects(:fetch_latest_versions).with([], []).once.returns(latest_versions)
|
201
|
+
described_class.expects(:fetch_latest_versions).with(['enabled'], ['disabled']).once.returns(enabled_versions)
|
202
|
+
|
203
|
+
2.times {
|
204
|
+
version = described_class.latest_package_version('mypackage', [], [])
|
205
|
+
expect(version).to eq mypackage_version
|
206
|
+
}
|
207
|
+
|
208
|
+
2.times {
|
209
|
+
version = described_class.latest_package_version('mypackage', ['enabled'], ['disabled'])
|
210
|
+
expect(version).to eq(mypackage_newerversion)
|
211
|
+
}
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
describe "querying for the latest version of all packages" do
|
216
|
+
let(:yumhelper_single_arch) do
|
126
217
|
<<-YUMHELPER_OUTPUT
|
127
218
|
* base: centos.tcpdiag.net
|
128
219
|
* extras: centos.mirrors.hoobly.com
|
@@ -134,62 +225,66 @@ _pkg mysummaryless 0 1.2.3.4 5.el4 noarch
|
|
134
225
|
YUMHELPER_OUTPUT
|
135
226
|
end
|
136
227
|
|
137
|
-
let(:
|
138
|
-
|
228
|
+
let(:yumhelper_multi_arch) do
|
229
|
+
yumhelper_single_arch + <<-YUMHELPER_OUTPUT
|
230
|
+
_pkg nss-tools 0 3.14.3 4.el6_4 i386
|
231
|
+
_pkg pixman 0 0.26.2 5.el6_4 i386
|
232
|
+
YUMHELPER_OUTPUT
|
139
233
|
end
|
140
234
|
|
141
|
-
let(:rpm_version) { "RPM version 4.8.0\n" }
|
142
235
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
236
|
+
it "creates an entry for each line that's prefixed with '_pkg'" do
|
237
|
+
described_class.expects(:python).with([described_class::YUMHELPER]).returns(yumhelper_single_arch)
|
238
|
+
entries = described_class.fetch_latest_versions([], [])
|
239
|
+
expect(entries.keys).to include 'nss-tools'
|
240
|
+
expect(entries.keys).to include 'pixman'
|
241
|
+
expect(entries.keys).to include 'myresource'
|
242
|
+
expect(entries.keys).to include 'mysummaryless'
|
148
243
|
end
|
149
244
|
|
150
|
-
|
151
|
-
|
152
|
-
|
245
|
+
it "creates an entry for each package name and architecture" do
|
246
|
+
described_class.expects(:python).with([described_class::YUMHELPER]).returns(yumhelper_single_arch)
|
247
|
+
entries = described_class.fetch_latest_versions([], [])
|
248
|
+
expect(entries.keys).to include 'nss-tools.x86_64'
|
249
|
+
expect(entries.keys).to include 'pixman.x86_64'
|
250
|
+
expect(entries.keys).to include 'myresource.noarch'
|
251
|
+
expect(entries.keys).to include 'mysummaryless.noarch'
|
153
252
|
end
|
154
253
|
|
155
|
-
|
156
|
-
|
157
|
-
|
254
|
+
it "stores multiple entries if a package is build for multiple architectures" do
|
255
|
+
described_class.expects(:python).with([described_class::YUMHELPER]).returns(yumhelper_multi_arch)
|
256
|
+
entries = described_class.fetch_latest_versions([], [])
|
257
|
+
expect(entries.keys).to include 'nss-tools.x86_64'
|
258
|
+
expect(entries.keys).to include 'pixman.x86_64'
|
259
|
+
expect(entries.keys).to include 'nss-tools.i386'
|
260
|
+
expect(entries.keys).to include 'pixman.i386'
|
158
261
|
|
159
|
-
|
160
|
-
|
262
|
+
expect(entries['nss-tools']).to have(2).items
|
263
|
+
expect(entries['pixman']).to have(2).items
|
161
264
|
end
|
162
265
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
266
|
+
it "passes the repos to enable to the helper" do
|
267
|
+
described_class.expects(:python).with do |script, *args|
|
268
|
+
expect(script).to eq described_class::YUMHELPER
|
269
|
+
expect(args).to eq %w[-e updates -e centosplus]
|
270
|
+
end.returns('')
|
271
|
+
described_class.fetch_latest_versions(['updates', 'centosplus'], [])
|
168
272
|
end
|
169
273
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
274
|
+
it "passes the repos to disable to the helper" do
|
275
|
+
described_class.expects(:python).with do |script, *args|
|
276
|
+
expect(script).to eq described_class::YUMHELPER
|
277
|
+
expect(args).to eq %w[-d updates -d centosplus]
|
278
|
+
end.returns('')
|
279
|
+
described_class.fetch_latest_versions([], ['updates', 'centosplus'])
|
175
280
|
end
|
176
281
|
|
177
|
-
it
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
expect(@logs.map(&:message).grep(/^Failed to match rpm line/)).to be_empty
|
184
|
-
expect(myresource.provider.latest_info).to eq({
|
185
|
-
:name=>"myresource",
|
186
|
-
:epoch=>"0",
|
187
|
-
:version=>"1.2.3.4",
|
188
|
-
:release=>"5.el4",
|
189
|
-
:arch=>"noarch",
|
190
|
-
:provider=>:yum,
|
191
|
-
:ensure=>"1.2.3.4-5.el4"
|
192
|
-
})
|
282
|
+
it 'passes a combination of repos to the helper' do
|
283
|
+
described_class.expects(:python).with do |script, *args|
|
284
|
+
expect(script).to eq described_class::YUMHELPER
|
285
|
+
expect(args).to eq %w[-e os -e contrib -d updates -d centosplus]
|
286
|
+
end.returns('')
|
287
|
+
described_class.fetch_latest_versions(['os', 'contrib'], ['updates', 'centosplus'])
|
193
288
|
end
|
194
289
|
end
|
195
290
|
end
|