puppet 5.5.16-x64-mingw32 → 5.5.21-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -47,7 +47,7 @@ describe Puppet::Type.type(:group).provider(:groupadd) do
|
|
47
47
|
described_class.has_feature(:libuser)
|
48
48
|
resource[:forcelocal] = :true
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
it "should use lgroupadd instead of groupadd" do
|
52
52
|
expect(provider).to receive(:execute).with(including('/usr/sbin/lgroupadd'), hash_including(:custom_environment => hash_including('LIBUSER_CONF')))
|
53
53
|
provider.create
|
@@ -124,6 +124,35 @@ describe Puppet::Type.type(:group).provider(:groupadd) do
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
+
describe "#findgroup" do
|
128
|
+
before { allow(File).to receive(:read).with('/etc/group').and_return(content) }
|
129
|
+
|
130
|
+
let(:content) { "sample_group_name:sample_password:sample_gid:sample_user_list" }
|
131
|
+
let(:output) do
|
132
|
+
{
|
133
|
+
group_name: 'sample_group_name',
|
134
|
+
password: 'sample_password',
|
135
|
+
gid: 'sample_gid',
|
136
|
+
user_list: 'sample_user_list',
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
140
|
+
[:group_name, :password, :gid, :user_list].each do |key|
|
141
|
+
it "finds a group by #{key} when asked" do
|
142
|
+
expect(provider.send(:findgroup, key, "sample_#{key}")).to eq(output)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
it "returns false when specified key/value pair is not found" do
|
147
|
+
expect(provider.send(:findgroup, :group_name, 'invalid_group_name')).to eq(false)
|
148
|
+
end
|
149
|
+
|
150
|
+
it "reads the group file only once per resource" do
|
151
|
+
expect(File).to receive(:read).with('/etc/group').once
|
152
|
+
5.times { provider.send(:findgroup, :group_name, 'sample_group_name') }
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
127
156
|
describe "#delete" do
|
128
157
|
before do
|
129
158
|
allow(provider).to receive(:exists?).and_return(true)
|
@@ -33,13 +33,18 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
33
33
|
let(:user1) { double(:account => 'user1', :domain => '.', :sid => 'user1sid') }
|
34
34
|
let(:user2) { double(:account => 'user2', :domain => '.', :sid => 'user2sid') }
|
35
35
|
let(:user3) { double(:account => 'user3', :domain => '.', :sid => 'user3sid') }
|
36
|
+
let(:user_without_domain) { double(:account => 'user_without_domain', :domain => nil, :sid => 'user_without_domain_sid') }
|
37
|
+
|
36
38
|
let(:invalid_user) { SecureRandom.uuid }
|
39
|
+
let(:invalid_user_principal) { double(:account => "#{invalid_user}", :domain => nil, :sid => "#{invalid_user}") }
|
37
40
|
|
38
41
|
before :each do
|
39
|
-
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user1').and_return(user1)
|
40
|
-
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user2').and_return(user2)
|
41
|
-
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user3').and_return(user3)
|
42
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user1', any_args).and_return(user1)
|
43
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user2', any_args).and_return(user2)
|
44
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user3', any_args).and_return(user3)
|
45
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user_without_domain', any_args).and_return(user_without_domain)
|
42
46
|
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with(invalid_user).and_return(nil)
|
47
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with(invalid_user, true).and_return(invalid_user_principal)
|
43
48
|
end
|
44
49
|
|
45
50
|
describe "#members_insync?" do
|
@@ -199,7 +204,15 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
199
204
|
]
|
200
205
|
expect(provider.members_insync?(current, ['user2','user1'])).to be_truthy
|
201
206
|
end
|
207
|
+
|
208
|
+
it "should return true even if a current user is unresolvable if should is included" do
|
209
|
+
current = [
|
210
|
+
"#{invalid_user}",
|
211
|
+
'user2',
|
212
|
+
]
|
213
|
+
expect(provider.members_insync?(current, ['user2'])).to be_truthy
|
202
214
|
end
|
215
|
+
end
|
203
216
|
end
|
204
217
|
|
205
218
|
describe "#members_to_s" do
|
@@ -222,8 +235,8 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
222
235
|
expect(provider.members_to_s(['user1', 'user2'])).to eq('.\user1,.\user2')
|
223
236
|
end
|
224
237
|
|
225
|
-
it "should return
|
226
|
-
expect(provider.members_to_s([
|
238
|
+
it "should return a user string without domain if domain is not set" do
|
239
|
+
expect(provider.members_to_s(['user_without_domain'])).to eq('user_without_domain')
|
227
240
|
end
|
228
241
|
|
229
242
|
it "should return the username when it cannot be resolved to a SID (for the sake of resource_harness error messages)" do
|
@@ -237,10 +250,14 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
237
250
|
let(:user2) { double(:account => 'user2', :domain => '.', :sid => 'user2sid') }
|
238
251
|
let(:user3) { double(:account => 'user3', :domain => '.', :sid => 'user3sid') }
|
239
252
|
|
253
|
+
let(:invalid_user) { SecureRandom.uuid }
|
254
|
+
let(:invalid_user_principal) { double(:account => "#{invalid_user}", :domain => nil, :sid => "#{invalid_user}") }
|
255
|
+
|
240
256
|
before :each do
|
241
|
-
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user1').and_return(user1)
|
242
|
-
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user2').and_return(user2)
|
243
|
-
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user3').and_return(user3)
|
257
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user1', any_args).and_return(user1)
|
258
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user2', any_args).and_return(user2)
|
259
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user3', any_args).and_return(user3)
|
260
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with(invalid_user, true).and_return(invalid_user_principal)
|
244
261
|
|
245
262
|
resource[:auth_membership] = true
|
246
263
|
end
|
@@ -261,6 +278,22 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
261
278
|
expect(provider.members).to match_array(expected_members)
|
262
279
|
end
|
263
280
|
|
281
|
+
it "should be able to handle unresolvable SID in list of members" do
|
282
|
+
allow(provider.group).to receive(:members).and_return([
|
283
|
+
'user1',
|
284
|
+
"#{invalid_user}",
|
285
|
+
'user3',
|
286
|
+
])
|
287
|
+
|
288
|
+
expected_member_sids = [user1.sid, invalid_user_principal.sid, user3.sid]
|
289
|
+
expected_members = ['user1', "#{invalid_user}", 'user3']
|
290
|
+
allow(provider).to receive(:members_to_s)
|
291
|
+
.with(expected_member_sids)
|
292
|
+
.and_return(expected_members.join(','))
|
293
|
+
|
294
|
+
expect(provider.members).to match_array(expected_members)
|
295
|
+
end
|
296
|
+
|
264
297
|
it "should be able to set group members" do
|
265
298
|
allow(provider.group).to receive(:members).and_return(['user1', 'user2'])
|
266
299
|
|
@@ -272,8 +305,8 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
272
305
|
|
273
306
|
allow(provider.group).to receive(:member_sids).and_return(member_sids[0..1])
|
274
307
|
|
275
|
-
expect(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user2').and_return(member_sids[1])
|
276
|
-
expect(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user3').and_return(member_sids[2])
|
308
|
+
expect(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user2', any_args).and_return(member_sids[1])
|
309
|
+
expect(Puppet::Util::Windows::SID).to receive(:name_to_principal).with('user3', any_args).and_return(member_sids[2])
|
277
310
|
|
278
311
|
expect(provider.group).to receive(:remove_member_sids).with(member_sids[0])
|
279
312
|
expect(provider.group).to receive(:add_member_sids).with(member_sids[2])
|
@@ -22,16 +22,26 @@ describe Puppet::Type.type(:package).provider(:aix) do
|
|
22
22
|
|
23
23
|
context "when installing" do
|
24
24
|
it "should install a package" do
|
25
|
+
allow(@provider).to receive(:query).and_return({:name => 'mypackage', :ensure => 'present', :status => :committed})
|
25
26
|
expect(@provider).to receive(:installp).with('-acgwXY', '-d', 'mysource', 'mypackage')
|
26
27
|
@provider.install
|
27
28
|
end
|
28
29
|
|
29
30
|
it "should install a specific package version" do
|
30
31
|
allow(@resource).to receive(:should).with(:ensure).and_return("1.2.3.4")
|
32
|
+
allow(@provider).to receive(:query).and_return({:name => 'mypackage', :ensure => '1.2.3.4', :status => :committed})
|
31
33
|
expect(@provider).to receive(:installp).with('-acgwXY', '-d', 'mysource', 'mypackage 1.2.3.4')
|
32
34
|
@provider.install
|
33
35
|
end
|
34
36
|
|
37
|
+
[:broken, :inconsistent].each do |state|
|
38
|
+
it "should fail if the installation resulted in a '#{state}' state" do
|
39
|
+
allow(@provider).to receive(:query).and_return({:name => 'mypackage', :ensure => 'present', :status => state})
|
40
|
+
expect(@provider).to receive(:installp).with('-acgwXY', '-d', 'mysource', 'mypackage')
|
41
|
+
expect { @provider.install }.to raise_error(Puppet::Error, "Package 'mypackage' is in a #{state} state and requires manual intervention")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
35
45
|
it "should fail if the specified version is superseded" do
|
36
46
|
@resource[:ensure] = '1.2.3.3'
|
37
47
|
allow(@provider).to receive(:installp).and_return(<<-OUTPUT)
|
@@ -126,4 +136,23 @@ END
|
|
126
136
|
expect(described_class).to receive(:execute).and_return('mypackage:mypackage.rte:1.8.6.4::I:T:::::N:A Super Cool Package::::0::\n')
|
127
137
|
described_class.prefetch({ 'mypackage' => latest, 'otherpackage' => absent })
|
128
138
|
end
|
139
|
+
|
140
|
+
context "when querying instances" do
|
141
|
+
before(:each) do
|
142
|
+
allow(described_class).to receive(:execute).and_return(<<-END.chomp)
|
143
|
+
sysmgt.cim.providers:sysmgt.cim.providers.metrics:2.12.1.1: : :B: :Metrics Providers for AIX OS: : : : : : :1:0:/:
|
144
|
+
sysmgt.cim.providers:sysmgt.cim.providers.osbase:2.12.1.1: : :C: :Base Providers for AIX OS: : : : : : :1:0:/:
|
145
|
+
openssl.base:openssl.base:1.0.2.1800: : :?: :Open Secure Socket Layer: : : : : : :0:0:/:
|
146
|
+
END
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should treat installed packages in broken and inconsistent state as absent" do
|
150
|
+
installed_packages = described_class.instances.map { |package| package.properties }
|
151
|
+
expected_packages = [{:name => 'sysmgt.cim.providers.metrics', :ensure => :absent, :status => :broken, :provider => :aix},
|
152
|
+
{:name => 'sysmgt.cim.providers.osbase', :ensure => '2.12.1.1', :status => :committed, :provider => :aix},
|
153
|
+
{:name => 'openssl.base', :ensure => :absent, :status => :inconsistent, :provider => :aix}]
|
154
|
+
|
155
|
+
expect(installed_packages).to eql(expected_packages)
|
156
|
+
end
|
157
|
+
end
|
129
158
|
end
|
@@ -32,12 +32,14 @@ describe Puppet::Type.type(:package).provider(:apt) do
|
|
32
32
|
|
33
33
|
it "should use 'apt-get remove' to uninstall" do
|
34
34
|
expect(provider).to receive(:aptget).with("-y", "-q", :remove, name)
|
35
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
35
36
|
provider.uninstall
|
36
37
|
end
|
37
38
|
|
38
39
|
it "should use 'apt-get purge' and 'dpkg purge' to purge" do
|
39
40
|
expect(provider).to receive(:aptget).with("-y", "-q", :remove, "--purge", name)
|
40
41
|
expect(provider).to receive(:dpkg).with("--purge", name)
|
42
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
41
43
|
provider.purge
|
42
44
|
end
|
43
45
|
|
@@ -88,14 +90,14 @@ Version table:
|
|
88
90
|
it "should preseed if a responsefile is provided" do
|
89
91
|
resource[:responsefile] = "/my/file"
|
90
92
|
expect(provider).to receive(:run_preseed)
|
91
|
-
|
93
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
92
94
|
allow(provider).to receive(:aptget)
|
93
95
|
provider.install
|
94
96
|
end
|
95
97
|
|
96
98
|
it "should check for a cdrom" do
|
97
99
|
expect(provider).to receive(:checkforcdrom)
|
98
|
-
|
100
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
99
101
|
allow(provider).to receive(:aptget)
|
100
102
|
provider.install
|
101
103
|
end
|
@@ -106,6 +108,7 @@ Version table:
|
|
106
108
|
expect(command[-1]).to eq(name)
|
107
109
|
expect(command[-2]).to eq(:install)
|
108
110
|
end
|
111
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
109
112
|
|
110
113
|
provider.install
|
111
114
|
end
|
@@ -115,6 +118,7 @@ Version table:
|
|
115
118
|
expect(provider).to receive(:aptget) do |*command|
|
116
119
|
expect(command[-1]).to eq("#{name}=1.0")
|
117
120
|
end
|
121
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
118
122
|
|
119
123
|
provider.install
|
120
124
|
end
|
@@ -124,6 +128,7 @@ Version table:
|
|
124
128
|
expect(provider).to receive(:aptget) do |*command|
|
125
129
|
expect(command).to include("--force-yes")
|
126
130
|
end
|
131
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
127
132
|
|
128
133
|
provider.install
|
129
134
|
end
|
@@ -132,6 +137,7 @@ Version table:
|
|
132
137
|
expect(provider).to receive(:aptget) do |*command|
|
133
138
|
expect(command).to include("-q")
|
134
139
|
end
|
140
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
135
141
|
|
136
142
|
provider.install
|
137
143
|
end
|
@@ -140,6 +146,7 @@ Version table:
|
|
140
146
|
expect(provider).to receive(:aptget) do |*command|
|
141
147
|
expect(command).to include("-y")
|
142
148
|
end
|
149
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
143
150
|
|
144
151
|
provider.install
|
145
152
|
end
|
@@ -149,6 +156,7 @@ Version table:
|
|
149
156
|
expect(provider).to receive(:aptget) do |*command|
|
150
157
|
expect(command).to include("DPkg::Options::=--force-confold")
|
151
158
|
end
|
159
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
152
160
|
|
153
161
|
provider.install
|
154
162
|
end
|
@@ -158,6 +166,7 @@ Version table:
|
|
158
166
|
expect(provider).to receive(:aptget) do |*command|
|
159
167
|
expect(command).to include("DPkg::Options::=--force-confnew")
|
160
168
|
end
|
169
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
161
170
|
|
162
171
|
provider.install
|
163
172
|
end
|
@@ -165,6 +174,7 @@ Version table:
|
|
165
174
|
it 'should support string install options' do
|
166
175
|
resource[:install_options] = ['--foo', '--bar']
|
167
176
|
expect(provider).to receive(:aptget).with('-q', '-y', '-o', 'DPkg::Options::=--force-confold', '--foo', '--bar', :install, name)
|
177
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
168
178
|
|
169
179
|
provider.install
|
170
180
|
end
|
@@ -172,6 +182,7 @@ Version table:
|
|
172
182
|
it 'should support hash install options' do
|
173
183
|
resource[:install_options] = ['--foo', { '--bar' => 'baz', '--baz' => 'foo' }]
|
174
184
|
expect(provider).to receive(:aptget).with('-q', '-y', '-o', 'DPkg::Options::=--force-confold', '--foo', '--bar=baz', '--baz=foo', :install, name)
|
185
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
175
186
|
|
176
187
|
provider.install
|
177
188
|
end
|
@@ -33,6 +33,7 @@ describe Puppet::Type.type(:package).provider(:aptitude) do
|
|
33
33
|
expect(pkg.provider).to receive(:aptitude).
|
34
34
|
with('-y', '-o', 'DPkg::Options::=--force-confold', :install, 'faff').
|
35
35
|
and_return(0)
|
36
|
+
expect(pkg.provider).to receive(:properties).and_return({:mark => :none})
|
36
37
|
|
37
38
|
pkg.provider.install
|
38
39
|
end
|
@@ -16,7 +16,7 @@ describe Puppet::Type.type(:package).provider(:aptrpm) do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def rpm_args
|
19
|
-
['-q', 'faff', '--nosignature', '--nodigest', '--qf', "
|
19
|
+
['-q', 'faff', '--nosignature', '--nodigest', '--qf', "%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\\n"]
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should report purged packages" do
|
@@ -37,5 +37,12 @@ describe Puppet::Type.type(:package).provider(:dnf) do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
describe 'provider features' do
|
41
|
+
it { is_expected.to be_versionable }
|
42
|
+
it { is_expected.to be_install_options }
|
43
|
+
it { is_expected.to be_virtual_packages }
|
44
|
+
it { is_expected.to be_install_only }
|
45
|
+
end
|
46
|
+
|
40
47
|
it_behaves_like 'RHEL package provider', described_class, 'dnf'
|
41
48
|
end
|
@@ -0,0 +1,247 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Puppet::Type.type(:package).provider(:dnfmodule) do
|
4
|
+
include PuppetSpec::Fixtures
|
5
|
+
|
6
|
+
let(:dnf_version) do
|
7
|
+
<<-DNF_OUTPUT
|
8
|
+
4.0.9
|
9
|
+
Installed: dnf-0:4.0.9.2-5.el8.noarch at Wed 29 May 2019 07:05:05 AM GMT
|
10
|
+
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Thu 14 Feb 2019 12:04:07 PM GMT
|
11
|
+
|
12
|
+
Installed: rpm-0:4.14.2-9.el8.x86_64 at Wed 29 May 2019 07:04:33 AM GMT
|
13
|
+
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Thu 20 Dec 2018 01:30:03 PM GMT
|
14
|
+
DNF_OUTPUT
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:execute_options) do
|
18
|
+
{:failonfail => true, :combine => true, :custom_environment => {}}
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:packages) { File.read(my_fixture("dnf-module-list.txt")) }
|
22
|
+
let(:dnf_path) { '/usr/bin/dnf' }
|
23
|
+
|
24
|
+
before(:each) { allow(Puppet::Util).to receive(:which).with('/usr/bin/dnf').and_return(dnf_path) }
|
25
|
+
|
26
|
+
it "should have lower specificity" do
|
27
|
+
allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat)
|
28
|
+
allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat)
|
29
|
+
allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('8')
|
30
|
+
expect(described_class.specificity).to be < 200
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "should be an opt-in provider" do
|
34
|
+
Array(4..8).each do |ver|
|
35
|
+
it "should not be default for redhat #{ver}" do
|
36
|
+
allow(Facter).to receive(:value).with(:operatingsystem).and_return('redhat')
|
37
|
+
allow(Facter).to receive(:value).with(:osfamily).and_return('redhat')
|
38
|
+
allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(ver.to_s)
|
39
|
+
expect(described_class).not_to be_default
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "handling dnf versions" do
|
45
|
+
before(:each) do
|
46
|
+
expect(Puppet::Type::Package::ProviderDnfmodule).to receive(:execute)
|
47
|
+
.with(["/usr/bin/dnf", "--version"])
|
48
|
+
.and_return(dnf_version).at_most(:once)
|
49
|
+
expect(Puppet::Util::Execution).to receive(:execute)
|
50
|
+
.with(["/usr/bin/dnf", "--version"], execute_options)
|
51
|
+
.and_return(Puppet::Util::Execution::ProcessOutput.new(dnf_version, 0))
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "with a supported dnf version" do
|
55
|
+
it "correctly parses the version" do
|
56
|
+
expect(described_class.current_version).to eq('4.0.9')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "with an unsupported dnf version" do
|
61
|
+
let(:dnf_version) do
|
62
|
+
<<-DNF_OUTPUT
|
63
|
+
2.7.5
|
64
|
+
Installed: dnf-0:2.7.5-12.fc28.noarch at Mon 13 Aug 2018 11:05:27 PM GMT
|
65
|
+
Built : Fedora Project at Wed 18 Apr 2018 02:29:51 PM GMT
|
66
|
+
|
67
|
+
Installed: rpm-0:4.14.1-7.fc28.x86_64 at Mon 13 Aug 2018 11:05:25 PM GMT
|
68
|
+
Built : Fedora Project at Mon 19 Feb 2018 09:29:01 AM GMT
|
69
|
+
DNF_OUTPUT
|
70
|
+
end
|
71
|
+
|
72
|
+
before(:each) { described_class.instance_variable_set("@current_version", nil) }
|
73
|
+
|
74
|
+
it "correctly parses the version" do
|
75
|
+
expect(described_class.current_version).to eq('2.7.5')
|
76
|
+
end
|
77
|
+
|
78
|
+
it "raises an error when attempting prefetch" do
|
79
|
+
expect { described_class.prefetch('anything') }.to raise_error(Puppet::Error, "Modules are not supported on DNF versions lower than 3.0.1")
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe "when ensuring a module" do
|
85
|
+
let(:name) { 'baz' }
|
86
|
+
|
87
|
+
let(:resource) do
|
88
|
+
Puppet::Type.type(:package).new(
|
89
|
+
:name => name,
|
90
|
+
:provider => 'dnfmodule',
|
91
|
+
)
|
92
|
+
end
|
93
|
+
|
94
|
+
let(:provider) do
|
95
|
+
provider = described_class.new
|
96
|
+
provider.resource = resource
|
97
|
+
provider
|
98
|
+
end
|
99
|
+
|
100
|
+
describe 'provider features' do
|
101
|
+
it { is_expected.to be_versionable }
|
102
|
+
it { is_expected.to be_installable }
|
103
|
+
it { is_expected.to be_uninstallable }
|
104
|
+
end
|
105
|
+
|
106
|
+
context "when installing a new module" do
|
107
|
+
before do
|
108
|
+
provider.instance_variable_get('@property_hash')[:ensure] = :absent
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should not reset the module stream when package is absent" do
|
112
|
+
resource[:ensure] = :present
|
113
|
+
expect(provider).not_to receive(:uninstall)
|
114
|
+
expect(provider).to receive(:execute)
|
115
|
+
provider.install
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should not reset the module stream when package is purged" do
|
119
|
+
provider.instance_variable_get('@property_hash')[:ensure] = :purged
|
120
|
+
resource[:ensure] = :present
|
121
|
+
expect(provider).not_to receive(:uninstall)
|
122
|
+
expect(provider).to receive(:execute)
|
123
|
+
provider.install
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should just enable the module if it has no default profile" do
|
127
|
+
dnf_exception = Puppet::ExecutionFailure.new("Error: Problems in request:\nmissing groups or modules: #{resource[:name]}")
|
128
|
+
allow(provider).to receive(:execute).with(array_including('install')).and_raise(dnf_exception)
|
129
|
+
resource[:ensure] = :present
|
130
|
+
expect(provider).to receive(:execute).with(array_including('install')).ordered
|
131
|
+
expect(provider).to receive(:execute).with(array_including('enable')).ordered
|
132
|
+
provider.install
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should just enable the module if enable_only = true" do
|
136
|
+
resource[:ensure] = :present
|
137
|
+
resource[:enable_only] = true
|
138
|
+
expect(provider).to receive(:execute).with(array_including('enable'))
|
139
|
+
expect(provider).not_to receive(:execute).with(array_including('install'))
|
140
|
+
provider.install
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should install the default stream and flavor" do
|
144
|
+
resource[:ensure] = :present
|
145
|
+
expect(provider).to receive(:execute).with(array_including('baz'))
|
146
|
+
provider.install
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should install a specific stream" do
|
150
|
+
resource[:ensure] = '9.6'
|
151
|
+
expect(provider).to receive(:execute).with(array_including('baz:9.6'))
|
152
|
+
provider.install
|
153
|
+
end
|
154
|
+
|
155
|
+
it "should install a specific flavor" do
|
156
|
+
resource[:ensure] = :present
|
157
|
+
resource[:flavor] = 'minimal'
|
158
|
+
expect(provider).to receive(:execute).with(array_including('baz/minimal'))
|
159
|
+
provider.install
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should install a specific flavor and stream" do
|
163
|
+
resource[:ensure] = '9.6'
|
164
|
+
resource[:flavor] = 'minimal'
|
165
|
+
expect(provider).to receive(:execute).with(array_including('baz:9.6/minimal'))
|
166
|
+
provider.install
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
context "when ensuring a specific version on top of another stream" do
|
171
|
+
before do
|
172
|
+
provider.instance_variable_get('@property_hash')[:ensure] = '9.6'
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should remove existing packages and reset the module stream before installing" do
|
176
|
+
resource[:ensure] = '10'
|
177
|
+
expect(provider).to receive(:execute).thrice.with(array_including(/remove|reset|install/))
|
178
|
+
provider.install
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
context "with an installed flavor" do
|
183
|
+
before do
|
184
|
+
provider.instance_variable_get('@property_hash')[:flavor] = 'minimal'
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should remove existing packages and reset the module stream before installing another flavor" do
|
188
|
+
resource[:flavor] = 'common'
|
189
|
+
expect(provider).to receive(:execute).thrice.with(array_including(/remove|reset|install/))
|
190
|
+
provider.flavor = resource[:flavor]
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should not do anything if the flavor doesn't change" do
|
194
|
+
resource[:flavor] = 'minimal'
|
195
|
+
expect(provider).not_to receive(:execute)
|
196
|
+
provider.flavor = resource[:flavor]
|
197
|
+
end
|
198
|
+
|
199
|
+
it "should return the existing flavor" do
|
200
|
+
expect(provider.flavor).to eq('minimal')
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
context "when disabling a module" do
|
205
|
+
|
206
|
+
it "executed the disable command" do
|
207
|
+
resource[:ensure] = :disabled
|
208
|
+
expect(provider).to receive(:execute).with(array_including('disable'))
|
209
|
+
provider.disable
|
210
|
+
end
|
211
|
+
|
212
|
+
it "does not try to disable if package is already disabled" do
|
213
|
+
allow(described_class).to receive(:command).with(:dnf).and_return(dnf_path)
|
214
|
+
allow(Puppet::Util::Execution).to receive(:execute)
|
215
|
+
.with("/usr/bin/dnf module list -d 0 -e 1")
|
216
|
+
.and_return("baz 1.2 [d][x] common [d], complete Package Description")
|
217
|
+
resource[:ensure] = :disabled
|
218
|
+
expect(provider).to be_insync(:disabled)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
context "parsing the output of module list" do
|
224
|
+
before { allow(described_class).to receive(:command).with(:dnf).and_return(dnf_path) }
|
225
|
+
|
226
|
+
it "returns an array of enabled modules" do
|
227
|
+
allow(Puppet::Util::Execution).to receive(:execute)
|
228
|
+
.with("/usr/bin/dnf module list -d 0 -e 1")
|
229
|
+
.and_return(packages)
|
230
|
+
|
231
|
+
enabled_packages = described_class.instances.map { |package| package.properties }
|
232
|
+
expected_packages = [{name: "389-ds", ensure: "1.4", flavor: :absent, provider: :dnfmodule},
|
233
|
+
{name: "gimp", ensure: "2.8", flavor: "devel", provider: :dnfmodule},
|
234
|
+
{name: "mariadb", ensure: "10.3", flavor: "client", provider: :dnfmodule},
|
235
|
+
{name: "nodejs", ensure: "10", flavor: "minimal", provider: :dnfmodule},
|
236
|
+
{name: "perl", ensure: "5.26", flavor: "minimal", provider: :dnfmodule},
|
237
|
+
{name: "postgresql", ensure: "10", flavor: "server", provider: :dnfmodule},
|
238
|
+
{name: "ruby", ensure: "2.5", flavor: :absent, provider: :dnfmodule},
|
239
|
+
{name: "rust-toolset", ensure: "rhel8", flavor: "common", provider: :dnfmodule},
|
240
|
+
{name: "subversion", ensure: "1.10", flavor: "server", provider: :dnfmodule},
|
241
|
+
{name: "swig", ensure: :disabled, flavor: :absent, provider: :dnfmodule},
|
242
|
+
{name: "virt", ensure: :disabled, flavor: :absent, provider: :dnfmodule}]
|
243
|
+
|
244
|
+
expect(enabled_packages).to eql(expected_packages)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|