puppet 5.5.16-x86-mingw32 → 5.5.21-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.
- 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
@@ -9,6 +9,8 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
9
9
|
myresource 0 1.2.3.4 5.el4 noarch
|
10
10
|
mysummaryless 0 1.2.3.4 5.el4 noarch
|
11
11
|
tomcat 1 1.2.3.4 5.el4 x86_64
|
12
|
+
kernel 1 1.2.3.4 5.el4 x86_64
|
13
|
+
kernel 1 1.2.3.6 5.el4 x86_64
|
12
14
|
'
|
13
15
|
RPM_OUTPUT
|
14
16
|
end
|
@@ -57,7 +59,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
57
59
|
describe "with a modern version of RPM" do
|
58
60
|
it "includes all the modern flags" do
|
59
61
|
expect(Puppet::Util::Execution).to receive(:execpipe)
|
60
|
-
.with("/bin/rpm -qa --nosignature --nodigest --qf '#{nevra_format}'")
|
62
|
+
.with("/bin/rpm -qa --nosignature --nodigest --qf '#{nevra_format}' | sort")
|
61
63
|
.and_yield(packages)
|
62
64
|
|
63
65
|
described_class.instances
|
@@ -69,7 +71,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
69
71
|
|
70
72
|
it "excludes the --nosignature flag" do
|
71
73
|
expect(Puppet::Util::Execution).to receive(:execpipe)
|
72
|
-
.with("/bin/rpm -qa --nodigest --qf '#{nevra_format}'")
|
74
|
+
.with("/bin/rpm -qa --nodigest --qf '#{nevra_format}' | sort")
|
73
75
|
.and_yield(packages)
|
74
76
|
|
75
77
|
described_class.instances
|
@@ -81,7 +83,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
81
83
|
|
82
84
|
it "excludes the --nodigest flag" do
|
83
85
|
expect(Puppet::Util::Execution).to receive(:execpipe)
|
84
|
-
.with("/bin/rpm -qa --qf '#{nevra_format}'")
|
86
|
+
.with("/bin/rpm -qa --qf '#{nevra_format}' | sort")
|
85
87
|
.and_yield(packages)
|
86
88
|
|
87
89
|
described_class.instances
|
@@ -90,7 +92,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
90
92
|
|
91
93
|
it "returns an array of packages" do
|
92
94
|
expect(Puppet::Util::Execution).to receive(:execpipe)
|
93
|
-
.with("/bin/rpm -qa --nosignature --nodigest --qf '#{nevra_format}'")
|
95
|
+
.with("/bin/rpm -qa --nosignature --nodigest --qf '#{nevra_format}' | sort")
|
94
96
|
.and_yield(packages)
|
95
97
|
|
96
98
|
installed_packages = described_class.instances
|
@@ -161,6 +163,17 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
161
163
|
:ensure => "1:1.2.3.4-5.el4",
|
162
164
|
}
|
163
165
|
)
|
166
|
+
expect(installed_packages[6].properties).to eq(
|
167
|
+
{
|
168
|
+
:provider => :rpm,
|
169
|
+
:name => "kernel",
|
170
|
+
:epoch => "1",
|
171
|
+
:version => "1.2.3.4",
|
172
|
+
:release => "5.el4",
|
173
|
+
:arch => "x86_64",
|
174
|
+
:ensure => "1:1.2.3.4-5.el4; 1:1.2.3.6-5.el4",
|
175
|
+
}
|
176
|
+
)
|
164
177
|
end
|
165
178
|
end
|
166
179
|
|
@@ -218,7 +231,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
218
231
|
it "retrieves version string after querying rpm for version from source file" do
|
219
232
|
expect(resource).to receive(:[]).with(:source).and_return('source-string')
|
220
233
|
expect(Puppet::Util::Execution).to receive(:execute)
|
221
|
-
.with(["/bin/rpm", "-q", "--qf", "
|
234
|
+
.with(["/bin/rpm", "-q", "--qf", "#{nevra_format}", "-p", "source-string"])
|
222
235
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("myresource 0 1.2.3.4 5.el4 noarch\n", 0))
|
223
236
|
expect(provider.latest).to eq("1.2.3.4-5.el4")
|
224
237
|
end
|
@@ -226,7 +239,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
226
239
|
it "raises an error if the rpm command fails" do
|
227
240
|
expect(resource).to receive(:[]).with(:source).and_return('source-string')
|
228
241
|
expect(Puppet::Util::Execution).to receive(:execute)
|
229
|
-
.with(["/bin/rpm", "-q", "--qf", "
|
242
|
+
.with(["/bin/rpm", "-q", "--qf", "#{nevra_format}", "-p", "source-string"])
|
230
243
|
.and_raise(Puppet::ExecutionFailure, 'rpm command failed')
|
231
244
|
|
232
245
|
expect {
|
@@ -248,7 +261,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
248
261
|
|
249
262
|
before(:each) do
|
250
263
|
expect(Puppet::Util::Execution).to receive(:execute)
|
251
|
-
.with(["/bin/rpm", "-q", resource_name, '', '', '--qf', "
|
264
|
+
.with(["/bin/rpm", "-q", resource_name, '', '', '--qf', "#{nevra_format}"], execute_options)
|
252
265
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("#{resource_name} 0 1.2.3.4 5.el4 noarch\n", 0))
|
253
266
|
end
|
254
267
|
|
@@ -266,7 +279,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
266
279
|
|
267
280
|
before(:each) do
|
268
281
|
expect(Puppet::Util::Execution).to receive(:execute)
|
269
|
-
.with(["/bin/rpm", "-q", resource_name, '--nosignature', '--nodigest', "--qf", "
|
282
|
+
.with(["/bin/rpm", "-q", resource_name, '--nosignature', '--nodigest', "--qf", "#{nevra_format}"], execute_options)
|
270
283
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("#{resource_name} 0 1.2.3.4 5.el4 noarch\n", 0))
|
271
284
|
end
|
272
285
|
|
@@ -290,7 +303,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
290
303
|
|
291
304
|
before(:each) do
|
292
305
|
expect(Puppet::Util::Execution).to receive(:execute)
|
293
|
-
.with(["/bin/rpm", "-q", "#{resource_name}.noarch", '--nosignature', '--nodigest', "--qf", "
|
306
|
+
.with(["/bin/rpm", "-q", "#{resource_name}.noarch", '--nosignature', '--nodigest', "--qf", "#{nevra_format}"], execute_options)
|
294
307
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("#{resource_name} 0 1.2.3.4 5.el4 noarch\n", 0))
|
295
308
|
end
|
296
309
|
|
@@ -312,7 +325,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
312
325
|
|
313
326
|
before(:each) do
|
314
327
|
expect(Puppet::Util::Execution).to receive(:execute)
|
315
|
-
.with(["/bin/rpm", "-q", "#{resource_name}-1.2.3.4-5.el4", '--nosignature', '--nodigest', "--qf", "
|
328
|
+
.with(["/bin/rpm", "-q", "#{resource_name}-1.2.3.4-5.el4", '--nosignature', '--nodigest', "--qf", "#{nevra_format}"], execute_options)
|
316
329
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("#{resource_name} 0 1.2.3.4 5.el4 noarch\n", 0))
|
317
330
|
end
|
318
331
|
|
@@ -334,7 +347,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
334
347
|
|
335
348
|
before(:each) do
|
336
349
|
expect(Puppet::Util::Execution).to receive(:execute)
|
337
|
-
.with(["/bin/rpm", "-q", "#{resource_name}-1.2.3.4", '--nosignature', '--nodigest', "--qf", "
|
350
|
+
.with(["/bin/rpm", "-q", "#{resource_name}-1.2.3.4", '--nosignature', '--nodigest', "--qf", "#{nevra_format}"], execute_options)
|
338
351
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("#{resource_name} 0 1.2.3.4 5.el4 noarch\n", 0))
|
339
352
|
end
|
340
353
|
|
@@ -358,7 +371,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
358
371
|
|
359
372
|
before(:each) do
|
360
373
|
expect(Puppet::Util::Execution).to receive(:execute)
|
361
|
-
.with(["/bin/rpm", "-q", resource_name, '--nosignature', '--nodigest', "--qf", "
|
374
|
+
.with(["/bin/rpm", "-q", resource_name, '--nosignature', '--nodigest', "--qf", "#{nevra_format}"], execute_options)
|
362
375
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("#{resource_name} 0 1.2.3.4 5.el4 noarch\n", 0))
|
363
376
|
end
|
364
377
|
|
@@ -374,7 +387,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
374
387
|
def parser_test(rpm_output_string, gold_hash, number_of_debug_logs = 0)
|
375
388
|
expect(Puppet).to receive(:debug).exactly(number_of_debug_logs).times()
|
376
389
|
expect(Puppet::Util::Execution).to receive(:execute)
|
377
|
-
.with(["/bin/rpm", "-q", resource_name, "--nosignature", "--nodigest", "--qf", "
|
390
|
+
.with(["/bin/rpm", "-q", resource_name, "--nosignature", "--nodigest", "--qf", "#{nevra_format}"], execute_options)
|
378
391
|
.and_return(Puppet::Util::Execution::ProcessOutput.new(rpm_output_string, 0))
|
379
392
|
expect(provider.query).to eq(gold_hash)
|
380
393
|
end
|
@@ -413,7 +426,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
413
426
|
describe "when the package is not found" do
|
414
427
|
before do
|
415
428
|
expect(Puppet).not_to receive(:debug)
|
416
|
-
expected_args = ["/bin/rpm", "-q", resource_name, "--nosignature", "--nodigest", "--qf", "
|
429
|
+
expected_args = ["/bin/rpm", "-q", resource_name, "--nosignature", "--nodigest", "--qf", "#{nevra_format}"]
|
417
430
|
expect(Puppet::Util::Execution).to receive(:execute)
|
418
431
|
.with(expected_args, execute_options)
|
419
432
|
.and_raise(Puppet::ExecutionFailure.new("package #{resource_name} is not installed"))
|
@@ -426,7 +439,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
426
439
|
|
427
440
|
it "does not log or fail if allow_virtual is true" do
|
428
441
|
resource[:allow_virtual] = true
|
429
|
-
expected_args = ['/bin/rpm', '-q', resource_name, '--nosignature', '--nodigest', '--qf', "
|
442
|
+
expected_args = ['/bin/rpm', '-q', resource_name, '--nosignature', '--nodigest', '--qf', "#{nevra_format}", '--whatprovides']
|
430
443
|
expect(Puppet::Util::Execution).to receive(:execute)
|
431
444
|
.with(expected_args, execute_options)
|
432
445
|
.and_raise(Puppet::ExecutionFailure.new("package #{resource_name} is not provided"))
|
@@ -436,7 +449,7 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
436
449
|
|
437
450
|
it "parses virtual package" do
|
438
451
|
provider.resource[:allow_virtual] = true
|
439
|
-
expected_args = ["/bin/rpm", "-q", resource_name, "--nosignature", "--nodigest", "--qf", "
|
452
|
+
expected_args = ["/bin/rpm", "-q", resource_name, "--nosignature", "--nodigest", "--qf", "#{nevra_format}"]
|
440
453
|
expect(Puppet::Util::Execution).to receive(:execute)
|
441
454
|
.with(expected_args, execute_options)
|
442
455
|
.and_raise(Puppet::ExecutionFailure.new("package #{resource_name} is not installed"))
|
@@ -749,4 +762,125 @@ describe Puppet::Type.type(:package).provider(:rpm) do
|
|
749
762
|
provider.compare_values('s1', 's2')
|
750
763
|
end
|
751
764
|
end
|
765
|
+
|
766
|
+
|
767
|
+
describe 'insync?' do
|
768
|
+
context 'for multiple versions' do
|
769
|
+
let(:is) { '1:1.2.3.4-5.el4; 1:5.6.7.8-5.el4' }
|
770
|
+
it 'returns true if there is match and feature is enabled' do
|
771
|
+
resource[:install_only] = true
|
772
|
+
resource[:ensure] = '1:1.2.3.4-5.el4'
|
773
|
+
expect(provider).to be_insync(is)
|
774
|
+
end
|
775
|
+
it 'returns false if there is match and feature is not enabled' do
|
776
|
+
resource[:ensure] = '1:1.2.3.4-5.el4'
|
777
|
+
expect(provider).to_not be_insync(is)
|
778
|
+
end
|
779
|
+
it 'returns false if no match and feature is enabled' do
|
780
|
+
resource[:install_only] = true
|
781
|
+
resource[:ensure] = '1:1.2.3.6-5.el4'
|
782
|
+
expect(provider).to_not be_insync(is)
|
783
|
+
end
|
784
|
+
it 'returns false if no match and feature is not enabled' do
|
785
|
+
resource[:ensure] = '1:1.2.3.6-5.el4'
|
786
|
+
expect(provider).to_not be_insync(is)
|
787
|
+
end
|
788
|
+
end
|
789
|
+
context 'for simple versions' do
|
790
|
+
let(:is) { '1:1.2.3.4-5.el4' }
|
791
|
+
it 'returns true if there is match and feature is enabled' do
|
792
|
+
resource[:install_only] = true
|
793
|
+
resource[:ensure] = '1:1.2.3.4-5.el4'
|
794
|
+
expect(provider).to be_insync(is)
|
795
|
+
end
|
796
|
+
it 'returns true if there is match and feature is not enabled' do
|
797
|
+
resource[:ensure] = '1:1.2.3.4-5.el4'
|
798
|
+
expect(provider).to be_insync(is)
|
799
|
+
end
|
800
|
+
it 'returns false if no match and feature is enabled' do
|
801
|
+
resource[:install_only] = true
|
802
|
+
resource[:ensure] = '1:1.2.3.6-5.el4'
|
803
|
+
expect(provider).to_not be_insync(is)
|
804
|
+
end
|
805
|
+
it 'returns false if no match and feature is not enabled' do
|
806
|
+
resource[:ensure] = '1:1.2.3.6-5.el4'
|
807
|
+
expect(provider).to_not be_insync(is)
|
808
|
+
end
|
809
|
+
end
|
810
|
+
end
|
811
|
+
|
812
|
+
describe 'rpm multiversion to hash' do
|
813
|
+
it 'should return empty hash for empty imput' do
|
814
|
+
package_hash = described_class.nevra_to_multiversion_hash('')
|
815
|
+
expect(package_hash).to eq({})
|
816
|
+
end
|
817
|
+
|
818
|
+
it 'should return package hash for one package input' do
|
819
|
+
package_list = <<-RPM_OUTPUT
|
820
|
+
kernel-devel 1 1.2.3.4 5.el4 x86_64
|
821
|
+
RPM_OUTPUT
|
822
|
+
package_hash = described_class.nevra_to_multiversion_hash(package_list)
|
823
|
+
expect(package_hash).to eq(
|
824
|
+
{
|
825
|
+
:arch => "x86_64",
|
826
|
+
:ensure => "1:1.2.3.4-5.el4",
|
827
|
+
:epoch => "1",
|
828
|
+
:name => "kernel-devel",
|
829
|
+
:provider => :rpm,
|
830
|
+
:release => "5.el4",
|
831
|
+
:version => "1.2.3.4",
|
832
|
+
}
|
833
|
+
)
|
834
|
+
end
|
835
|
+
|
836
|
+
it 'should return package hash with versions concatenated in ensure for two package input' do
|
837
|
+
package_list = <<-RPM_OUTPUT
|
838
|
+
kernel-devel 1 1.2.3.4 5.el4 x86_64
|
839
|
+
kernel-devel 1 5.6.7.8 5.el4 x86_64
|
840
|
+
RPM_OUTPUT
|
841
|
+
package_hash = described_class.nevra_to_multiversion_hash(package_list)
|
842
|
+
expect(package_hash).to eq(
|
843
|
+
{
|
844
|
+
:arch => "x86_64",
|
845
|
+
:ensure => "1:1.2.3.4-5.el4; 1:5.6.7.8-5.el4",
|
846
|
+
:epoch => "1",
|
847
|
+
:name => "kernel-devel",
|
848
|
+
:provider => :rpm,
|
849
|
+
:release => "5.el4",
|
850
|
+
:version => "1.2.3.4",
|
851
|
+
}
|
852
|
+
)
|
853
|
+
end
|
854
|
+
|
855
|
+
it 'should return list of packages for one multiversion and one package input' do
|
856
|
+
package_list = <<-RPM_OUTPUT
|
857
|
+
kernel-devel 1 1.2.3.4 5.el4 x86_64
|
858
|
+
kernel-devel 1 5.6.7.8 5.el4 x86_64
|
859
|
+
basesystem 0 8.0 5.1.1.el5.centos noarch
|
860
|
+
RPM_OUTPUT
|
861
|
+
package_hash = described_class.nevra_to_multiversion_hash(package_list)
|
862
|
+
expect(package_hash).to eq(
|
863
|
+
[
|
864
|
+
{
|
865
|
+
:arch => "x86_64",
|
866
|
+
:ensure => "1:1.2.3.4-5.el4; 1:5.6.7.8-5.el4",
|
867
|
+
:epoch => "1",
|
868
|
+
:name => "kernel-devel",
|
869
|
+
:provider => :rpm,
|
870
|
+
:release => "5.el4",
|
871
|
+
:version => "1.2.3.4",
|
872
|
+
},
|
873
|
+
{
|
874
|
+
:provider => :rpm,
|
875
|
+
:name => "basesystem",
|
876
|
+
:epoch => "0",
|
877
|
+
:version => "8.0",
|
878
|
+
:release => "5.1.1.el5.centos",
|
879
|
+
:arch => "noarch",
|
880
|
+
:ensure => "8.0-5.1.1.el5.centos",
|
881
|
+
}
|
882
|
+
]
|
883
|
+
)
|
884
|
+
end
|
885
|
+
end
|
752
886
|
end
|
@@ -23,6 +23,13 @@ describe Puppet::Type.type(:package).provider(:yum) do
|
|
23
23
|
|
24
24
|
before { allow(described_class).to receive(:command).with(:cmd).and_return("/usr/bin/yum") }
|
25
25
|
|
26
|
+
describe 'provider features' do
|
27
|
+
it { is_expected.to be_versionable }
|
28
|
+
it { is_expected.to be_install_options }
|
29
|
+
it { is_expected.to be_virtual_packages }
|
30
|
+
it { is_expected.to be_install_only }
|
31
|
+
end
|
32
|
+
|
26
33
|
context "when installing" do
|
27
34
|
it "should use the supplied source as the explicit path to a package to install" do
|
28
35
|
resource[:ensure] = :present
|
@@ -47,6 +54,56 @@ describe Puppet::Type.type(:package).provider(:yum) do
|
|
47
54
|
provider.install
|
48
55
|
end
|
49
56
|
end
|
57
|
+
|
58
|
+
describe 'with install_options' do
|
59
|
+
it 'can parse disable-repo with array of strings' do
|
60
|
+
resource[:install_options] = ['--disable-repo=dev*', '--disable-repo=prod*']
|
61
|
+
expect(provider).to receive(:execute) do | arr|
|
62
|
+
expect(arr[-3]).to eq(["--disable-repo=dev*", "--disable-repo=prod*"])
|
63
|
+
end
|
64
|
+
provider.install
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'can parse disable-repo with array of hashes' do
|
68
|
+
resource[:install_options] = [{'--disable-repo' => 'dev*'}, {'--disable-repo' => 'prod*'}]
|
69
|
+
expect(provider).to receive(:execute) do | arr|
|
70
|
+
expect(arr[-3]).to eq(["--disable-repo=dev*", "--disable-repo=prod*"])
|
71
|
+
end
|
72
|
+
provider.install
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'can parse enable-repo with array of strings' do
|
76
|
+
resource[:install_options] = ['--enable-repo=dev*', '--enable-repo=prod*']
|
77
|
+
expect(provider).to receive(:execute) do | arr|
|
78
|
+
expect(arr[-3]).to eq(["--enable-repo=dev*", "--enable-repo=prod*"])
|
79
|
+
end
|
80
|
+
provider.install
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'can parse enable-repo with array of hashes' do
|
84
|
+
resource[:install_options] = [{'--enable-repo' => 'dev*'}, {'--disable-repo' => 'prod*'}]
|
85
|
+
expect(provider).to receive(:execute) do | arr|
|
86
|
+
expect(arr[-3]).to eq(["--enable-repo=dev*", "--disable-repo=prod*"])
|
87
|
+
end
|
88
|
+
provider.install
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'can parse enable-repo with single hash' do
|
92
|
+
resource[:install_options] = [{'--enable-repo' => 'dev*','--disable-repo' => 'prod*'}]
|
93
|
+
expect(provider).to receive(:execute) do | arr|
|
94
|
+
expect(arr[-3]).to eq(["--disable-repo=prod*", "--enable-repo=dev*"])
|
95
|
+
end
|
96
|
+
provider.install
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'can parse enable-repo with empty array' do
|
100
|
+
resource[:install_options] = []
|
101
|
+
expect(provider).to receive(:execute) do | arr|
|
102
|
+
expect(arr[-3]).to eq([])
|
103
|
+
end
|
104
|
+
provider.install
|
105
|
+
end
|
106
|
+
end
|
50
107
|
end
|
51
108
|
|
52
109
|
context "parsing the output of check-update" do
|
@@ -137,5 +194,14 @@ describe Puppet::Type.type(:package).provider(:yum) do
|
|
137
194
|
expect(output).not_to include("Random plugin")
|
138
195
|
end
|
139
196
|
end
|
197
|
+
|
198
|
+
context "with subscription manager enabled " do
|
199
|
+
let(:check_update) { File.read(my_fixture("yum-check-update-subscription-manager.txt")) }
|
200
|
+
let(:output) { described_class.parse_updates(check_update) }
|
201
|
+
|
202
|
+
it "parses correctly formatted entries" do
|
203
|
+
expect(output['curl.x86_64']).to eq([{:name => 'curl', :epoch => '0', :version => '7.32.0', :release => '10.fc20', :arch => 'x86_64'}])
|
204
|
+
end
|
205
|
+
end
|
140
206
|
end
|
141
207
|
end
|
@@ -176,6 +176,19 @@ describe Puppet::Type.type(:package).provider(:zypper) do
|
|
176
176
|
@provider.install
|
177
177
|
end
|
178
178
|
|
179
|
+
it "should install the package with --no-gpg-checks" do
|
180
|
+
allow(@resource).to receive(:[]).with(:name).and_return("php5")
|
181
|
+
allow(@resource).to receive(:[]).with(:install_options).and_return(['--no-gpg-checks', {'-p' => '/vagrant/files/localrepo/'}])
|
182
|
+
allow(@resource).to receive(:should).with(:ensure).and_return("5.4.10-4.5.6")
|
183
|
+
allow(@resource).to receive(:allow_virtual?).and_return(false)
|
184
|
+
allow(@provider).to receive(:zypper_version).and_return("1.2.8")
|
185
|
+
|
186
|
+
expect(@provider).to receive(:zypper).with('--quiet', '--no-gpg-checks', :install,
|
187
|
+
'--auto-agree-with-licenses', '--no-confirm', '-p=/vagrant/files/localrepo/', 'php5-5.4.10-4.5.6')
|
188
|
+
expect(@provider).to receive(:query).and_return("php5 0 5.4.10 4.5.6 x86_64")
|
189
|
+
@provider.install
|
190
|
+
end
|
191
|
+
|
179
192
|
it "should install package with hash install options" do
|
180
193
|
allow(@resource).to receive(:[]).with(:name).and_return('vim')
|
181
194
|
allow(@resource).to receive(:[]).with(:install_options).and_return([{ '--a' => 'foo', '--b' => '"quoted bar"' }])
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'puppet'
|
3
|
+
require 'puppet/provider/package_targetable'
|
4
|
+
require 'puppet/provider/package/gem'
|
5
|
+
|
6
|
+
describe Puppet::Provider::Package::Targetable do
|
7
|
+
let(:provider) { Puppet::Type.type(:package).provider(:gem) }
|
8
|
+
let(:command) { '/opt/bin/gem' }
|
9
|
+
|
10
|
+
describe "when prefetching" do
|
11
|
+
context "with a package without a command attribute" do
|
12
|
+
let(:resource) { Puppet::Type.type(:package).new(:name => 'noo', :provider => 'gem', :ensure => :present) }
|
13
|
+
let(:catalog) { Puppet::Resource::Catalog.new }
|
14
|
+
let(:instance) { provider.new(resource) }
|
15
|
+
let(:packages) { { 'noo' => resource } }
|
16
|
+
|
17
|
+
it "should pass a command to the instances method of the provider" do
|
18
|
+
catalog.add_resource(resource)
|
19
|
+
expect(provider).to receive(:instances).with(nil).and_return([instance])
|
20
|
+
expect(provider.prefetch(packages)).to eq([nil]) # prefetch arbitrarily returns the array of commands for a provider in the catalog
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "with a package with a command attribute" do
|
25
|
+
let(:resource) { Puppet::Type.type(:package).new(:name => 'noo', :provider => 'gem', :ensure => :present) }
|
26
|
+
let(:resource_targeted) { Puppet::Type.type(:package).new(:name => 'yes', :provider => 'gem', :command => command, :ensure => :present) }
|
27
|
+
let(:catalog) { Puppet::Resource::Catalog.new }
|
28
|
+
let(:instance) { provider.new(resource) }
|
29
|
+
let(:instance_targeted) { provider.new(resource_targeted) }
|
30
|
+
let(:packages) { { 'noo' => resource, 'yes' => resource_targeted } }
|
31
|
+
|
32
|
+
it "should pass the command to the instances method of the provider" do
|
33
|
+
catalog.add_resource(resource)
|
34
|
+
catalog.add_resource(resource_targeted)
|
35
|
+
expect(provider).to receive(:instances).with(nil).and_return([instance])
|
36
|
+
expect(provider).to receive(:instances).with(command).and_return([instance_targeted]).once
|
37
|
+
expect(provider.prefetch(packages)).to eq([nil, command]) # prefetch arbitrarily returns the array of commands for a provider in the catalog
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "when validating a command" do
|
43
|
+
context "with no command" do
|
44
|
+
it "report not functional" do
|
45
|
+
expect { provider.validate_command(nil) }.to raise_error(Puppet::Error, "Provider gem package command is not functional on this host")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
context "with a missing command" do
|
49
|
+
it "report does not exist" do
|
50
|
+
expect { provider.validate_command(command) }.to raise_error(Puppet::Error, "Provider gem package command '#{command}' does not exist on this host")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
context "with an existing command" do
|
54
|
+
it "validates" do
|
55
|
+
allow(File).to receive(:file?).with(command).and_return(true)
|
56
|
+
expect { provider.validate_command(command) }.not_to raise_error
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|