puppet 8.7.0-universal-darwin → 8.9.0-universal-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/Gemfile.lock +57 -43
- data/ext/project_data.yaml +12 -0
- data/ext/windows/service/daemon.rb +9 -2
- data/install.rb +3 -74
- data/lib/puppet/application/apply.rb +1 -0
- data/lib/puppet/application/doc.rb +1 -5
- data/lib/puppet/application/filebucket.rb +6 -4
- data/lib/puppet/application/lookup.rb +2 -0
- data/lib/puppet/application/ssl.rb +4 -4
- data/lib/puppet/daemon.rb +0 -1
- data/lib/puppet/defaults.rb +67 -71
- data/lib/puppet/face/catalog.rb +24 -8
- data/lib/puppet/face/help.rb +43 -23
- data/lib/puppet/file_serving/http_metadata.rb +2 -0
- data/lib/puppet/functions/capitalize.rb +1 -1
- data/lib/puppet/functions/find_file.rb +4 -0
- data/lib/puppet/functions/hiera.rb +1 -0
- data/lib/puppet/functions/index.rb +2 -2
- data/lib/puppet/functions/lookup.rb +1 -1
- data/lib/puppet/functions/new.rb +1 -1
- data/lib/puppet/functions/regsubst.rb +11 -14
- data/lib/puppet/functions/unique.rb +3 -2
- data/lib/puppet/functions/yaml_data.rb +1 -0
- data/lib/puppet/indirector/catalog/compiler.rb +2 -35
- data/lib/puppet/interface/action_manager.rb +1 -1
- data/lib/puppet/module_tool/tar/gnu.rb +10 -8
- data/lib/puppet/node/server_facts.rb +43 -0
- data/lib/puppet/parser/functions/generate.rb +2 -1
- data/lib/puppet/pops/evaluator/deferred_resolver.rb +41 -6
- data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +0 -6
- data/lib/puppet/provider/file/posix.rb +16 -2
- data/lib/puppet/provider/package/gem.rb +1 -0
- data/lib/puppet/provider/package/pacman.rb +9 -10
- data/lib/puppet/provider/package/pkgutil.rb +6 -5
- data/lib/puppet/provider/package/puppet_gem.rb +4 -15
- data/lib/puppet/reference/configuration.rb +6 -1
- data/lib/puppet/resource/type.rb +15 -1
- data/lib/puppet/scheduler/splay_job.rb +0 -9
- data/lib/puppet/settings.rb +2 -2
- data/lib/puppet/transaction/resource_harness.rb +7 -3
- data/lib/puppet/type/exec.rb +3 -4
- data/lib/puppet/type/file/checksum.rb +4 -2
- data/lib/puppet/type/file/ctime.rb +2 -2
- data/lib/puppet/type/file/mtime.rb +2 -2
- data/lib/puppet/type/file/selcontext.rb +8 -7
- data/lib/puppet/type/file/target.rb +9 -11
- data/lib/puppet/type/package.rb +4 -3
- data/lib/puppet/type/user.rb +1 -1
- data/lib/puppet/util/checksums.rb +1 -0
- data/lib/puppet/util/execution.rb +1 -1
- data/lib/puppet/util/profiler/aggregate.rb +2 -2
- data/lib/puppet/util/profiler/wall_clock.rb +2 -2
- data/lib/puppet/util/reference.rb +1 -31
- data/lib/puppet/util/run_mode.rb +40 -0
- data/lib/puppet/util/selinux.rb +38 -16
- data/lib/puppet/util/windows/daemon.rb +15 -32
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +141 -145
- data/man/man5/puppet.conf.5 +18 -18
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +2 -1
- data/man/man8/puppet-catalog.8 +5 -2
- 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 +10 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-lookup.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 +3 -3
- data/man/man8/puppet.8 +128 -9
- metadata +44 -29
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Puppet::Node::ServerFacts
|
4
|
+
def self.load
|
5
|
+
server_facts = {}
|
6
|
+
|
7
|
+
# Add our server Puppet Enterprise version, if available.
|
8
|
+
pe_version_file = '/opt/puppetlabs/server/pe_version'
|
9
|
+
if File.readable?(pe_version_file) and !File.zero?(pe_version_file)
|
10
|
+
server_facts['pe_serverversion'] = File.read(pe_version_file).chomp
|
11
|
+
end
|
12
|
+
|
13
|
+
# Add our server version to the fact list
|
14
|
+
server_facts["serverversion"] = Puppet.version.to_s
|
15
|
+
|
16
|
+
# And then add the server name and IP
|
17
|
+
{ "servername" => "networking.fqdn",
|
18
|
+
"serverip" => "networking.ip",
|
19
|
+
"serverip6" => "networking.ip6" }.each do |var, fact|
|
20
|
+
value = Puppet.runtime[:facter].value(fact)
|
21
|
+
unless value.nil?
|
22
|
+
server_facts[var] = value
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
if server_facts["servername"].nil?
|
27
|
+
host = Puppet.runtime[:facter].value('networking.hostname')
|
28
|
+
if host.nil?
|
29
|
+
Puppet.warning _("Could not retrieve fact servername")
|
30
|
+
elsif domain = Puppet.runtime[:facter].value('networking.domain') # rubocop:disable Lint/AssignmentInCondition
|
31
|
+
server_facts["servername"] = [host, domain].join(".")
|
32
|
+
else
|
33
|
+
server_facts["servername"] = host
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
if server_facts["serverip"].nil? && server_facts["serverip6"].nil?
|
38
|
+
Puppet.warning _("Could not retrieve either serverip or serverip6 fact")
|
39
|
+
end
|
40
|
+
|
41
|
+
server_facts
|
42
|
+
end
|
43
|
+
end
|
@@ -31,7 +31,8 @@ Puppet::Parser::Functions.newfunction(:generate, :arity => -2, :type => :rvalue,
|
|
31
31
|
end
|
32
32
|
|
33
33
|
begin
|
34
|
-
|
34
|
+
dir = File.dirname(args[0])
|
35
|
+
Puppet::Util::Execution.execute(args, failonfail: true, combine: true, cwd: dir).to_str
|
35
36
|
rescue Puppet::ExecutionFailure => detail
|
36
37
|
raise Puppet::ParseError, _("Failed to execute generator %{generator}: %{detail}") % { generator: args[0], detail: detail }, detail.backtrace
|
37
38
|
end
|
@@ -89,17 +89,25 @@ class DeferredResolver
|
|
89
89
|
overrides = {}
|
90
90
|
r.parameters.each_pair do |k, v|
|
91
91
|
resolved = resolve(v)
|
92
|
-
# If the value is instance of Sensitive - assign the unwrapped value
|
93
|
-
# and mark it as sensitive if not already marked
|
94
|
-
#
|
95
92
|
case resolved
|
96
93
|
when Puppet::Pops::Types::PSensitiveType::Sensitive
|
94
|
+
# If the resolved value is instance of Sensitive - assign the unwrapped value
|
95
|
+
# and mark it as sensitive if not already marked
|
96
|
+
#
|
97
97
|
resolved = resolved.unwrap
|
98
98
|
mark_sensitive_parameters(r, k)
|
99
|
-
|
100
|
-
# The DeferredValue.resolve method will unwrap it during catalog application
|
99
|
+
|
101
100
|
when Puppet::Pops::Evaluator::DeferredValue
|
102
|
-
|
101
|
+
# If the resolved value is a DeferredValue and it has an argument of type
|
102
|
+
# PSensitiveType, mark it as sensitive. Since DeferredValues can nest,
|
103
|
+
# we must walk all arguments, e.g. the DeferredValue may call the `epp`
|
104
|
+
# function, where one of its arguments is a DeferredValue to call the
|
105
|
+
# `vault:lookup` function.
|
106
|
+
#
|
107
|
+
# The DeferredValue.resolve method will unwrap the sensitive during
|
108
|
+
# catalog application
|
109
|
+
#
|
110
|
+
if contains_sensitive_args?(v)
|
103
111
|
mark_sensitive_parameters(r, k)
|
104
112
|
end
|
105
113
|
end
|
@@ -109,6 +117,33 @@ class DeferredResolver
|
|
109
117
|
end
|
110
118
|
end
|
111
119
|
|
120
|
+
# Return true if x contains an argument that is an instance of PSensitiveType:
|
121
|
+
#
|
122
|
+
# Deferred('new', [Sensitive, 'password'])
|
123
|
+
#
|
124
|
+
# Or an instance of PSensitiveType::Sensitive:
|
125
|
+
#
|
126
|
+
# Deferred('join', [['a', Sensitive('b')], ':'])
|
127
|
+
#
|
128
|
+
# Since deferred values can nest, descend into Arrays and Hash keys and values,
|
129
|
+
# short-circuiting when the first occurrence is found.
|
130
|
+
#
|
131
|
+
def contains_sensitive_args?(x)
|
132
|
+
case x
|
133
|
+
when @deferred_class
|
134
|
+
contains_sensitive_args?(x.arguments)
|
135
|
+
when Array
|
136
|
+
x.any? { |v| contains_sensitive_args?(v) }
|
137
|
+
when Hash
|
138
|
+
x.any? { |k, v| contains_sensitive_args?(k) || contains_sensitive_args?(v) }
|
139
|
+
when Puppet::Pops::Types::PSensitiveType, Puppet::Pops::Types::PSensitiveType::Sensitive
|
140
|
+
true
|
141
|
+
else
|
142
|
+
false
|
143
|
+
end
|
144
|
+
end
|
145
|
+
private :contains_sensitive_args?
|
146
|
+
|
112
147
|
def mark_sensitive_parameters(r, k)
|
113
148
|
unless r.sensitive_parameters.include?(k.to_sym)
|
114
149
|
r.sensitive_parameters = (r.sensitive_parameters + [k.to_sym]).freeze
|
@@ -76,7 +76,8 @@ module Runtime3ResourceSupport
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def self.resource_to_ptype(resource)
|
79
|
-
nil if resource.nil?
|
79
|
+
return nil if resource.nil?
|
80
|
+
|
80
81
|
# inference returns the meta type since the 3x Resource is an alternate way to describe a type
|
81
82
|
Puppet::Pops::Types::TypeCalculator.singleton().infer(resource).type
|
82
83
|
end
|
@@ -443,12 +443,6 @@ module Runtime3Support
|
|
443
443
|
resource.valid_parameter?(name)
|
444
444
|
end
|
445
445
|
|
446
|
-
def resource_to_ptype(resource)
|
447
|
-
nil if resource.nil?
|
448
|
-
# inference returns the meta type since the 3x Resource is an alternate way to describe a type
|
449
|
-
type_calculator.infer(resource).type
|
450
|
-
end
|
451
|
-
|
452
446
|
# This is the same type of "truth" as used in the current Puppet DSL.
|
453
447
|
#
|
454
448
|
def is_true?(value, o)
|
@@ -12,8 +12,22 @@ Puppet::Type.type(:file).provide :posix do
|
|
12
12
|
require 'etc'
|
13
13
|
require_relative '../../../puppet/util/selinux'
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
class << self
|
16
|
+
def selinux_handle
|
17
|
+
return nil unless Puppet::Util::SELinux.selinux_support?
|
18
|
+
|
19
|
+
# selabel_open takes 3 args: backend, options, and nopt. The backend param
|
20
|
+
# is a constant, SELABEL_CTX_FILE, which happens to be 0. Since options is
|
21
|
+
# nil, nopt can be 0 since nopt represents the # of options specified.
|
22
|
+
@selinux_handle ||= Selinux.selabel_open(Selinux::SELABEL_CTX_FILE, nil, 0)
|
23
|
+
end
|
24
|
+
|
25
|
+
def post_resource_eval
|
26
|
+
if @selinux_handle
|
27
|
+
Selinux.selabel_close(@selinux_handle)
|
28
|
+
@selinux_handle = nil
|
29
|
+
end
|
30
|
+
end
|
17
31
|
end
|
18
32
|
|
19
33
|
def uid2name(id)
|
@@ -83,6 +83,7 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package::
|
|
83
83
|
custom_environment[:PATH] = windows_path_without_puppet_bin
|
84
84
|
end
|
85
85
|
|
86
|
+
# This uses an unusual form of passing the command and args as [<cmd>, [<arg1>, <arg2>, ...]]
|
86
87
|
execute(cmd, { :failonfail => true, :combine => true, :custom_environment => custom_environment })
|
87
88
|
end
|
88
89
|
|
@@ -29,7 +29,7 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
|
|
29
29
|
|
30
30
|
# Checks if a given name is a group
|
31
31
|
def self.group?(name)
|
32
|
-
!pacman(
|
32
|
+
!pacman('--sync', '--groups', name).empty?
|
33
33
|
rescue Puppet::ExecutionFailure
|
34
34
|
# pacman returns an expected non-zero exit code when the name is not a group
|
35
35
|
false
|
@@ -74,7 +74,7 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
|
|
74
74
|
# returns a hash package => version of installed packages
|
75
75
|
def self.get_installed_packages
|
76
76
|
packages = {}
|
77
|
-
execpipe([command(:pacman), "
|
77
|
+
execpipe([command(:pacman), "--query"]) do |pipe|
|
78
78
|
# pacman -Q output is 'packagename version-rel'
|
79
79
|
regex = /^(\S+)\s(\S+)/
|
80
80
|
pipe.each_line do |line|
|
@@ -96,7 +96,7 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
|
|
96
96
|
groups = {}
|
97
97
|
begin
|
98
98
|
# Build a hash of group name => list of packages
|
99
|
-
command = [command(:pacman),
|
99
|
+
command = [command(:pacman), '--sync', '-gg']
|
100
100
|
command << filter if filter
|
101
101
|
execpipe(command) do |pipe|
|
102
102
|
pipe.each_line do |line|
|
@@ -134,14 +134,14 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
|
|
134
134
|
resource_name = @resource[:name]
|
135
135
|
|
136
136
|
# If target is a group, construct the group version
|
137
|
-
return pacman("
|
137
|
+
return pacman("--sync", "--print", "--print-format", "%n %v", resource_name).lines.map(&:chomp).sort.join(', ') if self.class.group?(resource_name)
|
138
138
|
|
139
139
|
# Start by querying with pacman first
|
140
140
|
# If that fails, retry using yaourt against the AUR
|
141
141
|
pacman_check = true
|
142
142
|
begin
|
143
143
|
if pacman_check
|
144
|
-
output = pacman "
|
144
|
+
output = pacman "--sync", "--print", "--print-format", "%v", resource_name
|
145
145
|
output.chomp
|
146
146
|
else
|
147
147
|
output = yaourt "-Qma", resource_name
|
@@ -210,8 +210,8 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
|
|
210
210
|
|
211
211
|
cmd = %w[--noconfirm --noprogressbar]
|
212
212
|
cmd += uninstall_options if @resource[:uninstall_options]
|
213
|
-
cmd << "
|
214
|
-
cmd << '
|
213
|
+
cmd << "--remove"
|
214
|
+
cmd << '--recursive' if is_group
|
215
215
|
cmd << '--nosave' if purge_configs
|
216
216
|
cmd << resource_name
|
217
217
|
|
@@ -248,8 +248,7 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
|
|
248
248
|
else
|
249
249
|
fail _("Source %{source} is not supported by pacman") % { source: source }
|
250
250
|
end
|
251
|
-
pacman "--noconfirm", "--noprogressbar", "
|
252
|
-
pacman "--noconfirm", "--noprogressbar", "-U", source
|
251
|
+
pacman "--noconfirm", "--noprogressbar", "--update", source
|
253
252
|
end
|
254
253
|
|
255
254
|
def install_from_repo
|
@@ -260,7 +259,7 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
|
|
260
259
|
|
261
260
|
cmd = %w[--noconfirm --needed --noprogressbar]
|
262
261
|
cmd += install_options if @resource[:install_options]
|
263
|
-
cmd << "
|
262
|
+
cmd << "--sync" << resource_name
|
264
263
|
|
265
264
|
if self.class.yaourt?
|
266
265
|
yaourt(*cmd)
|
@@ -115,11 +115,12 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
|
|
115
115
|
|
116
116
|
# Identify common types of pkgutil noise as it downloads catalogs etc
|
117
117
|
def self.noise?(line)
|
118
|
-
true if line =~ /^#/
|
119
|
-
true if line =~ /^Checking integrity / # use_gpg
|
120
|
-
true if line =~ /^gpg: / # gpg verification
|
121
|
-
true if line =~ /^=+> / # catalog fetch
|
122
|
-
true if line =~ /\d+:\d+:\d+ URL:/ # wget without -q
|
118
|
+
return true if line =~ /^#/
|
119
|
+
return true if line =~ /^Checking integrity / # use_gpg
|
120
|
+
return true if line =~ /^gpg: / # gpg verification
|
121
|
+
return true if line =~ /^=+> / # catalog fetch
|
122
|
+
return true if line =~ /\d+:\d+:\d+ URL:/ # wget without -q
|
123
|
+
|
123
124
|
false
|
124
125
|
end
|
125
126
|
|
@@ -8,20 +8,7 @@ Puppet::Type.type(:package).provide :puppet_gem, :parent => :gem do
|
|
8
8
|
|
9
9
|
confine :true => Puppet.runtime[:facter].value(:aio_agent_version)
|
10
10
|
|
11
|
-
|
12
|
-
puppet_dir = ENV.fetch('PUPPET_DIR', nil)
|
13
|
-
if puppet_dir
|
14
|
-
File.join(puppet_dir.to_s, 'bin', 'gem.bat')
|
15
|
-
else
|
16
|
-
File.join(Gem.default_bindir, 'gem.bat')
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
if Puppet::Util::Platform.windows?
|
21
|
-
commands :gemcmd => windows_gemcmd
|
22
|
-
else
|
23
|
-
commands :gemcmd => "/opt/puppetlabs/puppet/bin/gem"
|
24
|
-
end
|
11
|
+
commands :gemcmd => Puppet.run_mode.gem_cmd
|
25
12
|
|
26
13
|
def uninstall
|
27
14
|
super
|
@@ -30,7 +17,9 @@ Puppet::Type.type(:package).provide :puppet_gem, :parent => :gem do
|
|
30
17
|
end
|
31
18
|
|
32
19
|
def self.execute_gem_command(command, command_options, custom_environment = {})
|
33
|
-
|
20
|
+
if (pkg_config_path = Puppet.run_mode.pkg_config_path)
|
21
|
+
custom_environment['PKG_CONFIG_PATH'] = pkg_config_path
|
22
|
+
end
|
34
23
|
super(command, command_options, custom_environment)
|
35
24
|
end
|
36
25
|
end
|
@@ -41,8 +41,14 @@ config = Puppet::Util::Reference.newreference(:configuration, :depth => 1, :doc
|
|
41
41
|
val = '$confdir/hiera.yaml. However, for backwards compatibility, if a file exists at $codedir/hiera.yaml, Puppet uses that instead.'
|
42
42
|
when 'certname'
|
43
43
|
val = "the Host's fully qualified domain name, as determined by Facter"
|
44
|
+
when 'hostname'
|
45
|
+
val = "(the system's fully qualified hostname)"
|
46
|
+
when 'domain'
|
47
|
+
val = "(the system's own domain)"
|
44
48
|
when 'srv_domain'
|
45
49
|
val = 'example.com'
|
50
|
+
when 'http_user_agent'
|
51
|
+
val = 'Puppet/<version> Ruby/<version> (<architecture>)'
|
46
52
|
end
|
47
53
|
|
48
54
|
# Leave out the section information; it was apparently confusing people.
|
@@ -95,6 +101,5 @@ config.header = <<~EOT
|
|
95
101
|
|
96
102
|
[confguide]: https://puppet.com/docs/puppet/latest/config_about_settings.html
|
97
103
|
|
98
|
-
* * *
|
99
104
|
|
100
105
|
EOT
|
data/lib/puppet/resource/type.rb
CHANGED
@@ -33,6 +33,16 @@ class Puppet::Resource::Type
|
|
33
33
|
DOUBLE_COLON = '::'
|
34
34
|
EMPTY_ARRAY = [].freeze
|
35
35
|
|
36
|
+
LOOKAROUND_OPERATORS = {
|
37
|
+
"(" => 'LP',
|
38
|
+
"?" => "QU",
|
39
|
+
"<" => "LT",
|
40
|
+
">" => "GT",
|
41
|
+
"!" => "EX",
|
42
|
+
"=" => "EQ",
|
43
|
+
")" => 'RP'
|
44
|
+
}.freeze
|
45
|
+
|
36
46
|
attr_accessor :file, :line, :doc, :code, :parent, :resource_type_collection, :override
|
37
47
|
attr_reader :namespace, :arguments, :behaves_like, :module_name
|
38
48
|
|
@@ -196,7 +206,11 @@ class Puppet::Resource::Type
|
|
196
206
|
|
197
207
|
def name
|
198
208
|
if type == :node && name_is_regex?
|
199
|
-
|
209
|
+
# Normalize lookarround regex patthern
|
210
|
+
internal_name = @name.source.downcase.gsub(/\(\?[^)]*\)/) do |str|
|
211
|
+
str.gsub(/./) { |ch| LOOKAROUND_OPERATORS[ch] || ch }
|
212
|
+
end
|
213
|
+
"__node_regexp__#{internal_name.gsub(/[^-\w:.]/, '').sub(/^\.+/, '')}"
|
200
214
|
else
|
201
215
|
@name
|
202
216
|
end
|
@@ -25,15 +25,6 @@ module Puppet::Scheduler
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
# Recalculates splay.
|
29
|
-
#
|
30
|
-
# @param splay_limit [Integer] the maximum time (in seconds) to delay before an agent's first run.
|
31
|
-
# @return @splay [Integer] a random integer less than or equal to the splay limit that represents the seconds to
|
32
|
-
# delay before next agent run.
|
33
|
-
def splay_limit=(splay_limit)
|
34
|
-
@splay = calculate_splay(splay_limit)
|
35
|
-
end
|
36
|
-
|
37
28
|
private
|
38
29
|
|
39
30
|
def calculate_splay(limit)
|
data/lib/puppet/settings.rb
CHANGED
@@ -81,11 +81,11 @@ class Puppet::Settings
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def self.hostname_fact
|
84
|
-
Puppet.runtime[:facter].value
|
84
|
+
Puppet.runtime[:facter].value('networking.hostname')
|
85
85
|
end
|
86
86
|
|
87
87
|
def self.domain_fact
|
88
|
-
Puppet.runtime[:facter].value
|
88
|
+
Puppet.runtime[:facter].value('networking.domain')
|
89
89
|
end
|
90
90
|
|
91
91
|
def self.default_config_file_name
|
@@ -235,9 +235,13 @@ class Puppet::Transaction::ResourceHarness
|
|
235
235
|
end
|
236
236
|
|
237
237
|
def noop(event, param, current_value, audit_message)
|
238
|
-
|
239
|
-
|
240
|
-
|
238
|
+
if param.sensitive
|
239
|
+
event.message = param.format(_("current_value %s, should be %s (noop)"),
|
240
|
+
param.is_to_s(current_value),
|
241
|
+
param.should_to_s(param.should)) + audit_message.to_s
|
242
|
+
else
|
243
|
+
event.message = "#{param.change_to_s(current_value, param.should)} (noop)#{audit_message}"
|
244
|
+
end
|
241
245
|
event.status = "noop"
|
242
246
|
end
|
243
247
|
|
data/lib/puppet/type/exec.rb
CHANGED
@@ -437,13 +437,12 @@ module Puppet
|
|
437
437
|
actually contain `myfile`, the exec will keep running every time
|
438
438
|
Puppet runs.
|
439
439
|
|
440
|
-
This parameter can also take an array of files and the command will
|
441
|
-
not run if **any** of these files exist.
|
440
|
+
This parameter can also take an array of files, and the command will
|
441
|
+
not run if **any** of these files exist. Consider this example:
|
442
442
|
|
443
443
|
creates => ['/tmp/file1', '/tmp/file2'],
|
444
444
|
|
445
|
-
|
446
|
-
|
445
|
+
The command is only run if both files don't exist.
|
447
446
|
EOT
|
448
447
|
|
449
448
|
accept_arrays
|
@@ -7,11 +7,13 @@ require_relative '../../../puppet/util/checksums'
|
|
7
7
|
Puppet::Type.type(:file).newparam(:checksum) do
|
8
8
|
include Puppet::Util::Checksums
|
9
9
|
|
10
|
+
# The default is defined in Puppet.default_digest_algorithm
|
10
11
|
desc "The checksum type to use when determining whether to replace a file's contents.
|
11
12
|
|
12
|
-
The default checksum type is
|
13
|
+
The default checksum type is sha256."
|
13
14
|
|
14
|
-
|
15
|
+
# The values are defined in Puppet::Util::Checksums.known_checksum_types
|
16
|
+
newvalues(:sha256, :sha256lite, :md5, :md5lite, :sha1, :sha1lite, :sha512, :sha384, :sha224, :mtime, :ctime, :none)
|
15
17
|
|
16
18
|
defaultto do
|
17
19
|
Puppet[:digest_algorithm].to_sym
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module Puppet
|
4
4
|
Puppet::Type.type(:file).newproperty(:ctime) do
|
5
|
-
desc
|
5
|
+
desc "A read-only state to check the file ctime. On most modern \*nix-like
|
6
6
|
systems, this is the time of the most recent change to the owner, group,
|
7
|
-
permissions, or content of the file.
|
7
|
+
permissions, or content of the file."
|
8
8
|
|
9
9
|
def retrieve
|
10
10
|
current_value = :absent
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module Puppet
|
4
4
|
Puppet::Type.type(:file).newproperty(:mtime) do
|
5
|
-
desc
|
6
|
-
is the time of the most recent change to the content of the file.
|
5
|
+
desc "A read-only state to check the file mtime. On \*nix-like systems, this
|
6
|
+
is the time of the most recent change to the content of the file."
|
7
7
|
|
8
8
|
def retrieve
|
9
9
|
current_value = :absent
|
@@ -40,11 +40,12 @@ module Puppet
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def retrieve_default_context(property)
|
43
|
+
return nil if Puppet::Util::Platform.windows?
|
43
44
|
if @resource[:selinux_ignore_defaults] == :true
|
44
45
|
return nil
|
45
46
|
end
|
46
47
|
|
47
|
-
context =
|
48
|
+
context = get_selinux_default_context_with_handle(@resource[:path], provider.class.selinux_handle, @resource[:ensure])
|
48
49
|
unless context
|
49
50
|
return nil
|
50
51
|
end
|
@@ -85,7 +86,7 @@ module Puppet
|
|
85
86
|
end
|
86
87
|
|
87
88
|
Puppet::Type.type(:file).newparam(:selinux_ignore_defaults) do
|
88
|
-
desc "If this is set
|
89
|
+
desc "If this is set, Puppet will not call the SELinux function selabel_lookup to
|
89
90
|
supply defaults for the SELinux attributes (seluser, selrole,
|
90
91
|
seltype, and selrange). In general, you should leave this set at its
|
91
92
|
default and only set it to true when you need Puppet to not try to fix
|
@@ -98,7 +99,7 @@ module Puppet
|
|
98
99
|
Puppet::Type.type(:file).newproperty(:seluser, :parent => Puppet::SELFileContext) do
|
99
100
|
desc "What the SELinux user component of the context of the file should be.
|
100
101
|
Any valid SELinux user component is accepted. For example `user_u`.
|
101
|
-
If not specified it defaults to the value returned by
|
102
|
+
If not specified, it defaults to the value returned by selabel_lookup for
|
102
103
|
the file, if any exists. Only valid on systems with SELinux support
|
103
104
|
enabled."
|
104
105
|
|
@@ -109,7 +110,7 @@ module Puppet
|
|
109
110
|
Puppet::Type.type(:file).newproperty(:selrole, :parent => Puppet::SELFileContext) do
|
110
111
|
desc "What the SELinux role component of the context of the file should be.
|
111
112
|
Any valid SELinux role component is accepted. For example `role_r`.
|
112
|
-
If not specified it defaults to the value returned by
|
113
|
+
If not specified, it defaults to the value returned by selabel_lookup for
|
113
114
|
the file, if any exists. Only valid on systems with SELinux support
|
114
115
|
enabled."
|
115
116
|
|
@@ -120,7 +121,7 @@ module Puppet
|
|
120
121
|
Puppet::Type.type(:file).newproperty(:seltype, :parent => Puppet::SELFileContext) do
|
121
122
|
desc "What the SELinux type component of the context of the file should be.
|
122
123
|
Any valid SELinux type component is accepted. For example `tmp_t`.
|
123
|
-
If not specified it defaults to the value returned by
|
124
|
+
If not specified, it defaults to the value returned by selabel_lookup for
|
124
125
|
the file, if any exists. Only valid on systems with SELinux support
|
125
126
|
enabled."
|
126
127
|
|
@@ -131,8 +132,8 @@ module Puppet
|
|
131
132
|
Puppet::Type.type(:file).newproperty(:selrange, :parent => Puppet::SELFileContext) do
|
132
133
|
desc "What the SELinux range component of the context of the file should be.
|
133
134
|
Any valid SELinux range component is accepted. For example `s0` or
|
134
|
-
`SystemHigh`. If not specified it defaults to the value returned by
|
135
|
-
|
135
|
+
`SystemHigh`. If not specified, it defaults to the value returned by
|
136
|
+
selabel_lookup for the file, if any exists. Only valid on systems with
|
136
137
|
SELinux support enabled and that have support for MCS (Multi-Category
|
137
138
|
Security)."
|
138
139
|
|
@@ -44,22 +44,20 @@ module Puppet
|
|
44
44
|
|
45
45
|
raise Puppet::Error, "Could not remove existing file" if Puppet::FileSystem.exist?(@resource[:path])
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
Puppet::Util.withumask(0o00) do
|
52
|
-
Puppet::FileSystem.symlink(target, @resource[:path])
|
53
|
-
end
|
54
|
-
else
|
47
|
+
Puppet::Util::SUIDManager.asuser(@resource.asuser) do
|
48
|
+
mode = @resource.should(:mode)
|
49
|
+
if mode
|
50
|
+
Puppet::Util.withumask(0o00) do
|
55
51
|
Puppet::FileSystem.symlink(target, @resource[:path])
|
56
52
|
end
|
53
|
+
else
|
54
|
+
Puppet::FileSystem.symlink(target, @resource[:path])
|
57
55
|
end
|
56
|
+
end
|
58
57
|
|
59
|
-
|
58
|
+
@resource.send(:property_fix)
|
60
59
|
|
61
|
-
|
62
|
-
end
|
60
|
+
:link_created
|
63
61
|
end
|
64
62
|
|
65
63
|
def insync?(currentvalue)
|
data/lib/puppet/type/package.rb
CHANGED
@@ -301,12 +301,13 @@ module Puppet
|
|
301
301
|
command => '/opt/ruby/bin/gem',
|
302
302
|
}
|
303
303
|
|
304
|
-
Each provider defines a package management command
|
304
|
+
Each provider defines a package management command and uses the first
|
305
305
|
instance of the command found in the PATH.
|
306
306
|
|
307
307
|
Providers supporting the targetable feature allow you to specify the
|
308
|
-
absolute path of the package management command
|
309
|
-
instances of the command are installed, or
|
308
|
+
absolute path of the package management command. Specifying the absolute
|
309
|
+
path is useful when multiple instances of the command are installed, or
|
310
|
+
the command is not in the PATH.
|
310
311
|
EOT
|
311
312
|
|
312
313
|
isnamevar
|
data/lib/puppet/type/user.rb
CHANGED
@@ -231,7 +231,7 @@ module Puppet
|
|
231
231
|
* OS X 10.8 and higher use salted SHA512 PBKDF2 hashes. When managing passwords
|
232
232
|
on these systems, the `salt` and `iterations` attributes need to be specified as
|
233
233
|
well as the password.
|
234
|
-
* macOS 10.15 and
|
234
|
+
* macOS 10.15 and later require the salt to be 32 bytes. Because Puppet's user
|
235
235
|
resource requires the value to be hex encoded, the length of the salt's
|
236
236
|
string must be 64.
|
237
237
|
* Windows passwords can be managed only in cleartext, because there is no Windows
|
@@ -323,7 +323,7 @@ module Puppet::Util::Execution
|
|
323
323
|
unless options[:squelch]
|
324
324
|
# if we opened a pipe, we need to clean it up.
|
325
325
|
reader.close if reader
|
326
|
-
stdout.close! if Puppet::Util::Platform.windows?
|
326
|
+
stdout.close! if stdout && Puppet::Util::Platform.windows?
|
327
327
|
end
|
328
328
|
end
|
329
329
|
|
@@ -72,11 +72,11 @@ class Puppet::Util::Profiler::Aggregate < Puppet::Util::Profiler::WallClock
|
|
72
72
|
|
73
73
|
class Timer
|
74
74
|
def initialize
|
75
|
-
@start =
|
75
|
+
@start = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_second)
|
76
76
|
end
|
77
77
|
|
78
78
|
def stop
|
79
|
-
|
79
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_second) - @start
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
@@ -21,11 +21,11 @@ class Puppet::Util::Profiler::WallClock < Puppet::Util::Profiler::Logging
|
|
21
21
|
FOUR_DECIMAL_DIGITS = '%0.4f'
|
22
22
|
|
23
23
|
def initialize
|
24
|
-
@start =
|
24
|
+
@start = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_second)
|
25
25
|
end
|
26
26
|
|
27
27
|
def stop
|
28
|
-
@time =
|
28
|
+
@time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_second) - @start
|
29
29
|
@time
|
30
30
|
end
|
31
31
|
|