puppet 6.18.0-x86-mingw32 → 6.21.1-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 +2 -16
- data/Gemfile +2 -0
- data/Gemfile.lock +37 -34
- data/README.md +1 -2
- data/Rakefile +4 -12
- data/lib/puppet/agent/locker.rb +0 -7
- data/lib/puppet/application.rb +10 -6
- data/lib/puppet/application/agent.rb +9 -3
- data/lib/puppet/application/apply.rb +3 -2
- data/lib/puppet/application/device.rb +1 -0
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/filebucket.rb +2 -2
- data/lib/puppet/application/lookup.rb +5 -5
- data/lib/puppet/application/script.rb +1 -0
- data/lib/puppet/application_support.rb +7 -0
- data/lib/puppet/configurer.rb +50 -8
- data/lib/puppet/defaults.rb +67 -35
- data/lib/puppet/environments.rb +84 -59
- data/lib/puppet/face/catalog.rb +1 -1
- data/lib/puppet/face/config.rb +56 -16
- data/lib/puppet/face/epp.rb +12 -2
- data/lib/puppet/face/facts.rb +60 -0
- data/lib/puppet/face/node.rb +3 -3
- data/lib/puppet/face/node/clean.rb +2 -2
- data/lib/puppet/face/status.rb +1 -1
- data/lib/puppet/ffi/posix.rb +10 -0
- data/lib/puppet/ffi/posix/constants.rb +14 -0
- data/lib/puppet/ffi/posix/functions.rb +24 -0
- data/lib/puppet/file_bucket/dipper.rb +1 -1
- data/lib/puppet/functions/epp.rb +1 -0
- data/lib/puppet/functions/inline_epp.rb +1 -0
- data/lib/puppet/functions/new.rb +8 -3
- data/lib/puppet/http.rb +1 -0
- data/lib/puppet/http/client.rb +1 -1
- data/lib/puppet/http/resolver.rb +5 -8
- data/lib/puppet/http/resolver/server_list.rb +18 -36
- data/lib/puppet/http/resolver/settings.rb +4 -4
- data/lib/puppet/http/resolver/srv.rb +5 -5
- data/lib/puppet/http/service.rb +3 -1
- data/lib/puppet/http/service/compiler.rb +1 -1
- data/lib/puppet/http/service/file_server.rb +1 -1
- data/lib/puppet/http/service/puppetserver.rb +39 -0
- data/lib/puppet/http/session.rb +5 -4
- data/lib/puppet/indirector/catalog/compiler.rb +1 -1
- data/lib/puppet/indirector/fact_search.rb +60 -0
- data/lib/puppet/indirector/facts/json.rb +27 -0
- data/lib/puppet/indirector/facts/yaml.rb +4 -59
- data/lib/puppet/indirector/json.rb +5 -1
- data/lib/puppet/indirector/msgpack.rb +1 -1
- data/lib/puppet/indirector/node/json.rb +8 -0
- data/lib/puppet/indirector/report/json.rb +34 -0
- data/lib/puppet/indirector/request.rb +4 -4
- data/lib/puppet/indirector/yaml.rb +1 -1
- data/lib/puppet/module_tool/applications/installer.rb +48 -2
- data/lib/puppet/module_tool/errors/shared.rb +17 -2
- data/lib/puppet/network/formats.rb +2 -1
- data/lib/puppet/network/http/api/master/v3/environments.rb +0 -1
- data/lib/puppet/node/facts.rb +17 -0
- data/lib/puppet/pal/pal_impl.rb +70 -17
- data/lib/puppet/parser/ast/leaf.rb +3 -2
- data/lib/puppet/parser/templatewrapper.rb +1 -1
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -3
- data/lib/puppet/pops/evaluator/deferred_resolver.rb +5 -3
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +22 -3
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +2 -2
- data/lib/puppet/pops/model/ast_transformer.rb +1 -1
- data/lib/puppet/pops/types/p_meta_type.rb +1 -1
- data/lib/puppet/pops/types/p_type_set_type.rb +4 -0
- data/lib/puppet/property/list.rb +1 -1
- data/lib/puppet/provider/group/groupadd.rb +13 -8
- data/lib/puppet/provider/package/apt.rb +34 -2
- data/lib/puppet/provider/package/aptitude.rb +6 -0
- data/lib/puppet/provider/package/dpkg.rb +1 -1
- data/lib/puppet/provider/package/pip2.rb +17 -0
- data/lib/puppet/provider/package/puppetserver_gem.rb +180 -0
- data/lib/puppet/provider/package/yum.rb +1 -0
- data/lib/puppet/provider/service/debian.rb +2 -0
- data/lib/puppet/provider/user/aix.rb +2 -2
- data/lib/puppet/provider/user/useradd.rb +62 -8
- data/lib/puppet/reference/configuration.rb +6 -5
- data/lib/puppet/resource/type.rb +2 -1
- data/lib/puppet/rest/route.rb +2 -2
- data/lib/puppet/settings.rb +62 -20
- data/lib/puppet/settings/alias_setting.rb +37 -0
- data/lib/puppet/settings/base_setting.rb +26 -2
- data/lib/puppet/transaction/report.rb +11 -7
- data/lib/puppet/type/file/source.rb +1 -1
- data/lib/puppet/type/filebucket.rb +1 -1
- data/lib/puppet/type/package.rb +3 -3
- data/lib/puppet/util/autoload.rb +1 -8
- data/lib/puppet/util/connection.rb +8 -8
- data/lib/puppet/util/fact_dif.rb +62 -0
- data/lib/puppet/util/posix.rb +54 -5
- data/lib/puppet/util/rubygems.rb +5 -1
- data/lib/puppet/util/run_mode.rb +5 -1
- data/lib/puppet/util/windows/service.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +289 -268
- data/man/man5/puppet.conf.5 +33 -17
- data/man/man8/puppet-agent.8 +7 -4
- data/man/man8/puppet-apply.8 +2 -2
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +6 -6
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +2 -2
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +32 -1
- data/man/man8/puppet-filebucket.8 +3 -3
- 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 +7 -4
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +4 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +2 -2
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +2 -2
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +91 -0
- data/spec/fixtures/unit/provider/package/puppetserver_gem/gem-list-local-packages +30 -0
- data/spec/fixtures/unit/provider/user/aix/aix_passwd_file.out +4 -0
- data/spec/integration/application/agent_spec.rb +183 -22
- data/spec/integration/application/apply_spec.rb +19 -0
- data/spec/integration/application/filebucket_spec.rb +7 -7
- data/spec/integration/application/plugin_spec.rb +3 -3
- data/spec/integration/configurer_spec.rb +14 -0
- data/spec/integration/defaults_spec.rb +19 -1
- data/spec/integration/environments/setting_hooks_spec.rb +1 -1
- data/spec/integration/resource/type_collection_spec.rb +2 -6
- data/spec/integration/transaction_spec.rb +4 -9
- data/spec/integration/util/windows/adsi_spec.rb +5 -3
- data/spec/integration/util/windows/registry_spec.rb +0 -10
- data/spec/lib/puppet_spec/settings.rb +6 -1
- data/spec/shared_contexts/types_setup.rb +2 -0
- data/spec/spec_helper.rb +1 -4
- data/spec/unit/agent_spec.rb +8 -6
- data/spec/unit/application/agent_spec.rb +0 -1
- data/spec/unit/application/config_spec.rb +224 -4
- data/spec/unit/application/doc_spec.rb +2 -2
- data/spec/unit/application/facts_spec.rb +3 -1
- data/spec/unit/application/filebucket_spec.rb +0 -2
- data/spec/unit/application_spec.rb +60 -13
- data/spec/unit/configurer_spec.rb +39 -6
- data/spec/unit/confine/feature_spec.rb +1 -1
- data/spec/unit/confine_spec.rb +8 -2
- data/spec/unit/defaults_spec.rb +20 -1
- data/spec/unit/environments_spec.rb +176 -32
- data/spec/unit/face/config_spec.rb +62 -11
- data/spec/unit/face/node_spec.rb +2 -13
- data/spec/unit/file_serving/configuration/parser_spec.rb +0 -1
- data/spec/unit/file_serving/metadata_spec.rb +3 -3
- data/spec/unit/file_serving/terminus_helper_spec.rb +11 -4
- data/spec/unit/file_system_spec.rb +1 -2
- data/spec/unit/forge/module_release_spec.rb +2 -7
- data/spec/unit/functions/inline_epp_spec.rb +26 -1
- data/spec/unit/http/resolver_spec.rb +24 -4
- data/spec/unit/http/service/ca_spec.rb +2 -2
- data/spec/unit/http/service/compiler_spec.rb +51 -2
- data/spec/unit/http/service/file_server_spec.rb +2 -2
- data/spec/unit/http/service/puppetserver_spec.rb +82 -0
- data/spec/unit/http/service/report_spec.rb +2 -2
- data/spec/unit/http/service_spec.rb +1 -1
- data/spec/unit/http/session_spec.rb +8 -20
- data/spec/unit/indirector/catalog/json_spec.rb +1 -1
- data/spec/unit/indirector/catalog/rest_spec.rb +1 -1
- data/spec/unit/indirector/face_spec.rb +0 -1
- data/spec/unit/indirector/facts/facter_spec.rb +0 -1
- data/spec/unit/indirector/facts/json_spec.rb +255 -0
- data/spec/unit/indirector/facts/rest_spec.rb +1 -1
- data/spec/unit/indirector/file_bucket_file/selector_spec.rb +26 -8
- data/spec/unit/indirector/indirection_spec.rb +8 -12
- data/spec/unit/indirector/json_spec.rb +8 -8
- data/spec/unit/indirector/key/file_spec.rb +0 -1
- data/spec/unit/indirector/msgpack_spec.rb +8 -8
- data/spec/unit/indirector/node/json_spec.rb +33 -0
- data/spec/unit/indirector/node/rest_spec.rb +1 -1
- data/spec/{integration/indirector/report/yaml.rb → unit/indirector/report/json_spec.rb} +13 -24
- data/spec/unit/indirector/report/yaml_spec.rb +72 -8
- data/spec/unit/indirector/request_spec.rb +4 -4
- data/spec/unit/indirector/rest_spec.rb +1 -1
- data/spec/unit/indirector/status/rest_spec.rb +1 -1
- data/spec/unit/indirector/yaml_spec.rb +7 -7
- data/spec/unit/indirector_spec.rb +2 -2
- data/spec/unit/module_tool/applications/installer_spec.rb +66 -0
- data/spec/unit/network/authconfig_spec.rb +0 -3
- data/spec/unit/network/http/api/indirected_routes_spec.rb +0 -9
- data/spec/unit/network/http/api/master/v3/environments_spec.rb +12 -23
- data/spec/unit/network/http/handler_spec.rb +0 -5
- data/spec/unit/parser/compiler_spec.rb +3 -19
- data/spec/unit/parser/resource_spec.rb +14 -8
- data/spec/unit/parser/templatewrapper_spec.rb +4 -3
- data/spec/unit/pops/evaluator/deferred_resolver_spec.rb +20 -0
- data/spec/unit/property_spec.rb +1 -0
- data/spec/unit/provider/exec_spec.rb +4 -3
- data/spec/unit/provider/group/groupadd_spec.rb +5 -2
- data/spec/unit/provider/nameservice_spec.rb +66 -65
- data/spec/unit/provider/package/apt_spec.rb +28 -23
- data/spec/unit/provider/package/aptitude_spec.rb +1 -1
- data/spec/unit/provider/package/base_spec.rb +6 -5
- data/spec/unit/provider/package/dpkg_spec.rb +22 -7
- data/spec/unit/provider/package/openbsd_spec.rb +2 -0
- data/spec/unit/provider/package/pacman_spec.rb +18 -12
- data/spec/unit/provider/package/pip2_spec.rb +36 -0
- data/spec/unit/provider/package/pip_spec.rb +6 -11
- data/spec/unit/provider/package/pkgdmg_spec.rb +0 -4
- data/spec/unit/provider/package/puppetserver_gem_spec.rb +137 -0
- data/spec/unit/provider/package/yum_spec.rb +31 -0
- data/spec/unit/provider/service/base_spec.rb +2 -4
- data/spec/unit/provider/service/bsd_spec.rb +5 -1
- data/spec/unit/provider/service/daemontools_spec.rb +1 -1
- data/spec/unit/provider/service/debian_spec.rb +3 -5
- data/spec/unit/provider/service/freebsd_spec.rb +1 -1
- data/spec/unit/provider/service/gentoo_spec.rb +4 -5
- data/spec/unit/provider/service/init_spec.rb +4 -5
- data/spec/unit/provider/service/launchd_spec.rb +5 -6
- data/spec/unit/provider/service/openrc_spec.rb +4 -5
- data/spec/unit/provider/service/openwrt_spec.rb +1 -1
- data/spec/unit/provider/service/redhat_spec.rb +1 -1
- data/spec/unit/provider/service/runit_spec.rb +2 -1
- data/spec/unit/provider/service/smf_spec.rb +1 -1
- data/spec/unit/provider/service/src_spec.rb +3 -5
- data/spec/unit/provider/service/systemd_spec.rb +3 -1
- data/spec/unit/provider/service/upstart_spec.rb +4 -5
- data/spec/unit/provider/user/aix_spec.rb +5 -0
- data/spec/unit/provider/user/hpux_spec.rb +1 -1
- data/spec/unit/provider/user/pw_spec.rb +2 -0
- data/spec/unit/provider/user/useradd_spec.rb +56 -3
- data/spec/unit/provider_spec.rb +8 -10
- data/spec/unit/puppet_pal_catalog_spec.rb +45 -0
- data/spec/unit/resource/capability_finder_spec.rb +6 -1
- data/spec/unit/resource/type_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +11 -10
- data/spec/unit/rest/route_spec.rb +4 -4
- data/spec/unit/settings_spec.rb +576 -239
- data/spec/unit/ssl/base_spec.rb +0 -1
- data/spec/unit/ssl/host_spec.rb +0 -5
- data/spec/unit/ssl/ssl_provider_spec.rb +14 -8
- data/spec/unit/transaction/additional_resource_generator_spec.rb +3 -7
- data/spec/unit/transaction/event_manager_spec.rb +14 -11
- data/spec/unit/transaction/report_spec.rb +2 -0
- data/spec/unit/transaction_spec.rb +13 -4
- data/spec/unit/type/file/content_spec.rb +0 -1
- data/spec/unit/type/file/selinux_spec.rb +0 -2
- data/spec/unit/type/file/source_spec.rb +1 -1
- data/spec/unit/type/file_spec.rb +0 -6
- data/spec/unit/type/filebucket_spec.rb +1 -1
- data/spec/unit/type/group_spec.rb +13 -6
- data/spec/unit/type/resources_spec.rb +7 -7
- data/spec/unit/type/service_spec.rb +1 -1
- data/spec/unit/type/tidy_spec.rb +0 -1
- data/spec/unit/type_spec.rb +2 -2
- data/spec/unit/util/at_fork_spec.rb +2 -2
- data/spec/unit/util/autoload_spec.rb +5 -1
- data/spec/unit/util/backups_spec.rb +1 -2
- data/spec/unit/util/execution_spec.rb +15 -11
- data/spec/unit/util/inifile_spec.rb +6 -14
- data/spec/unit/util/log_spec.rb +8 -7
- data/spec/unit/util/logging_spec.rb +3 -3
- data/spec/unit/util/posix_spec.rb +363 -15
- data/spec/unit/util/rubygems_spec.rb +2 -2
- data/spec/unit/util/run_mode_spec.rb +6 -6
- data/spec/unit/util/selinux_spec.rb +76 -52
- data/spec/unit/util/storage_spec.rb +3 -1
- data/spec/unit/util/suidmanager_spec.rb +44 -41
- data/spec/unit/util_spec.rb +13 -6
- metadata +32 -10
- data/spec/integration/application/config_spec.rb +0 -74
- data/spec/unit/face/catalog_spec.rb +0 -6
- data/spec/unit/face/module_spec.rb +0 -3
@@ -74,7 +74,7 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
|
|
74
74
|
elsif ['config-files', 'half-installed', 'unpacked', 'half-configured'].include?(hash[:status])
|
75
75
|
hash[:ensure] = :absent
|
76
76
|
end
|
77
|
-
hash[:mark] =
|
77
|
+
hash[:mark] = hash[:desired] == 'hold' ? :hold : :none
|
78
78
|
else
|
79
79
|
Puppet.debug("Failed to match dpkg-query line #{line.inspect}")
|
80
80
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Puppet package provider for Python's `pip2` package management frontend.
|
2
|
+
# <http://pip.pypa.io/>
|
3
|
+
|
4
|
+
Puppet::Type.type(:package).provide :pip2,
|
5
|
+
:parent => :pip do
|
6
|
+
|
7
|
+
desc "Python packages via `pip2`.
|
8
|
+
|
9
|
+
This provider supports the `install_options` attribute, which allows command-line flags to be passed to pip2.
|
10
|
+
These options should be specified as an array where each element is either a string or a hash."
|
11
|
+
|
12
|
+
has_feature :installable, :uninstallable, :upgradeable, :versionable, :install_options, :targetable
|
13
|
+
|
14
|
+
def self.cmd
|
15
|
+
["pip2"]
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,180 @@
|
|
1
|
+
unless Puppet::Util::Platform.jruby_fips?
|
2
|
+
require 'rubygems/commands/list_command'
|
3
|
+
end
|
4
|
+
require 'stringio'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
# Ruby gems support.
|
8
|
+
Puppet::Type.type(:package).provide :puppetserver_gem, :parent => :gem do
|
9
|
+
desc "Puppet Server Ruby Gem support. If a URL is passed via `source`, then
|
10
|
+
that URL is appended to the list of remote gem repositories which by default
|
11
|
+
contains rubygems.org; To ensure that only the specified source is used also
|
12
|
+
pass `--clear-sources` in via `install_options`; if a source is present but
|
13
|
+
is not a valid URL, it will be interpreted as the path to a local gem file.
|
14
|
+
If source is not present at all, the gem will be installed from the default
|
15
|
+
gem repositories."
|
16
|
+
|
17
|
+
has_feature :versionable, :install_options, :uninstall_options
|
18
|
+
|
19
|
+
confine :feature => :hocon
|
20
|
+
# see SERVER-2578
|
21
|
+
confine :fips_enabled => false
|
22
|
+
|
23
|
+
# Define the default provider package command name, as the parent 'gem' provider is targetable.
|
24
|
+
# Required by Puppet::Provider::Package::Targetable::resource_or_provider_command
|
25
|
+
|
26
|
+
def self.provider_command
|
27
|
+
command(:puppetservercmd)
|
28
|
+
end
|
29
|
+
|
30
|
+
# The gem command uses HOME to locate a gemrc file.
|
31
|
+
# CommandDefiner in provider.rb will set failonfail, combine, and environment.
|
32
|
+
|
33
|
+
has_command(:puppetservercmd, '/opt/puppetlabs/bin/puppetserver') do
|
34
|
+
environment(HOME: ENV['HOME'])
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.gemlist(options)
|
38
|
+
command_options = ['gem', 'list']
|
39
|
+
|
40
|
+
if options[:local]
|
41
|
+
command_options << '--local'
|
42
|
+
else
|
43
|
+
command_options << '--remote'
|
44
|
+
end
|
45
|
+
|
46
|
+
if options[:source]
|
47
|
+
command_options << '--source' << options[:source]
|
48
|
+
end
|
49
|
+
|
50
|
+
if options[:justme]
|
51
|
+
gem_regex = '\A' + options[:justme] + '\z'
|
52
|
+
command_options << gem_regex
|
53
|
+
end
|
54
|
+
|
55
|
+
if options[:local]
|
56
|
+
list = execute_rubygems_list_command(gem_regex)
|
57
|
+
else
|
58
|
+
begin
|
59
|
+
list = puppetservercmd(command_options)
|
60
|
+
rescue Puppet::ExecutionFailure => detail
|
61
|
+
raise Puppet::Error, _("Could not list gems: %{detail}") % { detail: detail }, detail.backtrace
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# When `/tmp` is mounted `noexec`, `puppetserver gem list` will output:
|
66
|
+
# *** LOCAL GEMS ***
|
67
|
+
# causing gemsplit to output:
|
68
|
+
# Warning: Could not match *** LOCAL GEMS ***
|
69
|
+
gem_list = list
|
70
|
+
.lines
|
71
|
+
.select { |x| x =~ /^(\S+)\s+\((.+)\)/ }
|
72
|
+
.map { |set| gemsplit(set) }
|
73
|
+
|
74
|
+
if options[:justme]
|
75
|
+
return gem_list.shift
|
76
|
+
else
|
77
|
+
return gem_list
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def install(useversion = true)
|
82
|
+
command_options = ['gem', 'install']
|
83
|
+
command_options += install_options if resource[:install_options]
|
84
|
+
|
85
|
+
command_options << '-v' << resource[:ensure] if (!resource[:ensure].is_a? Symbol) && useversion
|
86
|
+
|
87
|
+
command_options << '--no-document'
|
88
|
+
|
89
|
+
if resource[:source]
|
90
|
+
begin
|
91
|
+
uri = URI.parse(resource[:source])
|
92
|
+
rescue => detail
|
93
|
+
self.fail Puppet::Error, _("Invalid source '%{uri}': %{detail}") % { uri: uri, detail: detail }, detail
|
94
|
+
end
|
95
|
+
|
96
|
+
case uri.scheme
|
97
|
+
when nil
|
98
|
+
# no URI scheme => interpret the source as a local file
|
99
|
+
command_options << resource[:source]
|
100
|
+
when /file/i
|
101
|
+
command_options << uri.path
|
102
|
+
when 'puppet'
|
103
|
+
# we don't support puppet:// URLs (yet)
|
104
|
+
raise Puppet::Error.new(_('puppet:// URLs are not supported as gem sources'))
|
105
|
+
else
|
106
|
+
# interpret it as a gem repository
|
107
|
+
command_options << '--source' << "#{resource[:source]}" << resource[:name]
|
108
|
+
end
|
109
|
+
else
|
110
|
+
command_options << resource[:name]
|
111
|
+
end
|
112
|
+
|
113
|
+
output = puppetservercmd(command_options)
|
114
|
+
# Apparently, some gem versions don't exit non-0 on failure.
|
115
|
+
self.fail _("Could not install: %{output}") % { output: output.chomp } if output.include?('ERROR')
|
116
|
+
end
|
117
|
+
|
118
|
+
def uninstall
|
119
|
+
command_options = ['gem', 'uninstall']
|
120
|
+
command_options << '--executables' << '--all' << resource[:name]
|
121
|
+
command_options += uninstall_options if resource[:uninstall_options]
|
122
|
+
|
123
|
+
output = puppetservercmd(command_options)
|
124
|
+
# Apparently, some gem versions don't exit non-0 on failure.
|
125
|
+
self.fail _("Could not uninstall: %{output}") % { output: output.chomp } if output.include?('ERROR')
|
126
|
+
end
|
127
|
+
|
128
|
+
private
|
129
|
+
|
130
|
+
# The puppetserver gem cli command is very slow, since it starts a JVM.
|
131
|
+
#
|
132
|
+
# Instead, for the list subcommand (which is executed with every puppet run),
|
133
|
+
# use the rubygems library from puppet ruby: setting GEM_HOME and GEM_PATH
|
134
|
+
# to the default values, or the values in the puppetserver configuration file.
|
135
|
+
#
|
136
|
+
# The rubygems library cannot access java platform gems,
|
137
|
+
# for example: json (1.8.3 java)
|
138
|
+
# but java platform gems should not be managed by this (or any) provider.
|
139
|
+
|
140
|
+
def self.execute_rubygems_list_command(gem_regex)
|
141
|
+
puppetserver_default_gem_home = '/opt/puppetlabs/server/data/puppetserver/jruby-gems'
|
142
|
+
puppetserver_default_vendored_jruby_gems = '/opt/puppetlabs/server/data/puppetserver/vendored-jruby-gems'
|
143
|
+
puppet_default_vendor_gems = '/opt/puppetlabs/puppet/lib/ruby/vendor_gems'
|
144
|
+
puppetserver_default_gem_path = [puppetserver_default_gem_home, puppetserver_default_vendored_jruby_gems, puppet_default_vendor_gems].join(':')
|
145
|
+
|
146
|
+
pe_puppetserver_conf_file = '/etc/puppetlabs/puppetserver/conf.d/pe-puppet-server.conf'
|
147
|
+
os_puppetserver_conf_file = '/etc/puppetlabs/puppetserver/puppetserver.conf'
|
148
|
+
puppetserver_conf_file = Facter.value(:pe_server_version) ? pe_puppetserver_conf_file : os_puppetserver_conf_file
|
149
|
+
puppetserver_conf = Hocon.load(puppetserver_conf_file)
|
150
|
+
|
151
|
+
gem_env = {}
|
152
|
+
if puppetserver_conf.empty? || puppetserver_conf.key?('jruby-puppet') == false
|
153
|
+
gem_env['GEM_HOME'] = puppetserver_default_gem_home
|
154
|
+
gem_env['GEM_PATH'] = puppetserver_default_gem_path
|
155
|
+
else
|
156
|
+
gem_env['GEM_HOME'] = puppetserver_conf['jruby-puppet'].key?('gem-home') ? puppetserver_conf['jruby-puppet']['gem-home'] : puppetserver_default_gem_home
|
157
|
+
gem_env['GEM_PATH'] = puppetserver_conf['jruby-puppet'].key?('gem-path') ? puppetserver_conf['jruby-puppet']['gem-path'].join(':') : puppetserver_default_gem_path
|
158
|
+
end
|
159
|
+
gem_env['GEM_SPEC_CACHE'] = "/tmp/#{$$}"
|
160
|
+
Gem.paths = gem_env
|
161
|
+
|
162
|
+
sio_inn = StringIO.new
|
163
|
+
sio_out = StringIO.new
|
164
|
+
sio_err = StringIO.new
|
165
|
+
stream_ui = Gem::StreamUI.new(sio_inn, sio_out, sio_err, false)
|
166
|
+
gem_list_cmd = Gem::Commands::ListCommand.new
|
167
|
+
gem_list_cmd.options[:domain] = :local
|
168
|
+
gem_list_cmd.options[:args] = [gem_regex] if gem_regex
|
169
|
+
gem_list_cmd.ui = stream_ui
|
170
|
+
gem_list_cmd.execute
|
171
|
+
|
172
|
+
# There is no method exclude default gems from the local gem list,
|
173
|
+
# for example: psych (default: 2.2.2)
|
174
|
+
# but default gems should not be managed by this (or any) provider.
|
175
|
+
gem_list = sio_out.string.lines.reject { |gem| gem =~ / \(default\: / }
|
176
|
+
gem_list.join("\n")
|
177
|
+
ensure
|
178
|
+
Gem.clear_paths
|
179
|
+
end
|
180
|
+
end
|
@@ -328,6 +328,7 @@ defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a
|
|
328
328
|
return "#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}"
|
329
329
|
else
|
330
330
|
# Yum didn't find updates, pretend the current version is the latest
|
331
|
+
self.debug "Yum didn't find updates, current version (#{properties[:ensure]}) is the latest"
|
331
332
|
version = properties[:ensure]
|
332
333
|
raise Puppet::DevError, _("Tried to get latest on a missing package") if version == :absent || version == :purged
|
333
334
|
return version
|
@@ -17,6 +17,8 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
|
|
17
17
|
commands :invoke_rc => "/usr/sbin/invoke-rc.d"
|
18
18
|
commands :service => "/usr/sbin/service"
|
19
19
|
|
20
|
+
confine :false => Puppet::FileSystem.exist?('/proc/1/comm') && Puppet::FileSystem.read('/proc/1/comm').include?('systemd')
|
21
|
+
|
20
22
|
defaultfor :operatingsystem => :cumuluslinux, :operatingsystemmajrelease => ['1','2']
|
21
23
|
defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ['5','6','7']
|
22
24
|
defaultfor :operatingsystem => :devuan
|
@@ -178,7 +178,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
|
|
178
178
|
# does not have a password.
|
179
179
|
break if line =~ /^\S+:$/
|
180
180
|
|
181
|
-
match_obj = /password
|
181
|
+
match_obj = /password\s+=\s+(\S+)/.match(line)
|
182
182
|
end
|
183
183
|
return :absent unless match_obj
|
184
184
|
|
@@ -211,7 +211,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
|
|
211
211
|
tempfile = Tempfile.new("puppet_#{user}_pw", :encoding => Encoding::ASCII)
|
212
212
|
tempfile << "#{user}:#{value}\n"
|
213
213
|
tempfile.close()
|
214
|
-
|
214
|
+
|
215
215
|
# Options '-e', '-c', use encrypted password and clear flags
|
216
216
|
# Must receive "user:enc_password" as input
|
217
217
|
# command, arguments = {:failonfail => true, :combine => true}
|
@@ -59,23 +59,37 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
|
|
59
59
|
get(:uid)
|
60
60
|
end
|
61
61
|
|
62
|
+
def gid
|
63
|
+
return localgid if @resource.forcelocal?
|
64
|
+
get(:gid)
|
65
|
+
end
|
66
|
+
|
62
67
|
def comment
|
63
68
|
return localcomment if @resource.forcelocal?
|
64
69
|
get(:comment)
|
65
70
|
end
|
66
71
|
|
72
|
+
def groups
|
73
|
+
return localgroups if @resource.forcelocal?
|
74
|
+
super
|
75
|
+
end
|
76
|
+
|
67
77
|
def finduser(key, value)
|
68
|
-
passwd_file =
|
78
|
+
passwd_file = '/etc/passwd'
|
69
79
|
passwd_keys = [:account, :password, :uid, :gid, :gecos, :directory, :shell]
|
70
|
-
|
71
|
-
@
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
80
|
+
|
81
|
+
unless @users
|
82
|
+
unless Puppet::FileSystem.exist?(passwd_file)
|
83
|
+
raise Puppet::Error.new("Forcelocal set for user resource '#{resource[:name]}', but #{passwd_file} does not exist")
|
84
|
+
end
|
85
|
+
|
86
|
+
@users = []
|
87
|
+
Puppet::FileSystem.each_line(passwd_file) do |line|
|
88
|
+
user = line.chomp.split(':')
|
89
|
+
@users << Hash[passwd_keys.zip(user)]
|
76
90
|
end
|
77
91
|
end
|
78
|
-
false
|
92
|
+
@users.find { |param| param[key] == value } || false
|
79
93
|
end
|
80
94
|
|
81
95
|
def local_username
|
@@ -88,16 +102,56 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
|
|
88
102
|
false
|
89
103
|
end
|
90
104
|
|
105
|
+
def localgid
|
106
|
+
user = finduser(:account, resource[:name])
|
107
|
+
if user
|
108
|
+
begin
|
109
|
+
return Integer(user[:gid])
|
110
|
+
rescue ArgumentError
|
111
|
+
Puppet.debug("Non-numeric GID found in /etc/passwd for user #{resource[:name]}")
|
112
|
+
return user[:gid]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
false
|
116
|
+
end
|
117
|
+
|
91
118
|
def localcomment
|
92
119
|
user = finduser(:account, resource[:name])
|
93
120
|
user[:gecos]
|
94
121
|
end
|
95
122
|
|
123
|
+
def localgroups
|
124
|
+
@groups_of ||= {}
|
125
|
+
group_file = '/etc/group'
|
126
|
+
user = resource[:name]
|
127
|
+
|
128
|
+
return @groups_of[user] if @groups_of[user]
|
129
|
+
|
130
|
+
@groups_of[user] = []
|
131
|
+
|
132
|
+
unless Puppet::FileSystem.exist?(group_file)
|
133
|
+
raise Puppet::Error.new("Forcelocal set for user resource '#{user}', but #{group_file} does not exist")
|
134
|
+
end
|
135
|
+
|
136
|
+
Puppet::FileSystem.each_line(group_file) do |line|
|
137
|
+
data = line.chomp.split(':')
|
138
|
+
if data.last.split(',').include?(user)
|
139
|
+
@groups_of[user] << data.first
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
@groups_of[user]
|
144
|
+
end
|
145
|
+
|
96
146
|
def shell=(value)
|
97
147
|
check_valid_shell
|
98
148
|
set(:shell, value)
|
99
149
|
end
|
100
150
|
|
151
|
+
def groups=(value)
|
152
|
+
set(:groups, value)
|
153
|
+
end
|
154
|
+
|
101
155
|
verify :gid, "GID must be an integer" do |value|
|
102
156
|
value.is_a? Integer
|
103
157
|
end
|
@@ -55,11 +55,12 @@ config.header = <<EOT
|
|
55
55
|
* Each of these settings can be specified in `puppet.conf` or on the
|
56
56
|
command line.
|
57
57
|
* Puppet Enterprise (PE) and open source Puppet share the configuration settings
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
documented here. However, PE defaults differ from open source defaults for some
|
59
|
+
settings, such as `node_terminus`, `storeconfigs`, `always_retry_plugins`,
|
60
|
+
`disable18n`, `environment_timeout` (when Code Manager is enabled), and the
|
61
|
+
Puppet Server JRuby `max-active-instances` setting. To verify PE configuration
|
62
|
+
defaults, check the `puppet.conf` or `pe-puppet-server.conf` file after
|
63
|
+
installation.
|
63
64
|
* When using boolean settings on the command line, use `--setting` and
|
64
65
|
`--no-setting` instead of `--setting (true|false)`. (Using `--setting false`
|
65
66
|
results in "Error: Could not parse application options: needless argument".)
|
data/lib/puppet/resource/type.rb
CHANGED
@@ -34,7 +34,7 @@ class Puppet::Resource::Type
|
|
34
34
|
DOUBLE_COLON = '::'.freeze
|
35
35
|
EMPTY_ARRAY = [].freeze
|
36
36
|
|
37
|
-
attr_accessor :file, :line, :doc, :code, :parent, :resource_type_collection
|
37
|
+
attr_accessor :file, :line, :doc, :code, :parent, :resource_type_collection, :override
|
38
38
|
attr_reader :namespace, :arguments, :behaves_like, :module_name
|
39
39
|
|
40
40
|
# The attributes 'produces' and 'consumes' are arrays of the blueprints
|
@@ -63,6 +63,7 @@ class Puppet::Resource::Type
|
|
63
63
|
# Are we a child of the passed class? Do a recursive search up our
|
64
64
|
# parentage tree to figure it out.
|
65
65
|
def child_of?(klass)
|
66
|
+
return true if override
|
66
67
|
return false unless parent
|
67
68
|
|
68
69
|
return(klass == parent_type ? true : parent_type.child_of?(klass))
|
data/lib/puppet/rest/route.rb
CHANGED
@@ -14,11 +14,11 @@ module Puppet::Rest
|
|
14
14
|
# construction
|
15
15
|
# @param [Symbol] server_setting the setting to check for special
|
16
16
|
# server configuration
|
17
|
-
# @param [Symbol] port_setting the setting to check for
|
17
|
+
# @param [Symbol] port_setting the setting to check for special
|
18
18
|
# port configuration
|
19
19
|
# @param [Symbol] srv_service the name of the service when using SRV
|
20
20
|
# records
|
21
|
-
def initialize(api:, server_setting: :server, port_setting: :
|
21
|
+
def initialize(api:, server_setting: :server, port_setting: :serverport, srv_service: :puppet)
|
22
22
|
@api = api
|
23
23
|
@default_server = Puppet::Util::Connection.determine_server(server_setting)
|
24
24
|
@default_port = Puppet::Util::Connection.determine_port(port_setting, server_setting)
|
data/lib/puppet/settings.rb
CHANGED
@@ -32,6 +32,7 @@ class Puppet::Settings
|
|
32
32
|
require 'puppet/settings/server_list_setting'
|
33
33
|
require 'puppet/settings/http_extra_headers_setting'
|
34
34
|
require 'puppet/settings/certificate_revocation_setting'
|
35
|
+
require 'puppet/settings/alias_setting'
|
35
36
|
|
36
37
|
# local reference for convenience
|
37
38
|
PuppetOptionParser = Puppet::Util::CommandLine::PuppetOptionParser
|
@@ -44,7 +45,7 @@ class Puppet::Settings
|
|
44
45
|
REQUIRED_APP_SETTINGS = [:logdir, :confdir, :vardir, :codedir]
|
45
46
|
|
46
47
|
# The acceptable sections of the puppet.conf configuration file.
|
47
|
-
ALLOWED_SECTION_NAMES = ['main', 'master', 'agent', 'user'].freeze
|
48
|
+
ALLOWED_SECTION_NAMES = ['main', 'server', 'master', 'agent', 'user'].freeze
|
48
49
|
|
49
50
|
NONE = 'none'.freeze
|
50
51
|
|
@@ -330,7 +331,7 @@ class Puppet::Settings
|
|
330
331
|
end
|
331
332
|
|
332
333
|
option_parser.on('--run_mode',
|
333
|
-
"The effective 'run mode' of the application:
|
334
|
+
"The effective 'run mode' of the application: server, agent, or user.",
|
334
335
|
:REQUIRED) do |arg|
|
335
336
|
Puppet.settings.preferred_run_mode = arg
|
336
337
|
end
|
@@ -564,7 +565,7 @@ class Puppet::Settings
|
|
564
565
|
# @api private
|
565
566
|
def preferred_run_mode=(mode)
|
566
567
|
mode = mode.to_s.downcase.intern
|
567
|
-
raise ValidationError, "Invalid run mode '#{mode}'" unless [:master, :agent, :user].include?(mode)
|
568
|
+
raise ValidationError, "Invalid run mode '#{mode}'" unless [:server, :master, :agent, :user].include?(mode)
|
568
569
|
@preferred_run_mode_name = mode
|
569
570
|
# Changing the run mode has far-reaching consequences. Flush any cached
|
570
571
|
# settings so they will be re-generated.
|
@@ -659,7 +660,7 @@ class Puppet::Settings
|
|
659
660
|
if explicit_config_file?
|
660
661
|
return self[:config]
|
661
662
|
else
|
662
|
-
return File.join(Puppet::Util::RunMode[:
|
663
|
+
return File.join(Puppet::Util::RunMode[:server].conf_dir, config_file_name)
|
663
664
|
end
|
664
665
|
end
|
665
666
|
private :main_config_file
|
@@ -729,7 +730,8 @@ class Puppet::Settings
|
|
729
730
|
:autosign => AutosignSetting,
|
730
731
|
:server_list => ServerListSetting,
|
731
732
|
:http_extra_headers => HttpExtraHeadersSetting,
|
732
|
-
:certificate_revocation => CertificateRevocationSetting
|
733
|
+
:certificate_revocation => CertificateRevocationSetting,
|
734
|
+
:alias => AliasSetting
|
733
735
|
}
|
734
736
|
|
735
737
|
# Create a new setting. The value is passed in because it's used to determine
|
@@ -829,7 +831,16 @@ class Puppet::Settings
|
|
829
831
|
SearchPathElement.new(:cli, :values),
|
830
832
|
]
|
831
833
|
searchpath << SearchPathElement.new(environment.intern, :environment) if environment
|
832
|
-
|
834
|
+
|
835
|
+
if run_mode
|
836
|
+
if [:master, :server].include?(run_mode)
|
837
|
+
searchpath << SearchPathElement.new(:server, :section)
|
838
|
+
searchpath << SearchPathElement.new(:master, :section)
|
839
|
+
else
|
840
|
+
searchpath << SearchPathElement.new(run_mode, :section)
|
841
|
+
end
|
842
|
+
end
|
843
|
+
|
833
844
|
searchpath << SearchPathElement.new(:main, :section)
|
834
845
|
end
|
835
846
|
|
@@ -907,6 +918,16 @@ class Puppet::Settings
|
|
907
918
|
end
|
908
919
|
end
|
909
920
|
|
921
|
+
# Allow later inspection to determine if the setting was set by user
|
922
|
+
# config, rather than a default setting.
|
923
|
+
def set_in_section?(param, section)
|
924
|
+
param = param.to_sym
|
925
|
+
vals = searchpath_values(SearchPathElement.new(section, :section))
|
926
|
+
if vals
|
927
|
+
vals.lookup(param)
|
928
|
+
end
|
929
|
+
end
|
930
|
+
|
910
931
|
# Patches the value for a param in a section.
|
911
932
|
# This method is required to support the use case of unifying --dns-alt-names and
|
912
933
|
# --dns_alt_names in the certificate face. Ideally this should be cleaned up.
|
@@ -1053,6 +1074,11 @@ Generated on #{Time.now}.
|
|
1053
1074
|
# Create the necessary objects to use a section. This is idempotent;
|
1054
1075
|
# you can 'use' a section as many times as you want.
|
1055
1076
|
def use(*sections)
|
1077
|
+
Puppet.warning(":master section deprecated in favor of :server section") if sections.include?(:master)
|
1078
|
+
|
1079
|
+
# add :server if sections include :master or :master if sections include :server
|
1080
|
+
sections |= [:master, :server] if (sections & [:master, :server]).any?
|
1081
|
+
|
1056
1082
|
sections = sections.collect { |s| s.to_sym }
|
1057
1083
|
sections = sections.reject { |s| @used.include?(s) }
|
1058
1084
|
|
@@ -1236,27 +1262,37 @@ Generated on #{Time.now}.
|
|
1236
1262
|
end
|
1237
1263
|
|
1238
1264
|
def add_environment_resources(catalog, sections)
|
1239
|
-
path = self[:environmentpath]
|
1240
|
-
envdir = path.split(File::PATH_SEPARATOR).first if path
|
1241
1265
|
configured_environment = self[:environment]
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1266
|
+
|
1267
|
+
if configured_environment == "production" && !production_environment_exists?
|
1268
|
+
environment_path = self[:environmentpath]
|
1269
|
+
first_environment_path = environment_path.split(File::PATH_SEPARATOR).first
|
1270
|
+
|
1271
|
+
if Puppet::FileSystem.exist?(first_environment_path)
|
1272
|
+
production_environment_path = File.join(first_environment_path, configured_environment)
|
1247
1273
|
parameters = { :ensure => 'directory' }
|
1248
|
-
|
1249
|
-
|
1250
|
-
if
|
1251
|
-
|
1252
|
-
parameters[:group] = Puppet[:group] if service_group_available?
|
1253
|
-
end
|
1274
|
+
parameters[:mode] = '0750'
|
1275
|
+
if Puppet.features.root?
|
1276
|
+
parameters[:owner] = Puppet[:user] if service_user_available?
|
1277
|
+
parameters[:group] = Puppet[:group] if service_group_available?
|
1254
1278
|
end
|
1255
|
-
catalog.add_resource(Puppet::Resource.new(:file,
|
1279
|
+
catalog.add_resource(Puppet::Resource.new(:file, production_environment_path, :parameters => parameters))
|
1256
1280
|
end
|
1257
1281
|
end
|
1258
1282
|
end
|
1259
1283
|
|
1284
|
+
def production_environment_exists?
|
1285
|
+
environment_path = self[:environmentpath]
|
1286
|
+
paths = environment_path.split(File::PATH_SEPARATOR)
|
1287
|
+
|
1288
|
+
paths.any? do |path|
|
1289
|
+
# If expected_path is a symlink, assume the source path is being managed
|
1290
|
+
# elsewhere, so accept it also as a valid production environment path
|
1291
|
+
expected_path = File.join(path, 'production')
|
1292
|
+
Puppet::FileSystem.directory?(expected_path) || Puppet::FileSystem.symlink?(expected_path)
|
1293
|
+
end
|
1294
|
+
end
|
1295
|
+
|
1260
1296
|
def add_user_resources(catalog, sections)
|
1261
1297
|
return unless Puppet.features.root?
|
1262
1298
|
return if Puppet::Util::Platform.windows?
|
@@ -1357,6 +1393,12 @@ Generated on #{Time.now}.
|
|
1357
1393
|
end
|
1358
1394
|
end
|
1359
1395
|
|
1396
|
+
setting = @defaults[name]
|
1397
|
+
if setting.respond_to?(:alias_name)
|
1398
|
+
val = lookup(setting.alias_name)
|
1399
|
+
return val if val
|
1400
|
+
end
|
1401
|
+
|
1360
1402
|
@defaults[name].default
|
1361
1403
|
end
|
1362
1404
|
|