puppet 5.5.16-x64-mingw32 → 5.5.21-x64-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.
- checksums.yaml +4 -4
- data/CODEOWNERS +10 -10
- data/Gemfile +2 -3
- data/Gemfile.lock +57 -52
- data/ext/build_defaults.yaml +1 -0
- data/ext/cert_inspector +3 -3
- data/ext/project_data.yaml +2 -2
- data/ext/puppet-test +2 -2
- data/ext/regexp_nodes/regexp_nodes.rb +4 -4
- data/ext/windows/service/daemon.rb +54 -8
- data/install.rb +6 -24
- data/lib/puppet.rb +5 -2
- data/lib/puppet/agent.rb +5 -13
- data/lib/puppet/application.rb +1 -1
- data/lib/puppet/application/agent.rb +15 -1
- data/lib/puppet/application/apply.rb +2 -2
- data/lib/puppet/application/describe.rb +3 -9
- data/lib/puppet/application/device.rb +4 -4
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/filebucket.rb +13 -0
- data/lib/puppet/application/lookup.rb +1 -1
- data/lib/puppet/application/resource.rb +4 -4
- data/lib/puppet/application/script.rb +2 -2
- data/lib/puppet/configurer.rb +86 -28
- data/lib/puppet/configurer/downloader.rb +2 -6
- data/lib/puppet/daemon.rb +1 -1
- data/lib/puppet/defaults.rb +82 -38
- data/lib/puppet/error.rb +9 -1
- data/lib/puppet/external/nagios/base.rb +1 -1
- data/lib/puppet/face/ca.rb +1 -1
- data/lib/puppet/face/config.rb +10 -48
- data/lib/puppet/face/facts.rb +1 -1
- data/lib/puppet/face/module/list.rb +5 -5
- data/lib/puppet/face/module/search.rb +1 -1
- data/lib/puppet/face/module/uninstall.rb +1 -1
- data/lib/puppet/face/module/upgrade.rb +1 -1
- data/lib/puppet/face/plugin.rb +9 -2
- data/lib/puppet/file_serving/http_metadata.rb +1 -1
- data/lib/puppet/file_system.rb +0 -8
- data/lib/puppet/file_system/memory_file.rb +1 -1
- data/lib/puppet/file_system/posix.rb +3 -2
- data/lib/puppet/file_system/uniquefile.rb +4 -0
- data/lib/puppet/forge.rb +3 -3
- data/lib/puppet/functions/epp.rb +4 -4
- data/lib/puppet/functions/inline_epp.rb +5 -5
- data/lib/puppet/functions/reduce.rb +2 -4
- data/lib/puppet/gettext/module_translations.rb +1 -1
- data/lib/puppet/graph/rb_tree_map.rb +2 -2
- data/lib/puppet/graph/simple_graph.rb +6 -5
- data/lib/puppet/indirector/catalog/compiler.rb +8 -0
- data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
- data/lib/puppet/indirector/hiera.rb +2 -0
- data/lib/puppet/indirector/resource/ral.rb +1 -3
- data/lib/puppet/indirector/resource/validator.rb +1 -1
- data/lib/puppet/interface.rb +2 -1
- data/lib/puppet/loaders.rb +0 -1
- data/lib/puppet/metatype/manager.rb +1 -1
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/module_tool/applications/builder.rb +1 -1
- data/lib/puppet/module_tool/applications/installer.rb +1 -1
- data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
- data/lib/puppet/module_tool/metadata.rb +1 -1
- data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
- data/lib/puppet/module_tool/tar/mini.rb +12 -2
- data/lib/puppet/network/http/api/indirected_routes.rb +13 -12
- data/lib/puppet/network/http/api/master/v3/environment.rb +3 -0
- data/lib/puppet/network/http/connection.rb +14 -12
- data/lib/puppet/network/http/factory.rb +1 -11
- data/lib/puppet/network/http/pool.rb +7 -1
- data/lib/puppet/network/http/rack/rest.rb +2 -2
- data/lib/puppet/network/http/site.rb +1 -1
- data/lib/puppet/network/resolver.rb +2 -2
- data/lib/puppet/node/environment.rb +4 -2
- data/lib/puppet/parameter.rb +8 -0
- data/lib/puppet/parser/ast.rb +1 -1
- data/lib/puppet/parser/ast/resourceparam.rb +1 -1
- data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +2 -0
- data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +2 -0
- data/lib/puppet/parser/environment_compiler.rb +3 -0
- data/lib/puppet/parser/functions.rb +1 -1
- data/lib/puppet/parser/functions/epp.rb +3 -3
- data/lib/puppet/parser/functions/inline_epp.rb +5 -5
- data/lib/puppet/parser/resource.rb +3 -2
- data/lib/puppet/parser/resource/param.rb +6 -0
- data/lib/puppet/pops/evaluator/access_operator.rb +2 -2
- data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +1 -1
- data/lib/puppet/pops/evaluator/external_syntax_support.rb +3 -2
- data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
- data/lib/puppet/pops/issues.rb +5 -0
- data/lib/puppet/pops/loaders.rb +1 -1
- data/lib/puppet/pops/lookup/hiera_config.rb +1 -0
- data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
- data/lib/puppet/pops/merge_strategy.rb +22 -18
- data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
- data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
- data/lib/puppet/pops/parser/locator.rb +1 -1
- data/lib/puppet/pops/parser/pn_parser.rb +17 -16
- data/lib/puppet/pops/puppet_stack.rb +51 -48
- data/lib/puppet/pops/resource/resource_type_impl.rb +2 -0
- data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
- data/lib/puppet/pops/types/string_converter.rb +10 -10
- data/lib/puppet/pops/types/type_calculator.rb +24 -0
- data/lib/puppet/pops/types/types.rb +3 -3
- data/lib/puppet/pops/validation/checker4_0.rb +10 -0
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/property/ensure.rb +1 -1
- data/lib/puppet/provider/augeas/augeas.rb +1 -1
- data/lib/puppet/provider/cron/crontab.rb +1 -1
- data/lib/puppet/provider/exec.rb +6 -2
- data/lib/puppet/provider/file/posix.rb +5 -0
- data/lib/puppet/provider/group/groupadd.rb +19 -19
- data/lib/puppet/provider/group/windows_adsi.rb +3 -3
- data/lib/puppet/provider/mailalias/aliases.rb +1 -1
- data/lib/puppet/provider/mount.rb +1 -1
- data/lib/puppet/provider/mount/parsed.rb +8 -8
- data/lib/puppet/provider/nameservice.rb +10 -3
- data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
- data/lib/puppet/provider/nameservice/pw.rb +2 -2
- data/lib/puppet/provider/package/aix.rb +17 -2
- data/lib/puppet/provider/package/apt.rb +14 -3
- data/lib/puppet/provider/package/dnf.rb +1 -1
- data/lib/puppet/provider/package/dnfmodule.rb +141 -0
- data/lib/puppet/provider/package/dpkg.rb +16 -18
- data/lib/puppet/provider/package/fink.rb +20 -3
- data/lib/puppet/provider/package/openbsd.rb +14 -2
- data/lib/puppet/provider/package/pip.rb +37 -10
- data/lib/puppet/provider/package/pkg.rb +18 -5
- data/lib/puppet/provider/package/pkgdmg.rb +1 -1
- data/lib/puppet/provider/package/pkgng.rb +16 -4
- data/lib/puppet/provider/package/portage.rb +4 -4
- data/lib/puppet/provider/package/rpm.rb +57 -19
- data/lib/puppet/provider/package/windows/package.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +35 -24
- data/lib/puppet/provider/package/zypper.rb +1 -0
- data/lib/puppet/provider/package_targetable.rb +5 -4
- data/lib/puppet/provider/parsedfile.rb +1 -1
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +3 -3
- data/lib/puppet/provider/selmodule/semodule.rb +43 -26
- data/lib/puppet/provider/service/daemontools.rb +9 -9
- data/lib/puppet/provider/service/launchd.rb +20 -5
- data/lib/puppet/provider/service/openbsd.rb +1 -1
- data/lib/puppet/provider/service/rcng.rb +2 -2
- data/lib/puppet/provider/service/runit.rb +2 -8
- data/lib/puppet/provider/service/systemd.rb +35 -22
- data/lib/puppet/provider/service/windows.rb +8 -0
- data/lib/puppet/provider/user/directoryservice.rb +31 -6
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/pw.rb +12 -3
- data/lib/puppet/provider/user/user_role_add.rb +5 -1
- data/lib/puppet/provider/user/useradd.rb +62 -27
- data/lib/puppet/provider/user/windows_adsi.rb +4 -5
- data/lib/puppet/provider/yumrepo/inifile.rb +2 -2
- data/lib/puppet/reference/indirection.rb +2 -2
- data/lib/puppet/reference/metaparameter.rb +1 -3
- data/lib/puppet/reference/providers.rb +1 -1
- data/lib/puppet/reference/type.rb +3 -9
- data/lib/puppet/reports.rb +1 -1
- data/lib/puppet/resource.rb +18 -1
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/resource/type.rb +8 -0
- data/lib/puppet/settings.rb +43 -3
- data/lib/puppet/settings/environment_conf.rb +1 -0
- data/lib/puppet/ssl/certificate.rb +2 -1
- data/lib/puppet/ssl/certificate_authority.rb +6 -5
- data/lib/puppet/ssl/certificate_authority/interface.rb +1 -1
- data/lib/puppet/ssl/certificate_factory.rb +2 -2
- data/lib/puppet/ssl/host.rb +3 -3
- data/lib/puppet/ssl/oids.rb +1 -1
- data/lib/puppet/test/test_helper.rb +15 -10
- data/lib/puppet/transaction/report.rb +1 -1
- data/lib/puppet/transaction/resource_harness.rb +1 -1
- data/lib/puppet/type.rb +15 -4
- data/lib/puppet/type/cron.rb +1 -1
- data/lib/puppet/type/exec.rb +21 -9
- data/lib/puppet/type/file.rb +14 -2
- data/lib/puppet/type/file/data_sync.rb +5 -1
- data/lib/puppet/type/group.rb +4 -2
- data/lib/puppet/type/interface.rb +1 -1
- data/lib/puppet/type/notify.rb +3 -2
- data/lib/puppet/type/package.rb +107 -8
- data/lib/puppet/type/schedule.rb +1 -1
- data/lib/puppet/type/selboolean.rb +17 -3
- data/lib/puppet/type/service.rb +9 -10
- data/lib/puppet/type/user.rb +6 -24
- data/lib/puppet/type/yumrepo.rb +3 -7
- data/lib/puppet/util.rb +47 -25
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/execution.rb +4 -3
- data/lib/puppet/util/http_proxy.rb +24 -16
- data/lib/puppet/util/instance_loader.rb +1 -1
- data/lib/puppet/util/log.rb +1 -1
- data/lib/puppet/util/log/destinations.rb +3 -12
- data/lib/puppet/util/logging.rb +30 -18
- data/lib/puppet/util/metric.rb +2 -2
- data/lib/puppet/util/monkey_patches.rb +1 -1
- data/lib/puppet/util/nagios_maker.rb +2 -2
- data/lib/puppet/util/network_device/cisco/device.rb +1 -1
- data/lib/puppet/util/network_device/cisco/interface.rb +2 -2
- data/lib/puppet/util/network_device/transport/ssh.rb +1 -1
- data/lib/puppet/util/pidlock.rb +12 -6
- data/lib/puppet/util/plist.rb +6 -0
- data/lib/puppet/util/provider_features.rb +2 -4
- data/lib/puppet/util/rdoc.rb +1 -1
- data/lib/puppet/util/reference.rb +1 -1
- data/lib/puppet/util/resource_template.rb +1 -1
- data/lib/puppet/util/selinux.rb +8 -2
- data/lib/puppet/util/windows/adsi.rb +60 -30
- data/lib/puppet/util/windows/api_types.rb +45 -32
- data/lib/puppet/util/windows/eventlog.rb +1 -6
- data/lib/puppet/util/windows/principal.rb +8 -6
- data/lib/puppet/util/windows/process.rb +16 -15
- data/lib/puppet/util/windows/registry.rb +17 -15
- data/lib/puppet/util/windows/security.rb +3 -0
- data/lib/puppet/util/windows/service.rb +149 -4
- data/lib/puppet/util/windows/sid.rb +4 -3
- data/lib/puppet/vendor.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet_pal.rb +2 -2
- data/locales/puppet.pot +479 -443
- data/man/man5/puppet.conf.5 +38 -8
- data/man/man8/puppet-agent.8 +2 -2
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-ca.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-cert.8 +1 -1
- data/man/man8/puppet-certificate.8 +1 -1
- data/man/man8/puppet-certificate_request.8 +1 -1
- data/man/man8/puppet-certificate_revocation_list.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +16 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-master.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/integration/provider/mailalias/aliases/test1 +1 -0
- data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list.txt +19 -0
- data/spec/fixtures/unit/provider/package/pkgng/pkg.version +2 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-subscription-manager.txt +9 -0
- data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services +9 -0
- data/spec/integration/configurer_spec.rb +52 -0
- data/spec/integration/defaults_spec.rb +1 -2
- data/spec/integration/indirector/facts/facter_spec.rb +4 -0
- data/spec/integration/parser/compiler_spec.rb +11 -0
- data/spec/integration/provider/service/systemd_spec.rb +8 -5
- data/spec/integration/type/file_spec.rb +28 -0
- data/spec/integration/type/notify_spec.rb +46 -0
- data/spec/integration/util/execution_spec.rb +27 -0
- data/spec/integration/util/windows/adsi_spec.rb +6 -1
- data/spec/integration/util/windows/registry_spec.rb +7 -7
- data/spec/unit/agent_spec.rb +34 -26
- data/spec/unit/application/agent_spec.rb +18 -0
- data/spec/unit/application/apply_spec.rb +2 -12
- data/spec/unit/application/device_spec.rb +1 -1
- data/spec/unit/configurer/fact_handler_spec.rb +0 -4
- data/spec/unit/configurer_spec.rb +377 -397
- data/spec/unit/daemon_spec.rb +0 -1
- data/spec/unit/face/facts_spec.rb +9 -0
- data/spec/unit/face/plugin_spec.rb +8 -0
- data/spec/unit/file_system/uniquefile_spec.rb +11 -0
- data/spec/unit/forge/forge_spec.rb +1 -3
- data/spec/unit/forge/repository_spec.rb +1 -3
- data/spec/unit/indirector/catalog/compiler_spec.rb +45 -26
- data/spec/unit/indirector/resource/ral_spec.rb +4 -4
- data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
- data/spec/unit/network/http/api/indirected_routes_spec.rb +28 -11
- data/spec/unit/network/http/connection_spec.rb +43 -1
- data/spec/unit/network/http/factory_spec.rb +27 -5
- data/spec/unit/network/http/pool_spec.rb +32 -0
- data/spec/unit/node_spec.rb +7 -4
- data/spec/unit/parser/environment_compiler_spec.rb +7 -0
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +8 -3
- data/spec/unit/pops/validator/validator_spec.rb +7 -0
- data/spec/unit/provider/exec_spec.rb +209 -0
- data/spec/unit/provider/group/groupadd_spec.rb +30 -1
- data/spec/unit/provider/group/windows_adsi_spec.rb +43 -10
- data/spec/unit/provider/package/aix_spec.rb +29 -0
- data/spec/unit/provider/package/apt_spec.rb +13 -2
- data/spec/unit/provider/package/aptitude_spec.rb +1 -0
- data/spec/unit/provider/package/aptrpm_spec.rb +1 -1
- data/spec/unit/provider/package/dnf_spec.rb +7 -0
- data/spec/unit/provider/package/dnfmodule_spec.rb +247 -0
- data/spec/unit/provider/package/dpkg_spec.rb +35 -7
- data/spec/unit/provider/package/openbsd_spec.rb +17 -0
- data/spec/unit/provider/package/pip_spec.rb +93 -22
- data/spec/unit/provider/package/pkg_spec.rb +13 -1
- data/spec/unit/provider/package/pkgdmg_spec.rb +1 -1
- data/spec/unit/provider/package/pkgng_spec.rb +36 -0
- data/spec/unit/provider/package/portage_spec.rb +4 -4
- data/spec/unit/provider/package/rpm_spec.rb +150 -16
- data/spec/unit/provider/package/yum_spec.rb +66 -0
- data/spec/unit/provider/package/zypper_spec.rb +13 -0
- data/spec/unit/provider/package_targetable_spec.rb +60 -0
- data/spec/unit/provider/selmodule_spec.rb +118 -47
- data/spec/unit/provider/service/daemontools_spec.rb +24 -0
- data/spec/unit/provider/service/launchd_spec.rb +28 -0
- data/spec/unit/provider/service/runit_spec.rb +24 -0
- data/spec/unit/provider/service/systemd_spec.rb +109 -36
- data/spec/unit/provider/service/windows_spec.rb +20 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +41 -0
- data/spec/unit/provider/user/hpux_spec.rb +2 -2
- data/spec/unit/provider/user/openbsd_spec.rb +1 -0
- data/spec/unit/provider/user/pw_spec.rb +37 -0
- data/spec/unit/provider/user/useradd_spec.rb +122 -15
- data/spec/unit/provider/user/windows_adsi_spec.rb +3 -3
- data/spec/unit/puppet_pal_2pec.rb +3 -0
- data/spec/unit/resource_spec.rb +26 -1
- data/spec/unit/ssl/certificate_authority_spec.rb +2 -3
- data/spec/unit/ssl/certificate_spec.rb +7 -0
- data/spec/unit/test/test_helper_spec.rb +17 -0
- data/spec/unit/transaction_spec.rb +18 -0
- data/spec/unit/type/exec_spec.rb +15 -12
- data/spec/unit/type/file/content_spec.rb +9 -3
- data/spec/unit/type/file/source_spec.rb +4 -4
- data/spec/unit/type/file_spec.rb +9 -4
- data/spec/unit/type/package_spec.rb +8 -0
- data/spec/unit/type/schedule_spec.rb +3 -1
- data/spec/unit/type/selboolean_spec.rb +4 -6
- data/spec/unit/type/service_spec.rb +25 -8
- data/spec/unit/type/user_spec.rb +32 -26
- data/spec/unit/type/yumrepo_spec.rb +30 -0
- data/spec/unit/type_spec.rb +40 -0
- data/spec/unit/util/execution_spec.rb +16 -0
- data/spec/unit/util/http_proxy_spec.rb +121 -1
- data/spec/unit/util/log/destinations_spec.rb +2 -26
- data/spec/unit/util/log_spec.rb +0 -112
- data/spec/unit/util/logging_spec.rb +200 -0
- data/spec/unit/util/pidlock_spec.rb +67 -40
- data/spec/unit/util/plist_spec.rb +20 -0
- data/spec/unit/util/windows/adsi_spec.rb +55 -4
- data/spec/unit/util/windows/api_types_spec.rb +104 -40
- data/spec/unit/util/windows/service_spec.rb +9 -0
- data/spec/unit/util/windows/sid_spec.rb +2 -2
- data/tasks/manpages.rake +1 -0
- metadata +18 -13
- data/ext/windows/eventlog/Rakefile +0 -32
- data/ext/windows/eventlog/puppetres.dll +0 -0
- data/ext/windows/eventlog/puppetres.mc +0 -18
- data/lib/puppet/pops/loader/null_loader.rb +0 -60
- data/locales/ja/puppet.po +0 -12114
- data/spec/integration/test/test_helper_spec.rb +0 -31
@@ -126,7 +126,10 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
|
|
126
126
|
|
127
127
|
it "considers the package held if its state is 'hold'" do
|
128
128
|
dpkg_query_execution_returns(bash_installed_output.gsub("install","hold"))
|
129
|
-
|
129
|
+
query=provider.query
|
130
|
+
expect(query[:ensure]).to eq("4.2-5ubuntu3")
|
131
|
+
expect(query[:mark]).to eq(:hold)
|
132
|
+
|
130
133
|
end
|
131
134
|
|
132
135
|
context "parsing tests" do
|
@@ -184,14 +187,15 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
|
|
184
187
|
|
185
188
|
it "uses 'dpkg -i' to install the package" do
|
186
189
|
expect(resource).to receive(:[]).with(:source).and_return("mypackagefile")
|
190
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
187
191
|
expect(provider).to receive(:unhold)
|
188
192
|
expect(provider).to receive(:dpkg).with(any_args, "-i", "mypackagefile")
|
189
|
-
|
190
193
|
provider.install
|
191
194
|
end
|
192
195
|
|
193
196
|
it "keeps old config files if told to do so" do
|
194
197
|
expect(resource).to receive(:[]).with(:configfiles).and_return(:keep)
|
198
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
195
199
|
expect(provider).to receive(:unhold)
|
196
200
|
expect(provider).to receive(:dpkg).with("--force-confold", any_args)
|
197
201
|
|
@@ -200,6 +204,7 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
|
|
200
204
|
|
201
205
|
it "replaces old config files if told to do so" do
|
202
206
|
expect(resource).to receive(:[]).with(:configfiles).and_return(:replace)
|
207
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
203
208
|
expect(provider).to receive(:unhold)
|
204
209
|
expect(provider).to receive(:dpkg).with("--force-confnew", any_args)
|
205
210
|
|
@@ -207,6 +212,7 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
|
|
207
212
|
end
|
208
213
|
|
209
214
|
it "ensures any hold is removed" do
|
215
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
210
216
|
expect(provider).to receive(:unhold).once
|
211
217
|
expect(provider).to receive(:dpkg)
|
212
218
|
provider.install
|
@@ -222,18 +228,28 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
|
|
222
228
|
end
|
223
229
|
|
224
230
|
it "installs first if package is not present and ensure holding" do
|
231
|
+
allow(provider).to receive(:execute)
|
232
|
+
allow(provider).to receive(:package_not_installed?).and_return(true)
|
233
|
+
expect(provider).to receive(:install).once
|
234
|
+
expect(provider).to receive(:hold)
|
235
|
+
provider.deprecated_hold
|
236
|
+
end
|
237
|
+
|
225
238
|
|
239
|
+
it "skips install new package if hold is true" do
|
226
240
|
allow(provider).to receive(:execute)
|
227
241
|
allow(provider).to receive(:package_not_installed?).and_return(true)
|
228
242
|
expect(provider).to receive(:install).once
|
229
|
-
provider.hold
|
243
|
+
expect(provider).to receive(:hold)
|
244
|
+
provider.deprecated_hold
|
230
245
|
end
|
231
246
|
|
232
247
|
it "skips install new package if package is allready installed" do
|
233
248
|
allow(provider).to receive(:execute)
|
234
249
|
allow(provider).to receive(:package_not_installed?).and_return(false)
|
235
250
|
expect(provider).not_to receive(:install)
|
236
|
-
provider.hold
|
251
|
+
expect(provider).to receive(:hold)
|
252
|
+
provider.deprecated_hold
|
237
253
|
end
|
238
254
|
|
239
255
|
it "executes dpkg --set-selections when holding" do
|
@@ -287,9 +303,21 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
|
|
287
303
|
provider.purge
|
288
304
|
end
|
289
305
|
|
290
|
-
|
291
|
-
|
292
|
-
|
306
|
+
context "package_not_installed?" do
|
307
|
+
it "returns true if package is not found" do
|
308
|
+
expect(provider).to receive(:dpkgquery).with("-W", "--showformat", "'${Status} ${Package} ${Version}\\n'", resource_name).and_raise(Puppet::ExecutionFailure.new("eh"))
|
309
|
+
expect(provider.package_not_installed?).to eq(true)
|
310
|
+
end
|
311
|
+
|
312
|
+
it "returns true if package is not installed" do
|
313
|
+
expect(provider).to receive(:dpkgquery).with("-W", "--showformat", "'${Status} ${Package} ${Version}\\n'", resource_name).and_return("unknown ok not-installed #{resource_name}")
|
314
|
+
expect(provider.package_not_installed?).to eq(true)
|
315
|
+
end
|
316
|
+
|
317
|
+
it "returns false if package is installed" do
|
318
|
+
expect(provider).to receive(:dpkgquery).with("-W", "--showformat", "'${Status} ${Package} ${Version}\\n'", resource_name).and_return("install ok installed resource_name 1.2.3")
|
319
|
+
expect(provider.package_not_installed?).to eq(false)
|
320
|
+
end
|
293
321
|
end
|
294
322
|
end
|
295
323
|
|
@@ -395,4 +395,21 @@ describe Puppet::Type.type(:package).provider(:openbsd) do
|
|
395
395
|
end
|
396
396
|
end
|
397
397
|
end
|
398
|
+
|
399
|
+
context "#flavor" do
|
400
|
+
before do
|
401
|
+
provider.instance_variable_get('@property_hash')[:flavor] = 'no_x11-python'
|
402
|
+
end
|
403
|
+
|
404
|
+
it 'should return the existing flavor' do
|
405
|
+
expect(provider.flavor).to eq('no_x11-python')
|
406
|
+
end
|
407
|
+
|
408
|
+
it 'should remove and install the new flavor if different' do
|
409
|
+
provider.resource[:flavor] = 'no_x11-ruby'
|
410
|
+
expect(provider).to receive(:uninstall).ordered
|
411
|
+
expect(provider).to receive(:install).ordered
|
412
|
+
provider.flavor = provider.resource[:flavor]
|
413
|
+
end
|
414
|
+
end
|
398
415
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
osfamilies = { 'windows' => ['pip.exe'], 'other' => ['pip', 'pip-python'] }
|
3
|
+
osfamilies = { 'windows' => ['pip.exe'], 'other' => ['pip', 'pip-python', 'pip2', 'pip-2'] }
|
4
|
+
pip_path_with_spaces = 'C:\Program Files (x86)\Python\Scripts\pip.exe'
|
4
5
|
|
5
6
|
describe Puppet::Type.type(:package).provider(:pip) do
|
6
7
|
|
@@ -93,6 +94,16 @@ describe Puppet::Type.type(:package).provider(:pip) do
|
|
93
94
|
expect(described_class.instances).to eq([])
|
94
95
|
end
|
95
96
|
end
|
97
|
+
|
98
|
+
context "when pip path location contains spaces" do
|
99
|
+
it "should quote the command before doing execpipe" do
|
100
|
+
allow(described_class).to receive(:which).and_return(pip_path_with_spaces)
|
101
|
+
allow(described_class).to receive(:pip_version).with(pip_path_with_spaces).and_return('8.0.1')
|
102
|
+
|
103
|
+
expect(described_class).to receive(:execpipe).with(["\"#{pip_path_with_spaces}\"", ["freeze"]])
|
104
|
+
described_class.instances
|
105
|
+
end
|
106
|
+
end
|
96
107
|
end
|
97
108
|
|
98
109
|
context "query" do
|
@@ -143,15 +154,18 @@ describe Puppet::Type.type(:package).provider(:pip) do
|
|
143
154
|
end
|
144
155
|
|
145
156
|
context "latest" do
|
157
|
+
before do
|
158
|
+
allow(described_class).to receive(:pip_version).with(pip_path).and_return(pip_version)
|
159
|
+
allow(described_class).to receive(:which).with('pip').and_return(pip_path)
|
160
|
+
allow(described_class).to receive(:which).with('pip-python').and_return(pip_path)
|
161
|
+
allow(described_class).to receive(:which).with('pip.exe').and_return(pip_path)
|
162
|
+
allow(described_class).to receive(:provider_command).and_return(pip_path)
|
163
|
+
allow(described_class).to receive(:validate_command).with(pip_path)
|
164
|
+
end
|
165
|
+
|
146
166
|
context "with pip version < 1.5.4" do
|
147
|
-
|
148
|
-
|
149
|
-
allow(described_class).to receive(:which).with('pip').and_return("/fake/bin/pip")
|
150
|
-
allow(described_class).to receive(:which).with('pip-python').and_return("/fake/bin/pip")
|
151
|
-
allow(described_class).to receive(:which).with('pip.exe').and_return("/fake/bin/pip")
|
152
|
-
allow(described_class).to receive(:provider_command).and_return('/fake/bin/pip')
|
153
|
-
allow(described_class).to receive(:validate_command).with('/fake/bin/pip')
|
154
|
-
end
|
167
|
+
let(:pip_version) { '1.0.1' }
|
168
|
+
let(:pip_path) { '/fake/bin/pip' }
|
155
169
|
|
156
170
|
it "should find a version number for new_pip_package" do
|
157
171
|
p = StringIO.new(
|
@@ -197,19 +211,29 @@ describe Puppet::Type.type(:package).provider(:pip) do
|
|
197
211
|
@resource[:name] = "fake_package"
|
198
212
|
expect(@provider.latest).to eq(nil)
|
199
213
|
end
|
214
|
+
|
215
|
+
it "should use 'install_options' when specified" do
|
216
|
+
expect(Puppet::Util::Execution).to receive(:execpipe).with(array_including([["--index=https://fake.example.com"]])).once
|
217
|
+
@resource[:name] = "fake_package"
|
218
|
+
@resource[:install_options] = ['--index' => 'https://fake.example.com']
|
219
|
+
expect(@provider.latest).to eq(nil)
|
220
|
+
end
|
221
|
+
|
222
|
+
context "when pip path location contains spaces" do
|
223
|
+
let(:pip_path) { pip_path_with_spaces }
|
224
|
+
|
225
|
+
it "should quote the command before doing execpipe" do
|
226
|
+
expect(Puppet::Util::Execution).to receive(:execpipe).with(array_including("\"#{pip_path}\""))
|
227
|
+
@provider.latest
|
228
|
+
end
|
229
|
+
end
|
200
230
|
end
|
201
231
|
|
202
232
|
context "with pip version >= 1.5.4" do
|
203
233
|
# For Pip 1.5.4 and above, you can get a version list from CLI - which allows for native pip behavior
|
204
234
|
# with regards to custom repositories, proxies and the like
|
205
|
-
|
206
|
-
|
207
|
-
allow(described_class).to receive(:which).with('pip').and_return("/fake/bin/pip")
|
208
|
-
allow(described_class).to receive(:which).with('pip-python').and_return("/fake/bin/pip")
|
209
|
-
allow(described_class).to receive(:which).with('pip.exe').and_return("/fake/bin/pip")
|
210
|
-
allow(described_class).to receive(:provider_command).and_return('/fake/bin/pip')
|
211
|
-
allow(described_class).to receive(:validate_command).with('/fake/bin/pip')
|
212
|
-
end
|
235
|
+
let(:pip_version) { '1.5.4' }
|
236
|
+
let(:pip_path) { '/fake/bin/pip' }
|
213
237
|
|
214
238
|
it "should find a version number for real_package" do
|
215
239
|
p = StringIO.new(
|
@@ -251,6 +275,22 @@ describe Puppet::Type.type(:package).provider(:pip) do
|
|
251
275
|
latest = @provider.latest
|
252
276
|
expect(latest).to eq('15.0.2')
|
253
277
|
end
|
278
|
+
|
279
|
+
it "should use 'install_options' when specified" do
|
280
|
+
expect(Puppet::Util::Execution).to receive(:execpipe).with(array_including([["--index=https://fake.example.com"]])).once
|
281
|
+
@resource[:name] = "fake_package"
|
282
|
+
@resource[:install_options] = ['--index' => 'https://fake.example.com']
|
283
|
+
expect(@provider.latest).to eq(nil)
|
284
|
+
end
|
285
|
+
|
286
|
+
context "when pip path location contains spaces" do
|
287
|
+
let(:pip_path) { pip_path_with_spaces }
|
288
|
+
|
289
|
+
it "should quote the command before doing execpipe" do
|
290
|
+
expect(Puppet::Util::Execution).to receive(:execpipe).with(array_including("\"#{pip_path}\""))
|
291
|
+
@provider.latest
|
292
|
+
end
|
293
|
+
end
|
254
294
|
end
|
255
295
|
end
|
256
296
|
|
@@ -341,12 +381,43 @@ describe Puppet::Type.type(:package).provider(:pip) do
|
|
341
381
|
end
|
342
382
|
|
343
383
|
context "pip_version" do
|
384
|
+
let(:pip) { '/fake/bin/pip' }
|
385
|
+
|
344
386
|
it "should look up version if pip is present" do
|
345
|
-
allow(described_class).to receive(:pip_cmd).and_return(
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
expect(described_class.pip_version(
|
387
|
+
allow(described_class).to receive(:pip_cmd).and_return(pip)
|
388
|
+
process = ['pip 8.0.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)']
|
389
|
+
allow(described_class).to receive(:execpipe).with([pip, '--version']).and_yield(process)
|
390
|
+
|
391
|
+
expect(described_class.pip_version(pip)).to eq('8.0.2')
|
392
|
+
end
|
393
|
+
|
394
|
+
it "parses multiple lines of output" do
|
395
|
+
allow(described_class).to receive(:pip_cmd).and_return(pip)
|
396
|
+
process = [
|
397
|
+
"/usr/local/lib/python2.7/dist-packages/urllib3/contrib/socks.py:37: DependencyWarning: SOCKS support in urllib3 requires the installation of optional dependencies: specifically, PySocks. For more information, see https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies",
|
398
|
+
" DependencyWarning",
|
399
|
+
"pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)"
|
400
|
+
]
|
401
|
+
allow(described_class).to receive(:execpipe).with([pip, '--version']).and_yield(process)
|
402
|
+
|
403
|
+
expect(described_class.pip_version(pip)).to eq('1.5.6')
|
404
|
+
end
|
405
|
+
|
406
|
+
it "raises if there isn't a version string" do
|
407
|
+
allow(described_class).to receive(:pip_cmd).and_return(pip)
|
408
|
+
allow(described_class).to receive(:execpipe).with([pip, '--version']).and_yield([""])
|
409
|
+
expect {
|
410
|
+
described_class.pip_version(pip)
|
411
|
+
}.to raise_error(Puppet::Error, 'Cannot resolve pip version')
|
412
|
+
end
|
413
|
+
|
414
|
+
it "quotes commands with spaces" do
|
415
|
+
pip = 'C:\Program Files\Python27\Scripts\pip.exe'
|
416
|
+
allow(described_class).to receive(:pip_cmd).and_return(pip)
|
417
|
+
process = ["pip 18.1 from c:\program files\python27\lib\site-packages\pip (python 2.7)\r\n"]
|
418
|
+
allow(described_class).to receive(:execpipe).with(["\"#{pip}\"", '--version']).and_yield(process)
|
419
|
+
|
420
|
+
expect(described_class.pip_version(pip)).to eq('18.1')
|
350
421
|
end
|
351
422
|
end
|
352
423
|
|
@@ -90,7 +90,7 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
90
90
|
|
91
91
|
{
|
92
92
|
'pkg://omnios/SUNWcs@0.5.11,5.11-0.151006:20130506T161045Z i--' => {:name => 'SUNWcs', :ensure => '0.5.11,5.11-0.151006:20130506T161045Z', :status => 'installed', :provider => :pkg, :publisher => 'omnios'},
|
93
|
-
'pkg://omnios/incorporation/jeos/illumos-gate@11,5.11-0.151006:20130506T183443Z if-' => {:name => 'incorporation/jeos/illumos-gate', :ensure =>
|
93
|
+
'pkg://omnios/incorporation/jeos/illumos-gate@11,5.11-0.151006:20130506T183443Z if-' => {:name => 'incorporation/jeos/illumos-gate', :ensure => "11,5.11-0.151006:20130506T183443Z", :mark => :hold, :status => 'installed', :provider => :pkg, :publisher => 'omnios'},
|
94
94
|
'pkg://solaris/SUNWcs@0.5.11,5.11-0.151.0.1:20101105T001108Z installed -----' => {:name => 'SUNWcs', :ensure => '0.5.11,5.11-0.151.0.1:20101105T001108Z', :status => 'installed', :provider => :pkg, :publisher => 'solaris'},
|
95
95
|
}.each do |k, v|
|
96
96
|
it "[#{k}] should correctly parse" do
|
@@ -251,6 +251,7 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
251
251
|
|
252
252
|
it "should accept all licenses" do
|
253
253
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => :absent})
|
254
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
254
255
|
expect(Puppet::Util::Execution).to receive(:execute)
|
255
256
|
.with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true})
|
256
257
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
|
@@ -265,6 +266,7 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
265
266
|
# Should install also check if the version installed is the same version we are asked to install? or should we rely on puppet for that?
|
266
267
|
resource[:ensure] = '0.0.7,5.11-0.151006:20131230T130000Z'
|
267
268
|
allow($CHILD_STATUS).to receive(:exitstatus).and_return(0)
|
269
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
268
270
|
expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
269
271
|
expect(Puppet::Util::Execution).to receive(:execute)
|
270
272
|
.with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
|
@@ -277,6 +279,7 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
277
279
|
|
278
280
|
it "should install specific version(2)" do
|
279
281
|
resource[:ensure] = '0.0.8'
|
282
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
280
283
|
expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
281
284
|
expect(Puppet::Util::Execution).to receive(:execute)
|
282
285
|
.with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
|
@@ -290,6 +293,7 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
290
293
|
|
291
294
|
it "should downgrade to specific version" do
|
292
295
|
resource[:ensure] = '0.0.7'
|
296
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
293
297
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => '0.0.8,5.11-0.151106:20131230T130000Z'})
|
294
298
|
allow($CHILD_STATUS).to receive(:exitstatus).and_return(0)
|
295
299
|
expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
@@ -301,6 +305,7 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
301
305
|
|
302
306
|
it "should install any if version is not specified" do
|
303
307
|
resource[:ensure] = :present
|
308
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
304
309
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => :absent})
|
305
310
|
expect(Puppet::Util::Execution).to receive(:execute)
|
306
311
|
.with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true})
|
@@ -312,6 +317,7 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
312
317
|
|
313
318
|
it "should install if no version was previously installed, and a specific version was requested" do
|
314
319
|
resource[:ensure] = '0.0.7'
|
320
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
315
321
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => :absent})
|
316
322
|
expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
317
323
|
expect(Puppet::Util::Execution).to receive(:execute)
|
@@ -325,6 +331,7 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
325
331
|
resource[:ensure] = '1.0-0.151006'
|
326
332
|
is = :absent
|
327
333
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => is})
|
334
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
328
335
|
expect(described_class).to receive(:pkg)
|
329
336
|
.with(:list, '-Hvfa', 'dummy@1.0-0.151006')
|
330
337
|
.and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0))
|
@@ -340,6 +347,7 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
340
347
|
resource[:ensure] = '1.0-0.151006'
|
341
348
|
is = '1.0,5.11-0.151006:20140219T191204Z'
|
342
349
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => is})
|
350
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
343
351
|
expect(described_class).to receive(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').and_return(File.read(my_fixture('dummy_implicit_version')))
|
344
352
|
expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
345
353
|
expect(provider).to receive(:unhold).with(no_args)
|
@@ -398,12 +406,16 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
398
406
|
it "should support current pkg version" do
|
399
407
|
expect(described_class).to receive(:pkg).with(:version).and_return('630e1ffc7a19')
|
400
408
|
expect(described_class).to receive(:pkg).with([:uninstall, resource[:name]])
|
409
|
+
expect(provider).to receive(:properties).and_return({:hold => false})
|
410
|
+
|
401
411
|
provider.uninstall
|
402
412
|
end
|
403
413
|
|
404
414
|
it "should support original pkg commands" do
|
405
415
|
expect(described_class).to receive(:pkg).with(:version).and_return('052adf36c3f4')
|
406
416
|
expect(described_class).to receive(:pkg).with([:uninstall, '-r', resource[:name]])
|
417
|
+
expect(provider).to receive(:properties).and_return({:hold => false})
|
418
|
+
|
407
419
|
provider.uninstall
|
408
420
|
end
|
409
421
|
end
|
@@ -45,7 +45,7 @@ describe Puppet::Type.type(:package).provider(:pkgdmg) do
|
|
45
45
|
it "should call hdiutil to mount and eject the disk image" do
|
46
46
|
allow(Dir).to receive(:entries).and_return([])
|
47
47
|
expect(provider.class).to receive(:hdiutil).with("eject", fake_mountpoint).and_return(0)
|
48
|
-
expect(provider.class).to receive(:hdiutil).with("mount", "-plist", "-nobrowse", "-readonly", "-
|
48
|
+
expect(provider.class).to receive(:hdiutil).with("mount", "-plist", "-nobrowse", "-readonly", "-mountrandom", "/tmp", '/tmp/foo').and_return('a plist')
|
49
49
|
expect(Puppet::Util::Plist).to receive(:parse_plist).with('a plist').and_return(fake_hdiutil_plist)
|
50
50
|
provider.install
|
51
51
|
end
|
@@ -110,6 +110,30 @@ describe Puppet::Type.type(:package).provider(:pkgng) do
|
|
110
110
|
end
|
111
111
|
resource.provider.install
|
112
112
|
end
|
113
|
+
|
114
|
+
it "should call pkg with the specified install options string" do
|
115
|
+
resource = Puppet::Type.type(:package).new(
|
116
|
+
:name => 'curl',
|
117
|
+
:provider => :pkgng,
|
118
|
+
:install_options => ['--foo', '--bar']
|
119
|
+
)
|
120
|
+
expect(resource.provider).to receive(:pkg) do |arg|
|
121
|
+
expect(arg).to include('--foo', '--bar')
|
122
|
+
end
|
123
|
+
resource.provider.install
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should call pkg with the specified install options hash" do
|
127
|
+
resource = Puppet::Type.type(:package).new(
|
128
|
+
:name => 'curl',
|
129
|
+
:provider => :pkgng,
|
130
|
+
:install_options => ['--foo', { '--bar' => 'baz', '--baz' => 'foo' }]
|
131
|
+
)
|
132
|
+
expect(resource.provider).to receive(:pkg) do |arg|
|
133
|
+
expect(arg).to include('--foo', '--bar=baz', '--baz=foo')
|
134
|
+
end
|
135
|
+
resource.provider.install
|
136
|
+
end
|
113
137
|
end
|
114
138
|
|
115
139
|
context "#prefetch" do
|
@@ -169,6 +193,18 @@ describe Puppet::Type.type(:package).provider(:pkgng) do
|
|
169
193
|
bash_comp_latest_version = described_class.get_latest_version('shells/bash-completion', version_list)
|
170
194
|
expect(bash_comp_latest_version).to eq('2.1_3')
|
171
195
|
end
|
196
|
+
|
197
|
+
it "should return nil when the package is orphaned" do
|
198
|
+
version_list = File.read(my_fixture('pkg.version'))
|
199
|
+
orphan_latest_version = described_class.get_latest_version('sysutils/orphan', version_list)
|
200
|
+
expect(orphan_latest_version).to be_nil
|
201
|
+
end
|
202
|
+
|
203
|
+
it "should return nil when the package is broken" do
|
204
|
+
version_list = File.read(my_fixture('pkg.version'))
|
205
|
+
broken_latest_version = described_class.get_latest_version('sysutils/broken', version_list)
|
206
|
+
expect(broken_latest_version).to be_nil
|
207
|
+
end
|
172
208
|
end
|
173
209
|
|
174
210
|
describe "confine" do
|
@@ -42,13 +42,13 @@ describe Puppet::Type.type(:package).provider(:portage) do
|
|
42
42
|
allow(@unslotted_provider).to receive(:qatom).and_return({:category=>"dev-lang", :pn=>"ruby", :pv=>nil, :pr=>nil, :slot=>nil, :pfx=>nil, :sfx=>nil})
|
43
43
|
allow(@unslotted_provider.class).to receive(:emerge).with('--list-sets').and_return(package_sets)
|
44
44
|
@slotted_provider = described_class.new(@slotted_resource)
|
45
|
-
allow(@slotted_provider).to receive(:qatom).and_return({:category=>"dev-lang", :pn=>"ruby", :pv=>nil, :pr=>nil, :slot=>"
|
45
|
+
allow(@slotted_provider).to receive(:qatom).and_return({:category=>"dev-lang", :pn=>"ruby", :pv=>nil, :pr=>nil, :slot=>"2.1", :pfx=>nil, :sfx=>nil})
|
46
46
|
allow(@slotted_provider.class).to receive(:emerge).with('--list-sets').and_return(package_sets)
|
47
47
|
@versioned_provider = described_class.new(@versioned_resource)
|
48
48
|
allow(@versioned_provider).to receive(:qatom).and_return({:category=>"dev-lang", :pn=>"ruby", :pv=>"1.9.3", :pr=>nil, :slot=>nil, :pfx=>nil, :sfx=>nil})
|
49
49
|
allow(@versioned_provider.class).to receive(:emerge).with('--list-sets').and_return(package_sets)
|
50
50
|
@versioned_slotted_provider = described_class.new(@versioned_slotted_resource)
|
51
|
-
allow(@versioned_slotted_provider).to receive(:qatom).and_return({:category=>"dev-lang", :pn=>"ruby", :pv=>"1.9.3", :pr=>nil, :slot=>"
|
51
|
+
allow(@versioned_slotted_provider).to receive(:qatom).and_return({:category=>"dev-lang", :pn=>"ruby", :pv=>"1.9.3", :pr=>nil, :slot=>"1.9", :pfx=>"=", :sfx=>nil})
|
52
52
|
allow(@versioned_slotted_provider.class).to receive(:emerge).with('--list-sets').and_return(package_sets)
|
53
53
|
@set_provider = described_class.new(@set_resource)
|
54
54
|
allow(@set_provider).to receive(:qatom).and_return({:category=>nil, :pn=>"@system", :pv=>nil, :pr=>nil, :slot=>nil, :pfx=>nil, :sfx=>nil})
|
@@ -166,7 +166,7 @@ describe Puppet::Type.type(:package).provider(:portage) do
|
|
166
166
|
end
|
167
167
|
|
168
168
|
it "can extract the slot from the package name" do
|
169
|
-
expect(@slotted_provider.qatom[:slot]).to eq('
|
169
|
+
expect(@slotted_provider.qatom[:slot]).to eq('2.1')
|
170
170
|
end
|
171
171
|
|
172
172
|
it "returns nil for as the slot when no slot is specified" do
|
@@ -182,7 +182,7 @@ describe Puppet::Type.type(:package).provider(:portage) do
|
|
182
182
|
expect(@versioned_slotted_provider.qatom[:category]).to eq('dev-lang')
|
183
183
|
expect(@versioned_slotted_provider.qatom[:pn]).to eq('ruby')
|
184
184
|
expect(@versioned_slotted_provider.qatom[:pv]).to eq('1.9.3')
|
185
|
-
expect(@versioned_slotted_provider.qatom[:slot]).to eq('
|
185
|
+
expect(@versioned_slotted_provider.qatom[:slot]).to eq('1.9')
|
186
186
|
end
|
187
187
|
|
188
188
|
it "can handle search output with slots for unslotted packages" do
|