puppet 6.4.5-universal-darwin → 6.5.0-universal-darwin
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 +6 -6
- data/Gemfile.lock +46 -52
- data/ext/build_defaults.yaml +0 -1
- data/ext/project_data.yaml +3 -3
- data/ext/regexp_nodes/regexp_nodes.rb +4 -4
- data/ext/solaris/smf/puppet.xml +0 -2
- data/ext/windows/eventlog/Rakefile +32 -0
- data/ext/windows/eventlog/puppetres.dll +0 -0
- data/ext/windows/eventlog/puppetres.mc +18 -0
- data/ext/windows/service/daemon.rb +8 -38
- data/install.rb +24 -6
- data/lib/puppet.rb +3 -1
- data/lib/puppet/application.rb +1 -1
- data/lib/puppet/application/agent.rb +11 -34
- data/lib/puppet/application/apply.rb +6 -6
- data/lib/puppet/application/describe.rb +9 -3
- data/lib/puppet/application/device.rb +4 -14
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/lookup.rb +2 -2
- data/lib/puppet/application/resource.rb +4 -4
- data/lib/puppet/application/script.rb +2 -2
- data/lib/puppet/application/ssl.rb +10 -9
- data/lib/puppet/configurer.rb +30 -86
- data/lib/puppet/configurer/downloader.rb +6 -2
- data/lib/puppet/defaults.rb +50 -44
- data/lib/puppet/error.rb +14 -9
- data/lib/puppet/face/catalog.rb +20 -1
- data/lib/puppet/face/config.rb +48 -10
- data/lib/puppet/face/facts.rb +1 -1
- data/lib/puppet/face/help.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/parser.rb +48 -9
- data/lib/puppet/face/plugin.rb +2 -9
- data/lib/puppet/file_serving/http_metadata.rb +1 -1
- data/lib/puppet/file_system.rb +12 -2
- data/lib/puppet/file_system/file_impl.rb +6 -3
- data/lib/puppet/file_system/memory_file.rb +1 -1
- data/lib/puppet/file_system/posix.rb +2 -3
- data/lib/puppet/forge.rb +3 -3
- data/lib/puppet/functions.rb +2 -1
- data/lib/puppet/functions/camelcase.rb +2 -2
- data/lib/puppet/functions/epp.rb +4 -4
- data/lib/puppet/functions/find_file.rb +9 -9
- data/lib/puppet/functions/inline_epp.rb +5 -5
- data/lib/puppet/functions/regsubst.rb +6 -8
- 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 +3 -4
- data/lib/puppet/indirector/catalog/compiler.rb +5 -11
- data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
- data/lib/puppet/indirector/hiera.rb +0 -2
- data/lib/puppet/indirector/resource/ral.rb +3 -1
- data/lib/puppet/indirector/resource/validator.rb +1 -1
- data/lib/puppet/interface.rb +1 -2
- data/lib/puppet/loaders.rb +1 -0
- data/lib/puppet/metatype/manager.rb +1 -1
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/module/task.rb +4 -20
- 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 +2 -12
- data/lib/puppet/network/http/api/indirected_routes.rb +11 -12
- data/lib/puppet/network/http/connection.rb +12 -10
- data/lib/puppet/network/http/factory.rb +11 -1
- data/lib/puppet/network/http/pool.rb +0 -2
- data/lib/puppet/network/http/site.rb +1 -1
- data/lib/puppet/network/resolver.rb +2 -2
- data/lib/puppet/node/environment.rb +2 -4
- data/lib/puppet/pal/pal_impl.rb +2 -2
- data/lib/puppet/parser/ast.rb +1 -1
- data/lib/puppet/parser/ast/resourceparam.rb +1 -1
- data/lib/puppet/parser/functions.rb +1 -1
- data/lib/puppet/parser/functions/epp.rb +3 -3
- data/lib/puppet/parser/functions/fail.rb +8 -1
- data/lib/puppet/parser/functions/inline_epp.rb +5 -5
- data/lib/puppet/parser/scope.rb +7 -8
- 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/external_syntax_support.rb +2 -3
- data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
- data/lib/puppet/pops/loader/null_loader.rb +60 -0
- data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +6 -4
- data/lib/puppet/pops/loader/task_instantiator.rb +0 -4
- data/lib/puppet/pops/loaders.rb +1 -1
- data/lib/puppet/pops/lookup/hiera_config.rb +0 -1
- data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
- data/lib/puppet/pops/merge_strategy.rb +18 -22
- 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 +16 -17
- data/lib/puppet/pops/puppet_stack.rb +49 -51
- 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/types.rb +6 -5
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/property/ensure.rb +1 -1
- data/lib/puppet/provider/exec.rb +2 -6
- data/lib/puppet/provider/file/posix.rb +0 -5
- data/lib/puppet/provider/nameservice.rb +3 -10
- data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
- data/lib/puppet/provider/nameservice/pw.rb +2 -2
- data/lib/puppet/provider/package.rb +0 -2
- data/lib/puppet/provider/package/apt.rb +1 -5
- data/lib/puppet/provider/package/dnf.rb +1 -1
- data/lib/puppet/provider/package/dpkg.rb +18 -34
- data/lib/puppet/provider/package/openbsd.rb +1 -1
- data/lib/puppet/provider/package/pip.rb +13 -37
- data/lib/puppet/provider/package/portage.rb +4 -4
- data/lib/puppet/provider/package/puppet_gem.rb +1 -1
- data/lib/puppet/provider/package/rpm.rb +18 -56
- data/lib/puppet/provider/package/windows/package.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +5 -9
- data/lib/puppet/provider/package_targetable.rb +4 -7
- data/lib/puppet/provider/parsedfile.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +9 -9
- data/lib/puppet/provider/service/launchd.rb +5 -20
- 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 +8 -2
- data/lib/puppet/provider/service/systemd.rb +19 -14
- data/lib/puppet/provider/service/windows.rb +0 -8
- data/lib/puppet/provider/user/directoryservice.rb +1 -1
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/pw.rb +3 -12
- data/lib/puppet/provider/user/user_role_add.rb +1 -5
- data/lib/puppet/provider/user/useradd.rb +20 -45
- data/lib/puppet/provider/user/windows_adsi.rb +5 -4
- data/lib/puppet/reference/configuration.rb +3 -3
- data/lib/puppet/reference/indirection.rb +2 -2
- data/lib/puppet/reference/metaparameter.rb +3 -1
- data/lib/puppet/reference/providers.rb +3 -1
- data/lib/puppet/reference/type.rb +9 -3
- data/lib/puppet/reports.rb +1 -1
- data/lib/puppet/resource.rb +1 -18
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/rest/routes.rb +30 -17
- data/lib/puppet/settings.rb +3 -43
- data/lib/puppet/settings/environment_conf.rb +0 -1
- data/lib/puppet/ssl/certificate_request.rb +12 -2
- data/lib/puppet/ssl/host.rb +2 -2
- data/lib/puppet/ssl/oids.rb +1 -1
- data/lib/puppet/ssl/ssl_provider.rb +11 -5
- data/lib/puppet/ssl/state_machine.rb +102 -98
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/transaction.rb +11 -33
- data/lib/puppet/transaction/report.rb +1 -1
- data/lib/puppet/type.rb +4 -2
- data/lib/puppet/type/exec.rb +17 -23
- data/lib/puppet/type/file.rb +39 -11
- data/lib/puppet/type/file/data_sync.rb +1 -5
- data/lib/puppet/type/group.rb +2 -4
- data/lib/puppet/type/notify.rb +3 -4
- data/lib/puppet/type/package.rb +3 -20
- data/lib/puppet/type/schedule.rb +1 -1
- data/lib/puppet/type/service.rb +3 -8
- data/lib/puppet/type/user.rb +2 -4
- data/lib/puppet/util.rb +29 -39
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/execution.rb +3 -4
- data/lib/puppet/util/http_proxy.rb +19 -27
- data/lib/puppet/util/log.rb +2 -2
- data/lib/puppet/util/log/destinations.rb +2 -2
- data/lib/puppet/util/logging.rb +20 -32
- data/lib/puppet/util/metric.rb +2 -2
- data/lib/puppet/util/monkey_patches.rb +33 -0
- data/lib/puppet/util/pidlock.rb +2 -3
- data/lib/puppet/util/provider_features.rb +4 -2
- 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 +2 -8
- data/lib/puppet/util/skip_tags.rb +4 -0
- data/lib/puppet/util/windows/adsi.rb +18 -48
- data/lib/puppet/util/windows/process.rb +8 -8
- data/lib/puppet/util/windows/registry.rb +5 -7
- data/lib/puppet/util/windows/security.rb +0 -2
- data/lib/puppet/util/windows/service.rb +4 -149
- data/lib/puppet/util/windows/sid.rb +0 -1
- data/lib/puppet/vendor.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet/x509/cert_provider.rb +81 -24
- data/locales/puppet.pot +462 -482
- data/man/man5/puppet.conf.5 +43 -44
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +3 -3
- data/man/man8/puppet-catalog.8 +31 -3
- 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 +1 -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-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-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +3 -3
- data/spec/fixtures/ssl/127.0.0.1-key.pem +56 -56
- data/spec/fixtures/ssl/127.0.0.1.pem +27 -27
- data/spec/fixtures/ssl/bad-basic-constraints.pem +32 -32
- data/spec/fixtures/ssl/bad-int-basic-constraints.pem +30 -30
- data/spec/fixtures/ssl/ca.pem +30 -30
- data/spec/fixtures/ssl/crl.pem +15 -15
- data/spec/fixtures/ssl/ec-key.pem +18 -0
- data/spec/fixtures/ssl/ec.pem +40 -0
- data/spec/fixtures/ssl/encrypted-ec-key.pem +21 -0
- data/spec/fixtures/ssl/encrypted-key.pem +57 -57
- data/spec/fixtures/ssl/intermediate-agent-crl.pem +16 -16
- data/spec/fixtures/ssl/intermediate-agent.pem +33 -33
- data/spec/fixtures/ssl/intermediate-crl.pem +17 -17
- data/spec/fixtures/ssl/intermediate.pem +31 -31
- data/spec/fixtures/ssl/pluto-key.pem +56 -56
- data/spec/fixtures/ssl/pluto.pem +28 -28
- data/spec/fixtures/ssl/request-key.pem +56 -56
- data/spec/fixtures/ssl/request.pem +24 -24
- data/spec/fixtures/ssl/revoked-key.pem +56 -56
- data/spec/fixtures/ssl/revoked.pem +25 -25
- data/spec/fixtures/ssl/signed-key.pem +56 -56
- data/spec/fixtures/ssl/signed.pem +25 -25
- data/spec/fixtures/ssl/tampered-cert.pem +27 -27
- data/spec/fixtures/ssl/tampered-csr.pem +24 -24
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/func_with_syntax_error.rb +9 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +24 -0
- data/spec/integration/configurer_spec.rb +0 -52
- data/spec/integration/provider/service/init_spec.rb +1 -0
- data/spec/integration/provider/service/systemd_spec.rb +5 -8
- data/spec/integration/type/file_spec.rb +38 -28
- data/spec/integration/util/execution_spec.rb +0 -27
- data/spec/lib/puppet/certificate_factory.rb +2 -2
- data/spec/lib/puppet/test_ca.rb +17 -4
- data/spec/lib/puppet_spec/fixtures.rb +4 -0
- data/spec/spec_helper.rb +0 -28
- data/spec/unit/application/agent_spec.rb +34 -67
- data/spec/unit/application/device_spec.rb +1 -27
- data/spec/unit/application/ssl_spec.rb +60 -35
- data/spec/unit/configurer_spec.rb +399 -395
- data/spec/unit/defaults_spec.rb +4 -4
- data/spec/unit/face/facts_spec.rb +0 -9
- data/spec/unit/face/parser_spec.rb +69 -22
- data/spec/unit/face/plugin_spec.rb +0 -8
- data/spec/unit/file_system_spec.rb +30 -1
- data/spec/unit/forge/forge_spec.rb +3 -1
- data/spec/unit/forge/repository_spec.rb +3 -1
- data/spec/unit/indirector/catalog/compiler_spec.rb +5 -62
- 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 +10 -25
- data/spec/unit/network/http/connection_spec.rb +145 -119
- data/spec/unit/network/http/factory_spec.rb +5 -27
- data/spec/unit/parser/scope_spec.rb +0 -10
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +3 -8
- data/spec/unit/pops/loaders/loaders_spec.rb +4 -0
- data/spec/unit/pops/loaders/module_loaders_spec.rb +0 -37
- data/spec/unit/pops/types/types_spec.rb +27 -0
- data/spec/unit/provider/exec_spec.rb +0 -209
- data/spec/unit/provider/package/aptrpm_spec.rb +1 -1
- data/spec/unit/provider/package/dnf_spec.rb +0 -7
- data/spec/unit/provider/package/dpkg_spec.rb +80 -240
- data/spec/unit/provider/package/pip_spec.rb +8 -61
- data/spec/unit/provider/package/portage_spec.rb +4 -4
- data/spec/unit/provider/package/rpm_spec.rb +16 -150
- data/spec/unit/provider/package/yum_spec.rb +0 -7
- data/spec/unit/provider/service/daemontools_spec.rb +0 -24
- data/spec/unit/provider/service/launchd_spec.rb +0 -28
- data/spec/unit/provider/service/runit_spec.rb +0 -24
- data/spec/unit/provider/service/systemd_spec.rb +25 -39
- data/spec/unit/provider/service/windows_spec.rb +0 -20
- data/spec/unit/provider/user/hpux_spec.rb +2 -2
- data/spec/unit/provider/user/pw_spec.rb +0 -37
- data/spec/unit/provider/user/useradd_spec.rb +0 -88
- data/spec/unit/resource_spec.rb +1 -26
- data/spec/unit/ssl/host_spec.rb +5 -0
- data/spec/unit/ssl/ssl_provider_spec.rb +36 -11
- data/spec/unit/ssl/state_machine_spec.rb +233 -158
- data/spec/unit/transaction_spec.rb +0 -64
- data/spec/unit/type/exec_spec.rb +12 -15
- data/spec/unit/type/file/content_spec.rb +3 -9
- data/spec/unit/type/file/source_spec.rb +4 -4
- data/spec/unit/type/file_spec.rb +15 -11
- data/spec/unit/type/package_spec.rb +0 -5
- data/spec/unit/type/schedule_spec.rb +1 -3
- data/spec/unit/type/service_spec.rb +0 -16
- data/spec/unit/util/execution_spec.rb +0 -16
- data/spec/unit/util/http_proxy_spec.rb +21 -151
- data/spec/unit/util/ldap/manager_spec.rb +0 -15
- data/spec/unit/util/log/destinations_spec.rb +3 -7
- data/spec/unit/util/log_spec.rb +138 -0
- data/spec/unit/util/logging_spec.rb +0 -200
- data/spec/unit/util/pidlock_spec.rb +0 -26
- data/spec/unit/util/skip_tags_spec.rb +14 -0
- data/spec/unit/util/windows/adsi_spec.rb +0 -51
- data/spec/unit/util/windows/service_spec.rb +0 -9
- data/spec/unit/util_spec.rb +10 -0
- data/spec/unit/x509/cert_provider_spec.rb +82 -43
- data/tasks/generate_cert_fixtures.rake +13 -1
- data/tasks/manpages.rake +0 -1
- metadata +26 -20
- data/ext/cert_inspector +0 -140
- data/ext/envpuppet +0 -139
- data/ext/envpuppet.bat +0 -14
- data/ext/puppet-test +0 -476
- data/ext/pure_ruby_dsl/dsl_test.rb +0 -7
- data/ext/upload_facts.rb +0 -119
- data/lib/puppet/provider/package/dnfmodule.rb +0 -87
- data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +0 -11
- data/spec/integration/type/notify_spec.rb +0 -46
- data/spec/unit/provider/package/dnfmodule_spec.rb +0 -186
- data/spec/unit/provider/package_targetable_spec.rb +0 -60
@@ -13,7 +13,6 @@ These options should be specified as an array where each element is either a str
|
|
13
13
|
has_feature :install_options
|
14
14
|
has_feature :uninstall_options
|
15
15
|
has_feature :virtual_packages
|
16
|
-
has_feature :install_only
|
17
16
|
|
18
17
|
# Note: self:: is required here to keep these constants in the context of what will
|
19
18
|
# eventually become this Puppet::Type::Package::ProviderRpm class.
|
@@ -21,7 +20,6 @@ These options should be specified as an array where each element is either a str
|
|
21
20
|
self::NEVRA_FORMAT = %Q{%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\\n}
|
22
21
|
self::NEVRA_REGEX = %r{^'?(\S+) (\S+) (\S+) (\S+) (\S+)$}
|
23
22
|
self::NEVRA_FIELDS = [:name, :epoch, :version, :release, :arch]
|
24
|
-
self::MULTIVERSION_SEPARATOR = "; "
|
25
23
|
|
26
24
|
ARCH_LIST = [
|
27
25
|
'noarch',
|
@@ -81,9 +79,12 @@ These options should be specified as an array where each element is either a str
|
|
81
79
|
|
82
80
|
# list out all of the packages
|
83
81
|
begin
|
84
|
-
execpipe("#{command(:rpm)} -qa #{nosignature} #{nodigest} --qf '#{self::NEVRA_FORMAT}'
|
82
|
+
execpipe("#{command(:rpm)} -qa #{nosignature} #{nodigest} --qf '#{self::NEVRA_FORMAT}'") { |process|
|
85
83
|
# now turn each returned line into a package object
|
86
|
-
|
84
|
+
process.each_line { |line|
|
85
|
+
hash = nevra_to_hash(line)
|
86
|
+
packages << new(hash) unless hash.empty?
|
87
|
+
}
|
87
88
|
}
|
88
89
|
rescue Puppet::ExecutionFailure
|
89
90
|
raise Puppet::Error, _("Failed to list packages"), $!.backtrace
|
@@ -99,7 +100,7 @@ These options should be specified as an array where each element is either a str
|
|
99
100
|
#NOTE: Prior to a fix for issue 1243, this method potentially returned a cached value
|
100
101
|
#IF YOU CALL THIS METHOD, IT WILL CALL RPM
|
101
102
|
#Use get(:property) to check if cached values are available
|
102
|
-
cmd = ["-q", @resource[:name], "#{self.class.nosignature}", "#{self.class.nodigest}", "--qf", "#{self.class::NEVRA_FORMAT}"]
|
103
|
+
cmd = ["-q", @resource[:name], "#{self.class.nosignature}", "#{self.class.nodigest}", "--qf", "'#{self.class::NEVRA_FORMAT}'"]
|
103
104
|
|
104
105
|
begin
|
105
106
|
output = rpm(*cmd)
|
@@ -116,7 +117,9 @@ These options should be specified as an array where each element is either a str
|
|
116
117
|
return nil
|
117
118
|
end
|
118
119
|
end
|
119
|
-
|
120
|
+
# FIXME: We could actually be getting back multiple packages
|
121
|
+
# for multilib and this will only return the first such package
|
122
|
+
@property_hash.update(self.class.nevra_to_hash(output))
|
120
123
|
|
121
124
|
@property_hash.dup
|
122
125
|
end
|
@@ -127,8 +130,8 @@ These options should be specified as an array where each element is either a str
|
|
127
130
|
@resource.fail _("RPMs must specify a package source")
|
128
131
|
end
|
129
132
|
|
130
|
-
cmd = [command(:rpm), "-q", "--qf", "#{self.class::NEVRA_FORMAT}", "-p", source]
|
131
|
-
h = self.class.
|
133
|
+
cmd = [command(:rpm), "-q", "--qf", "'#{self.class::NEVRA_FORMAT}'", "-p", source]
|
134
|
+
h = self.class.nevra_to_hash(execute(cmd))
|
132
135
|
h[:ensure]
|
133
136
|
rescue Puppet::ExecutionFailure => e
|
134
137
|
raise Puppet::Error, e.message, e.backtrace
|
@@ -165,11 +168,7 @@ These options should be specified as an array where each element is either a str
|
|
165
168
|
if @resource[:name].start_with? nav
|
166
169
|
identifier = nav
|
167
170
|
else
|
168
|
-
|
169
|
-
identifier = get(:ensure).split(self.class::MULTIVERSION_SEPARATOR).map { |ver| "#{name}-#{ver}" }
|
170
|
-
else
|
171
|
-
identifier = name
|
172
|
-
end
|
171
|
+
identifier = name
|
173
172
|
end
|
174
173
|
end
|
175
174
|
# If an arch is specified in the resource, uninstall that arch,
|
@@ -228,14 +227,14 @@ These options should be specified as an array where each element is either a str
|
|
228
227
|
str2 = str2.gsub(front_strip_re, '')
|
229
228
|
|
230
229
|
# "handle the tilde separator, it sorts before everything else"
|
231
|
-
if str1
|
230
|
+
if /^~/.match(str1) && /^~/.match(str2)
|
232
231
|
# if they both have ~, strip it
|
233
232
|
str1 = str1[1..-1]
|
234
233
|
str2 = str2[1..-1]
|
235
234
|
next
|
236
|
-
elsif str1
|
235
|
+
elsif /^~/.match(str1)
|
237
236
|
return -1
|
238
|
-
elsif str2
|
237
|
+
elsif /^~/.match(str2)
|
239
238
|
return 1
|
240
239
|
end
|
241
240
|
|
@@ -244,7 +243,7 @@ These options should be specified as an array where each element is either a str
|
|
244
243
|
# "grab first completely alpha or completely numeric segment"
|
245
244
|
isnum = false
|
246
245
|
# if the first char of str1 is a digit, grab the chunk of continuous digits from each string
|
247
|
-
if
|
246
|
+
if /^[0-9]+/.match(str1)
|
248
247
|
if str1 =~ /^[0-9]+/
|
249
248
|
segment1 = $~.to_s
|
250
249
|
str1 = $~.post_match
|
@@ -309,12 +308,8 @@ These options should be specified as an array where each element is either a str
|
|
309
308
|
|
310
309
|
def insync?(is)
|
311
310
|
return false if [:purged, :absent].include?(is)
|
312
|
-
return false if is.include?(self.class::MULTIVERSION_SEPARATOR) && !@resource[:install_only]
|
313
|
-
|
314
311
|
should = resource[:ensure]
|
315
|
-
|
316
|
-
0 == self.rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(version))
|
317
|
-
end
|
312
|
+
0 == rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(is))
|
318
313
|
end
|
319
314
|
|
320
315
|
# parse a rpm "version" specification
|
@@ -339,7 +334,7 @@ These options should be specified as an array where each element is either a str
|
|
339
334
|
v = s[0,ri]
|
340
335
|
r = s[ri+1,s.length]
|
341
336
|
if arch = r.scan(ARCH_REGEX)[0]
|
342
|
-
a = arch.
|
337
|
+
a = arch.gsub(/\./, '')
|
343
338
|
r.gsub!(ARCH_REGEX, '')
|
344
339
|
end
|
345
340
|
else
|
@@ -417,37 +412,4 @@ These options should be specified as an array where each element is either a str
|
|
417
412
|
|
418
413
|
return hash
|
419
414
|
end
|
420
|
-
|
421
|
-
# @param line [String] multiple lines of rpm package query information
|
422
|
-
# @return list of [Hash] of NEVRA_FIELDS strings parsed from package info
|
423
|
-
# or an empty list if we failed to parse
|
424
|
-
# @api private
|
425
|
-
def self.nevra_to_multiversion_hash(multiline)
|
426
|
-
list = []
|
427
|
-
multiversion_hash = {}
|
428
|
-
multiline.each_line do |line|
|
429
|
-
hash = self.nevra_to_hash(line)
|
430
|
-
if !hash.empty?
|
431
|
-
if multiversion_hash.empty?
|
432
|
-
multiversion_hash = hash.dup
|
433
|
-
next
|
434
|
-
end
|
435
|
-
|
436
|
-
if multiversion_hash[:name] != hash[:name]
|
437
|
-
list << multiversion_hash
|
438
|
-
multiversion_hash = hash.dup
|
439
|
-
next
|
440
|
-
end
|
441
|
-
|
442
|
-
if !multiversion_hash[:ensure].include?(hash[:ensure])
|
443
|
-
multiversion_hash[:ensure].concat("#{self::MULTIVERSION_SEPARATOR}#{hash[:ensure]}")
|
444
|
-
end
|
445
|
-
end
|
446
|
-
end
|
447
|
-
list << multiversion_hash if multiversion_hash
|
448
|
-
if list.size == 1
|
449
|
-
return list[0]
|
450
|
-
end
|
451
|
-
return list
|
452
|
-
end
|
453
415
|
end
|
@@ -79,7 +79,7 @@ class Puppet::Provider::Package::Windows
|
|
79
79
|
|
80
80
|
def self.replace_forward_slashes(value)
|
81
81
|
if value.include?('/')
|
82
|
-
value = value.
|
82
|
+
value = value.gsub('/', "\\")
|
83
83
|
Puppet.debug('Package source parameter contained /s - replaced with \\s')
|
84
84
|
end
|
85
85
|
value
|
@@ -8,7 +8,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
8
8
|
This provider supports the `install_options` attribute, which allows command-line flags to be passed to yum.
|
9
9
|
These options should be specified as an array where each element is either a string or a hash."
|
10
10
|
|
11
|
-
has_feature :install_options, :versionable, :virtual_packages
|
11
|
+
has_feature :install_options, :versionable, :virtual_packages
|
12
12
|
|
13
13
|
commands :cmd => "yum", :rpm => "rpm"
|
14
14
|
|
@@ -92,7 +92,7 @@ defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a
|
|
92
92
|
updates = Hash.new { |h, k| h[k] = [] }
|
93
93
|
body.split.each_slice(3) do |tuple|
|
94
94
|
break if tuple[0] =~ /^(Obsoleting|Security:|Update)/
|
95
|
-
break unless tuple[1]
|
95
|
+
break unless tuple[1].match(/^(?:(\d+):)?(\S+)-(\S+)$/)
|
96
96
|
hash = update_to_hash(*tuple[0..1])
|
97
97
|
# Create entries for both the package name without a version and a
|
98
98
|
# version since yum considers those as mostly interchangeable.
|
@@ -203,10 +203,7 @@ defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a
|
|
203
203
|
end
|
204
204
|
current_package = self.query
|
205
205
|
if current_package
|
206
|
-
if
|
207
|
-
self.debug "Updating package #{@resource[:name]} from version #{current_package[:ensure]} to #{should} as install_only packages are never downgraded"
|
208
|
-
operation = update_command
|
209
|
-
elsif rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(current_package[:ensure])) < 0
|
206
|
+
if rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(current_package[:ensure])) < 0
|
210
207
|
self.debug "Downgrading package #{@resource[:name]} from version #{current_package[:ensure]} to #{should}"
|
211
208
|
operation = :downgrade
|
212
209
|
elsif rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(current_package[:ensure])) > 0
|
@@ -231,11 +228,10 @@ defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a
|
|
231
228
|
is = self.query
|
232
229
|
raise Puppet::Error, _("Could not find package %{name}") % { name: self.name } unless is
|
233
230
|
|
234
|
-
version = is[:ensure]
|
235
231
|
# FIXME: Should we raise an exception even if should == :latest
|
236
232
|
# and yum updated us to a version other than @param_hash[:ensure] ?
|
237
|
-
|
238
|
-
|
233
|
+
vercmp_result = rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(is[:ensure]))
|
234
|
+
raise Puppet::Error, _("Failed to update to version %{should}, got version %{version} instead") % { should: should, version: is[:ensure] } if vercmp_result != 0
|
239
235
|
end
|
240
236
|
end
|
241
237
|
|
@@ -7,8 +7,6 @@
|
|
7
7
|
# possibly via a `prefetchV2` method that could take a better data structure.)
|
8
8
|
#
|
9
9
|
# In addition, `Puppet::Provider::Package::properties` calls `query` in the provider.
|
10
|
-
require 'puppet/provider/package'
|
11
|
-
|
12
10
|
# But `query` in the provider depends upon whether a `command` attribute is defined for the resource.
|
13
11
|
# This is a Catch-22.
|
14
12
|
#
|
@@ -25,25 +23,24 @@ require 'puppet/provider/package'
|
|
25
23
|
class Puppet::Provider::Package::Targetable < Puppet::Provider::Package
|
26
24
|
# Prefetch our package list, yo.
|
27
25
|
def self.prefetch(packages)
|
28
|
-
catalog_packages = packages.
|
26
|
+
catalog_packages = packages.first[1]::catalog::resources.select{ |p| p.provider.class == self }
|
29
27
|
package_commands = catalog_packages.map { |catalog_package| catalog_package::original_parameters[:command] }.uniq
|
30
28
|
package_commands.each do |command|
|
31
29
|
instances(command).each do |instance|
|
32
30
|
catalog_packages.each do |catalog_package|
|
33
|
-
if catalog_package[:name] == instance.name && catalog_package
|
31
|
+
if catalog_package[:name] == instance.name && catalog_package::original_parameters[:command] == command
|
34
32
|
catalog_package.provider = instance
|
35
|
-
self.debug "Prefetched instance: %{name} via command: %{
|
33
|
+
self.debug "Prefetched instance: %{name} via command: %{command}" % { name: instance.name, cmd: (command || :default)}
|
36
34
|
end
|
37
35
|
end
|
38
36
|
end
|
39
37
|
end
|
40
|
-
package_commands
|
41
38
|
end
|
42
39
|
|
43
40
|
# Returns the resource command or provider command.
|
44
41
|
|
45
42
|
def resource_or_provider_command
|
46
|
-
resource
|
43
|
+
resource::original_parameters[:command] || self.class.provider_command
|
47
44
|
end
|
48
45
|
|
49
46
|
# Targetable providers use has_command/is_optional to defer validation of provider suitability.
|
@@ -71,7 +71,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
71
71
|
|
72
72
|
flushed = []
|
73
73
|
begin
|
74
|
-
@modified.
|
74
|
+
@modified.sort { |a,b| a.to_s <=> b.to_s }.uniq.each do |target|
|
75
75
|
Puppet.debug "Flushing #{@resource_type.name} provider target #{target}"
|
76
76
|
flushed << target
|
77
77
|
flush_target(target)
|
@@ -46,8 +46,14 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
|
|
46
46
|
|
47
47
|
# Determine the daemon path.
|
48
48
|
def defpath
|
49
|
-
@defpath
|
50
|
-
|
49
|
+
unless @defpath
|
50
|
+
["/var/lib/service", "/etc"].each do |path|
|
51
|
+
if Puppet::FileSystem.exist?(path)
|
52
|
+
@defpath = path
|
53
|
+
break
|
54
|
+
end
|
55
|
+
end
|
56
|
+
raise "Could not find the daemon directory (tested [/var/lib/service,/etc])" unless @defpath
|
51
57
|
end
|
52
58
|
@defpath
|
53
59
|
end
|
@@ -59,10 +65,6 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
|
|
59
65
|
# ie enabled or not
|
60
66
|
def self.instances
|
61
67
|
path = self.defpath
|
62
|
-
unless path
|
63
|
-
Puppet.info("#{self.name} is unsuitable because service directory is nil")
|
64
|
-
return
|
65
|
-
end
|
66
68
|
unless FileTest.directory?(path)
|
67
69
|
Puppet.notice "Service path #{path} does not exist"
|
68
70
|
return
|
@@ -107,9 +109,7 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
|
|
107
109
|
# note that this path can be overridden in the resource
|
108
110
|
# definition
|
109
111
|
def daemon
|
110
|
-
path
|
111
|
-
raise Puppet::Error.new("#{self.class.name} must specify a path for daemon directory") unless path
|
112
|
-
File.join(path, resource[:name])
|
112
|
+
File.join(resource[:path], resource[:name])
|
113
113
|
end
|
114
114
|
|
115
115
|
def status
|
@@ -240,20 +240,12 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
240
240
|
def status
|
241
241
|
if @resource && ((@resource[:hasstatus] == :false) || (@resource[:status]))
|
242
242
|
return super
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
# Updating services with new statuses
|
247
|
-
job_list = self.class.job_list
|
248
|
-
# if job is present in job_list, return its status
|
249
|
-
if job_list.key?(service_name)
|
250
|
-
job_list[service_name]
|
251
|
-
# if job is no longer present in job_list, it was stopped
|
243
|
+
else
|
244
|
+
if @property_hash[:status].nil?
|
245
|
+
:absent
|
252
246
|
else
|
253
|
-
:
|
247
|
+
@property_hash[:status]
|
254
248
|
end
|
255
|
-
else
|
256
|
-
@property_hash[:status]
|
257
249
|
end
|
258
250
|
end
|
259
251
|
|
@@ -321,14 +313,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
321
313
|
job_plist_disabled = nil
|
322
314
|
overrides_disabled = nil
|
323
315
|
|
324
|
-
|
325
|
-
_, job_plist = plist_from_label(resource[:name])
|
326
|
-
rescue Puppet::Error => err
|
327
|
-
# if job does not exist, log the error and return false as on other platforms
|
328
|
-
Puppet.log_exception(err)
|
329
|
-
return :false
|
330
|
-
end
|
331
|
-
|
316
|
+
_, job_plist = plist_from_label(resource[:name])
|
332
317
|
job_plist_disabled = job_plist["Disabled"] if job_plist.has_key?("Disabled")
|
333
318
|
|
334
319
|
if FileTest.file?(self.class.launchd_overrides) and overrides = self.class.read_overrides
|
@@ -79,7 +79,7 @@ Puppet::Type.type(:service).provide :openbsd, :parent => :init do
|
|
79
79
|
def running?
|
80
80
|
output = execute([command(:rcctl), "check", @resource[:name]],
|
81
81
|
:failonfail => false, :combine => false, :squelch => false).chomp
|
82
|
-
return true if output
|
82
|
+
return true if output.match(/\(ok\)/)
|
83
83
|
end
|
84
84
|
|
85
85
|
# Uses the wrapper to prevent failure when the service is not running;
|
@@ -17,7 +17,7 @@ Puppet::Type.type(:service).provide :rcng, :parent => :bsd do
|
|
17
17
|
if Puppet::FileSystem.exist?(rcfile)
|
18
18
|
File.open(rcfile).readlines.each do |line|
|
19
19
|
# Now look for something that looks like "service=${service:=YES}" or "service=YES"
|
20
|
-
if line
|
20
|
+
if line.match(/^\s*#{@resource[:name]}=(?:YES|\${#{@resource[:name]}:=YES})/)
|
21
21
|
return :true
|
22
22
|
end
|
23
23
|
end
|
@@ -34,7 +34,7 @@ Puppet::Type.type(:service).provide :rcng, :parent => :bsd do
|
|
34
34
|
if Puppet::FileSystem.exist?(rcfile)
|
35
35
|
newcontents = []
|
36
36
|
File.open(rcfile).readlines.each do |line|
|
37
|
-
if line
|
37
|
+
if line.match(/^\s*#{@resource[:name]}=(NO|\$\{#{@resource[:name]}:NO\})/)
|
38
38
|
line = "#{@resource[:name]}=${#{@resource[:name]}:=YES}"
|
39
39
|
end
|
40
40
|
newcontents.push(line)
|
@@ -40,8 +40,14 @@ Puppet::Type.type(:service).provide :runit, :parent => :daemontools do
|
|
40
40
|
# this is necessary to autodetect a valid resource
|
41
41
|
# default path, since there is no standard for such directory.
|
42
42
|
def defpath
|
43
|
-
@defpath
|
44
|
-
|
43
|
+
unless @defpath
|
44
|
+
["/etc/sv", "/var/lib/service"].each do |path|
|
45
|
+
if Puppet::FileSystem.exist?(path)
|
46
|
+
@defpath = path
|
47
|
+
break
|
48
|
+
end
|
49
|
+
end
|
50
|
+
raise "Could not find the daemon directory (tested [/etc/sv,/var/lib/service])" unless @defpath
|
45
51
|
end
|
46
52
|
@defpath
|
47
53
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# Manage systemd services using systemctl
|
2
2
|
|
3
|
-
require 'puppet/file_system'
|
4
|
-
|
5
3
|
Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
6
4
|
desc "Manages `systemd` services using `systemctl`.
|
7
5
|
|
@@ -11,7 +9,14 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
11
9
|
|
12
10
|
commands :systemctl => "systemctl"
|
13
11
|
|
14
|
-
|
12
|
+
if Facter.value(:osfamily).downcase == 'debian'
|
13
|
+
# With multiple init systems on Debian, it is possible to have
|
14
|
+
# pieces of systemd around (e.g. systemctl) but not really be
|
15
|
+
# using systemd. We do not do this on other platforms as it can
|
16
|
+
# cause issues when running in a chroot without /run mounted
|
17
|
+
# (PUP-5577)
|
18
|
+
confine :exists => "/run/systemd/system"
|
19
|
+
end
|
15
20
|
|
16
21
|
defaultfor :osfamily => [:archlinux]
|
17
22
|
defaultfor :osfamily => :redhat, :operatingsystemmajrelease => ["7", "8"]
|
@@ -19,8 +24,8 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
19
24
|
defaultfor :osfamily => :suse
|
20
25
|
defaultfor :osfamily => :coreos
|
21
26
|
defaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2"]
|
22
|
-
defaultfor :operatingsystem => :debian
|
23
|
-
|
27
|
+
defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ["8", "stretch/sid", "9", "buster/sid"]
|
28
|
+
|
24
29
|
defaultfor :operatingsystem => :LinuxMint
|
25
30
|
notdefaultfor :operatingsystem => :LinuxMint, :operatingsystemmajrelease => ["10", "11", "12", "13", "14", "15", "16", "17"] # These are using upstart
|
26
31
|
defaultfor :operatingsystem => :ubuntu
|
@@ -44,7 +49,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
44
49
|
# in the provider's believed state of the service and the actual state.
|
45
50
|
# @param action [String,Symbol] One of 'enable', 'disable', 'mask' or 'unmask'
|
46
51
|
def systemctl_change_enable(action)
|
47
|
-
output = systemctl(action,
|
52
|
+
output = systemctl(action, @resource[:name])
|
48
53
|
rescue
|
49
54
|
raise Puppet::Error, "Could not #{action} #{self.name}: #{output}", $!.backtrace
|
50
55
|
ensure
|
@@ -57,7 +62,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
57
62
|
|
58
63
|
def get_start_link_count
|
59
64
|
# Start links don't include '.service'. Just search for the service name.
|
60
|
-
if @resource[:name]
|
65
|
+
if @resource[:name].match(/\.service/)
|
61
66
|
link_name = @resource[:name].split('.')[0]
|
62
67
|
else
|
63
68
|
link_name = @resource[:name]
|
@@ -68,7 +73,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
68
73
|
|
69
74
|
def cached_enabled?
|
70
75
|
return @cached_enabled if @cached_enabled
|
71
|
-
cmd = [command(:systemctl), 'is-enabled',
|
76
|
+
cmd = [command(:systemctl), 'is-enabled', @resource[:name]]
|
72
77
|
@cached_enabled = execute(cmd, :failonfail => false).strip
|
73
78
|
end
|
74
79
|
|
@@ -87,7 +92,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
87
92
|
# The indirect state indicates that the unit is not enabled.
|
88
93
|
return :false if output == 'indirect'
|
89
94
|
return :true if (code == 0)
|
90
|
-
if (output.empty?) && (code > 0) && (Facter.value(:osfamily).
|
95
|
+
if (output.empty?) && (code > 0) && (Facter.value(:osfamily).downcase == 'debian')
|
91
96
|
ret = debian_enabled?
|
92
97
|
return ret if ret
|
93
98
|
end
|
@@ -127,7 +132,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
127
132
|
# This function is called only on start & restart unit options.
|
128
133
|
# Reference: (PUP-3483) Systemd provider doesn't scan for changed units
|
129
134
|
def daemon_reload?
|
130
|
-
cmd = [command(:systemctl), 'show', '--property=NeedDaemonReload'
|
135
|
+
cmd = [command(:systemctl), 'show', @resource[:name], '--property=NeedDaemonReload']
|
131
136
|
daemon_reload = execute(cmd, :failonfail => false).strip.split('=').last
|
132
137
|
if daemon_reload == 'yes'
|
133
138
|
daemon_reload_cmd = [command(:systemctl), 'daemon-reload']
|
@@ -150,20 +155,20 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
150
155
|
end
|
151
156
|
|
152
157
|
def restartcmd
|
153
|
-
[command(:systemctl), "restart",
|
158
|
+
[command(:systemctl), "restart", @resource[:name]]
|
154
159
|
end
|
155
160
|
|
156
161
|
def startcmd
|
157
162
|
self.unmask
|
158
|
-
[command(:systemctl), "start",
|
163
|
+
[command(:systemctl), "start", @resource[:name]]
|
159
164
|
end
|
160
165
|
|
161
166
|
def stopcmd
|
162
|
-
[command(:systemctl), "stop",
|
167
|
+
[command(:systemctl), "stop", @resource[:name]]
|
163
168
|
end
|
164
169
|
|
165
170
|
def statuscmd
|
166
|
-
[command(:systemctl), "is-active",
|
171
|
+
[command(:systemctl), "is-active", @resource[:name]]
|
167
172
|
end
|
168
173
|
|
169
174
|
def restart
|