puppet 4.1.0-x86-mingw32 → 4.2.0-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.
- data/ext/osx/puppet.plist +32 -0
- data/ext/redhat/client.init +3 -6
- data/ext/redhat/client.sysconfig +1 -10
- data/ext/suse/client.init +3 -6
- data/ext/systemd/puppet.service +2 -1
- data/lib/puppet.rb +1 -1
- data/lib/puppet/agent.rb +4 -19
- data/lib/puppet/application/apply.rb +22 -6
- data/lib/puppet/configurer.rb +3 -2
- data/lib/puppet/configurer/plugin_handler.rb +6 -2
- data/lib/puppet/face/plugin.rb +7 -14
- data/lib/puppet/forge/repository.rb +1 -2
- data/lib/puppet/indirector/catalog/compiler.rb +4 -3
- data/lib/puppet/indirector/facts/facter.rb +8 -0
- data/lib/puppet/module.rb +17 -12
- data/lib/puppet/network/http/factory.rb +8 -4
- data/lib/puppet/node/environment.rb +11 -7
- data/lib/puppet/parser/ast/pops_bridge.rb +5 -0
- data/lib/puppet/parser/functions/fqdn_rand.rb +2 -2
- data/lib/puppet/parser/scope.rb +39 -13
- data/lib/puppet/pops.rb +1 -0
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +31 -0
- data/lib/puppet/pops/parser/epp_support.rb +4 -2
- data/lib/puppet/property/ensure.rb +1 -1
- data/lib/puppet/provider.rb +5 -0
- data/lib/puppet/provider/augeas/augeas.rb +5 -0
- data/lib/puppet/provider/group/pw.rb +1 -0
- data/lib/puppet/provider/group/windows_adsi.rb +9 -0
- data/lib/puppet/provider/mount/parsed.rb +15 -1
- data/lib/puppet/provider/package.rb +6 -2
- data/lib/puppet/provider/package/gem.rb +16 -0
- data/lib/puppet/provider/package/openbsd.rb +7 -7
- data/lib/puppet/provider/package/pacman.rb +9 -8
- data/lib/puppet/provider/package/pip.rb +1 -1
- data/lib/puppet/provider/package/pip3.rb +18 -0
- data/lib/puppet/provider/package/pkgdmg.rb +4 -2
- data/lib/puppet/provider/package/pkgin.rb +3 -3
- data/lib/puppet/provider/package/rpm.rb +8 -14
- data/lib/puppet/provider/package/yum.rb +5 -4
- data/lib/puppet/provider/service/base.rb +3 -2
- data/lib/puppet/provider/service/bsd.rb +7 -7
- data/lib/puppet/provider/service/debian.rb +2 -1
- data/lib/puppet/provider/service/freebsd.rb +1 -1
- data/lib/puppet/provider/service/systemd.rb +75 -6
- data/lib/puppet/provider/service/upstart.rb +1 -1
- data/lib/puppet/provider/user/pw.rb +1 -0
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/resource/status.rb +9 -0
- data/lib/puppet/resource/type.rb +4 -2
- data/lib/puppet/settings.rb +43 -16
- data/lib/puppet/transaction.rb +27 -13
- data/lib/puppet/type/augeas.rb +1 -0
- data/lib/puppet/type/exec.rb +11 -2
- data/lib/puppet/type/group.rb +9 -1
- data/lib/puppet/type/mount.rb +2 -0
- data/lib/puppet/type/package.rb +13 -2
- data/lib/puppet/type/service.rb +9 -0
- data/lib/puppet/util.rb +8 -3
- data/lib/puppet/util/execution.rb +2 -2
- data/lib/puppet/util/http_proxy.rb +60 -0
- data/lib/puppet/util/log.rb +1 -1
- data/lib/puppet/util/splayer.rb +18 -0
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-obsoletes.txt +195 -0
- data/spec/integration/application/apply_spec.rb +72 -30
- data/spec/integration/indirector/facts/facter_spec.rb +38 -0
- data/spec/integration/parser/scope_spec.rb +20 -2
- data/spec/integration/provider/mount_spec.rb +23 -36
- data/spec/integration/transaction_spec.rb +40 -1
- data/spec/integration/type/file_spec.rb +36 -0
- data/spec/integration/type/package_spec.rb +65 -0
- data/spec/lib/matchers/include_in_order.rb +0 -1
- data/spec/lib/puppet_spec/files.rb +14 -0
- data/spec/unit/agent_spec.rb +0 -38
- data/spec/unit/application/apply_spec.rb +13 -0
- data/spec/unit/configurer/plugin_handler_spec.rb +42 -13
- data/spec/unit/configurer_spec.rb +5 -0
- data/spec/unit/face/plugin_spec.rb +33 -4
- data/spec/unit/file_serving/configuration/parser_spec.rb +25 -30
- data/spec/unit/indirector/catalog/compiler_spec.rb +16 -0
- data/spec/unit/indirector/facts/facter_spec.rb +2 -1
- data/spec/unit/module_spec.rb +0 -23
- data/spec/unit/network/http/factory_spec.rb +14 -0
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +6 -2
- data/spec/unit/parser/functions/generate_spec.rb +3 -12
- data/spec/unit/parser/scope_spec.rb +9 -0
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +19 -0
- data/spec/unit/pops/evaluator/variables_spec.rb +1 -1
- data/spec/unit/pops/parser/lexer2_spec.rb +35 -3
- data/spec/unit/provider/augeas/augeas_spec.rb +9 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +5 -0
- data/spec/unit/provider/package/aptrpm_spec.rb +2 -2
- data/spec/unit/provider/package/base_spec.rb +18 -0
- data/spec/unit/provider/package/gem_spec.rb +70 -0
- data/spec/unit/provider/package/pacman_spec.rb +55 -0
- data/spec/unit/provider/package/pip3_spec.rb +257 -0
- data/spec/unit/provider/package/pip_spec.rb +1 -1
- data/spec/unit/provider/package/pkgdmg_spec.rb +18 -0
- data/spec/unit/provider/package/pkgin_spec.rb +23 -13
- data/spec/unit/provider/package/yum_spec.rb +11 -0
- data/spec/unit/provider/service/bsd_spec.rb +130 -0
- data/spec/unit/provider/service/debian_spec.rb +12 -1
- data/spec/unit/provider/service/freebsd_spec.rb +16 -0
- data/spec/unit/provider/service/systemd_spec.rb +84 -7
- data/spec/unit/provider/service/upstart_spec.rb +1 -0
- data/spec/unit/provider/zone/solaris_spec.rb +45 -12
- data/spec/unit/puppet_spec.rb +1 -1
- data/spec/unit/resource/catalog_spec.rb +5 -0
- data/spec/unit/type/mount_spec.rb +8 -0
- data/spec/unit/type/service_spec.rb +5 -0
- data/spec/unit/util/http_proxy_spec.rb +87 -0
- data/spec/unit/util/log_spec.rb +12 -1
- data/spec/unit/util/splayer_spec.rb +45 -0
- metadata +3071 -3035
- checksums.yaml +0 -7
- data/ext/systemd/puppetmaster.service +0 -11
@@ -68,8 +68,10 @@ Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Packag
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def self.installpkgdmg(source, name)
|
71
|
-
|
72
|
-
|
71
|
+
unless Puppet::Util::HttpProxy.no_proxy?(source)
|
72
|
+
http_proxy_host = Puppet::Util::HttpProxy.http_proxy_host
|
73
|
+
http_proxy_port = Puppet::Util::HttpProxy.http_proxy_port
|
74
|
+
end
|
73
75
|
|
74
76
|
unless source =~ /\.dmg$/i || source =~ /\.pkg$/i
|
75
77
|
raise Puppet::Error.new("Mac OS X PKG DMG's must specify a source string ending in .dmg or flat .pkg file")
|
@@ -5,15 +5,15 @@ Puppet::Type.type(:package).provide :pkgin, :parent => Puppet::Provider::Package
|
|
5
5
|
|
6
6
|
commands :pkgin => "pkgin"
|
7
7
|
|
8
|
-
defaultfor :operatingsystem => [ :dragonfly , :smartos ]
|
8
|
+
defaultfor :operatingsystem => [ :dragonfly , :smartos, :netbsd ]
|
9
9
|
|
10
10
|
has_feature :installable, :uninstallable, :upgradeable, :versionable
|
11
11
|
|
12
12
|
def self.parse_pkgin_line(package)
|
13
13
|
|
14
14
|
# e.g.
|
15
|
-
# vim-7.2.446
|
16
|
-
match, name, version, status = *package.match(/(
|
15
|
+
# vim-7.2.446;Vim editor (vi clone) without GUI
|
16
|
+
match, name, version, status = *package.match(/([^\s;]+)-([^\s;]+)[;\s](=|>|<)?.+$/)
|
17
17
|
if match
|
18
18
|
{
|
19
19
|
:name => name,
|
@@ -115,15 +115,14 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
|
|
115
115
|
unless source = @resource[:source]
|
116
116
|
@resource.fail "RPMs must specify a package source"
|
117
117
|
end
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
end
|
118
|
+
|
119
|
+
version = @property_hash[:ensure]
|
120
|
+
|
121
|
+
# RPM gets upset if you try to install an already installed package
|
122
|
+
return if @resource.should(:ensure) == version || (@resource.should(:ensure) == :latest && version == latest)
|
124
123
|
|
125
124
|
flag = ["-i"]
|
126
|
-
flag = ["-U", "--oldpackage"] if
|
125
|
+
flag = ["-U", "--oldpackage"] if version && (version != :absent && version != :purged)
|
127
126
|
flag += install_options if resource[:install_options]
|
128
127
|
rpm flag, source
|
129
128
|
end
|
@@ -184,14 +183,9 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
|
|
184
183
|
return 0 if str1 == str2
|
185
184
|
|
186
185
|
front_strip_re = /^[^A-Za-z0-9~]+/
|
187
|
-
segment_re = /^[A-Za-z0-9]/
|
188
|
-
# these represent RPM rpmio/rpmstring.c functions
|
189
|
-
risalnum = /[A-Za-z0-9]/
|
190
|
-
risdigit = /^[0-9]+/
|
191
|
-
risalpha = /[A-Za-z]/
|
192
186
|
|
193
187
|
while str1.length > 0 or str2.length > 0
|
194
|
-
# trim anything that's
|
188
|
+
# trim anything that's in front_strip_re and != '~' off the beginning of each string
|
195
189
|
str1 = str1.gsub(front_strip_re, '')
|
196
190
|
str2 = str2.gsub(front_strip_re, '')
|
197
191
|
|
@@ -211,7 +205,7 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
|
|
211
205
|
# "grab first completely alpha or completely numeric segment"
|
212
206
|
isnum = false
|
213
207
|
# if the first char of str1 is a digit, grab the chunk of continuous digits from each string
|
214
|
-
if
|
208
|
+
if /^[0-9]+/.match(str1)
|
215
209
|
if str1 =~ /^[0-9]+/
|
216
210
|
segment1 = $~.to_s
|
217
211
|
str1 = $~.post_match
|
@@ -91,6 +91,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
91
91
|
|
92
92
|
updates = Hash.new { |h, k| h[k] = [] }
|
93
93
|
body.split.each_slice(3) do |tuple|
|
94
|
+
break if tuple[0] =~ /^Obsoleting/
|
94
95
|
hash = update_to_hash(*tuple[0..1])
|
95
96
|
# Create entries for both the package name without a version and a
|
96
97
|
# version since yum considers those as mostly interchangeable.
|
@@ -174,10 +175,10 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
174
175
|
# because of multiarch
|
175
176
|
return "#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}"
|
176
177
|
else
|
177
|
-
# Yum didn't find updates, pretend the current
|
178
|
-
|
179
|
-
raise Puppet::DevError, "Tried to get latest on a missing package" if
|
180
|
-
return
|
178
|
+
# Yum didn't find updates, pretend the current version is the latest
|
179
|
+
version = properties[:ensure]
|
180
|
+
raise Puppet::DevError, "Tried to get latest on a missing package" if version == :absent || version == :purged
|
181
|
+
return version
|
181
182
|
end
|
182
183
|
end
|
183
184
|
|
@@ -31,8 +31,9 @@ Puppet::Type.type(:service).provide :base, :parent => :service do
|
|
31
31
|
def getpid
|
32
32
|
@resource.fail "Either stop/status commands or a pattern must be specified" unless @resource[:pattern]
|
33
33
|
regex = Regexp.new(@resource[:pattern])
|
34
|
+
ps = getps
|
34
35
|
self.debug "Executing '#{ps}'"
|
35
|
-
IO.popen(
|
36
|
+
IO.popen(ps) { |table|
|
36
37
|
table.each_line { |line|
|
37
38
|
if regex.match(line)
|
38
39
|
self.debug "Process matched: #{line}"
|
@@ -62,7 +63,7 @@ Puppet::Type.type(:service).provide :base, :parent => :service do
|
|
62
63
|
else
|
63
64
|
return :stopped
|
64
65
|
end
|
65
|
-
elsif pid =
|
66
|
+
elsif pid = getpid
|
66
67
|
self.debug "PID is #{pid}"
|
67
68
|
return :running
|
68
69
|
else
|
@@ -1,10 +1,8 @@
|
|
1
|
-
# Manage FreeBSD services.
|
2
1
|
Puppet::Type.type(:service).provide :bsd, :parent => :init do
|
3
2
|
desc <<-EOT
|
4
|
-
|
3
|
+
Generic BSD form of `init`-style service management with `rc.d`.
|
5
4
|
|
6
5
|
Uses `rc.conf.d` for service enabling and disabling.
|
7
|
-
|
8
6
|
EOT
|
9
7
|
|
10
8
|
confine :operatingsystem => [:freebsd, :netbsd, :dragonfly]
|
@@ -19,13 +17,13 @@ Puppet::Type.type(:service).provide :bsd, :parent => :init do
|
|
19
17
|
|
20
18
|
# remove service file from rc.conf.d to disable it
|
21
19
|
def disable
|
22
|
-
rcfile = File.join(rcconf_dir, @
|
20
|
+
rcfile = File.join(rcconf_dir, @resource[:name])
|
23
21
|
File.delete(rcfile) if Puppet::FileSystem.exist?(rcfile)
|
24
22
|
end
|
25
23
|
|
26
24
|
# if the service file exists in rc.conf.d then it's already enabled
|
27
25
|
def enabled?
|
28
|
-
rcfile = File.join(rcconf_dir, @
|
26
|
+
rcfile = File.join(rcconf_dir, @resource[:name])
|
29
27
|
return :true if Puppet::FileSystem.exist?(rcfile)
|
30
28
|
|
31
29
|
:false
|
@@ -35,8 +33,10 @@ Puppet::Type.type(:service).provide :bsd, :parent => :init do
|
|
35
33
|
# proper contents
|
36
34
|
def enable
|
37
35
|
Dir.mkdir(rcconf_dir) if not Puppet::FileSystem.exist?(rcconf_dir)
|
38
|
-
rcfile = File.join(rcconf_dir, @
|
39
|
-
open(rcfile,
|
36
|
+
rcfile = File.join(rcconf_dir, @resource[:name])
|
37
|
+
File.open(rcfile, File::WRONLY | File::APPEND | File::CREAT, 0644) { |f|
|
38
|
+
f << "%s_enable=\"YES\"\n" % @resource[:name]
|
39
|
+
}
|
40
40
|
end
|
41
41
|
|
42
42
|
# Override stop/start commands to use one<cmd>'s and the avoid race condition
|
@@ -16,7 +16,8 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
|
|
16
16
|
# is resolved.
|
17
17
|
commands :invoke_rc => "/usr/sbin/invoke-rc.d"
|
18
18
|
|
19
|
-
defaultfor :operatingsystem =>
|
19
|
+
defaultfor :operatingsystem => :cumuluslinux
|
20
|
+
defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ['5','6','7']
|
20
21
|
|
21
22
|
# Remove the symlinks
|
22
23
|
def disable
|
@@ -1,19 +1,23 @@
|
|
1
|
-
# Manage systemd services using
|
1
|
+
# Manage systemd services using systemctl
|
2
2
|
|
3
3
|
Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
4
4
|
desc "Manages `systemd` services using `systemctl`."
|
5
5
|
|
6
6
|
commands :systemctl => "systemctl"
|
7
7
|
|
8
|
+
confine :exists => "/run/systemd/system"
|
9
|
+
|
8
10
|
defaultfor :osfamily => [:archlinux]
|
9
11
|
defaultfor :osfamily => :redhat, :operatingsystemmajrelease => "7"
|
10
|
-
defaultfor :osfamily => :redhat, :operatingsystem => :fedora
|
12
|
+
defaultfor :osfamily => :redhat, :operatingsystem => :fedora
|
11
13
|
defaultfor :osfamily => :suse, :operatingsystemmajrelease => ["12", "13"]
|
14
|
+
defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => "8"
|
15
|
+
defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => "15.04"
|
12
16
|
|
13
17
|
def self.instances
|
14
18
|
i = []
|
15
19
|
output = systemctl('list-unit-files', '--type', 'service', '--full', '--all', '--no-pager')
|
16
|
-
output.scan(/^(\S+)\s+(disabled|enabled)\s*$/i).each do |m|
|
20
|
+
output.scan(/^(\S+)\s+(disabled|enabled|masked)\s*$/i).each do |m|
|
17
21
|
i << new(:name => m[0])
|
18
22
|
end
|
19
23
|
return i
|
@@ -27,14 +31,68 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
27
31
|
raise Puppet::Error, "Could not disable #{self.name}: #{output}", $!.backtrace
|
28
32
|
end
|
29
33
|
|
34
|
+
def get_start_link_count
|
35
|
+
Dir.glob("/etc/rc*.d/S??#{@resource[:name]}").length
|
36
|
+
end
|
37
|
+
|
30
38
|
def enabled?
|
31
39
|
begin
|
32
|
-
systemctl(
|
40
|
+
systemctl_info = systemctl(
|
41
|
+
'show',
|
42
|
+
@resource[:name],
|
43
|
+
'--property', 'LoadState',
|
44
|
+
'--property', 'UnitFileState',
|
45
|
+
'--no-pager'
|
46
|
+
)
|
47
|
+
|
48
|
+
svc_info = Hash.new
|
49
|
+
systemctl_info.split.each do |svc|
|
50
|
+
entry_pair = svc.split('=')
|
51
|
+
svc_info[entry_pair.first.to_sym] = entry_pair.last
|
52
|
+
end
|
53
|
+
|
54
|
+
# The masked state is equivalent to the disabled state in terms of
|
55
|
+
# comparison so we only care to check if it is masked if we want to keep
|
56
|
+
# it masked.
|
57
|
+
#
|
58
|
+
# We only return :mask if we're trying to mask the service. This prevents
|
59
|
+
# flapping when simply trying to disable a masked service.
|
60
|
+
return :mask if (@resource[:enable] == :mask) && (svc_info[:LoadState] == 'masked')
|
61
|
+
return :true if svc_info[:UnitFileState] == 'enabled'
|
62
|
+
if Facter.value(:osfamily) == 'debian'
|
63
|
+
ret = debian_enabled?(svc_info)
|
64
|
+
return ret if ret
|
65
|
+
end
|
33
66
|
rescue Puppet::ExecutionFailure
|
34
|
-
|
67
|
+
# The execution of the systemd command can fail for quite a few reasons.
|
68
|
+
# In all of these cases, the failure of the query indicates that the
|
69
|
+
# service is disabled and therefore we simply return :false.
|
35
70
|
end
|
36
71
|
|
37
|
-
:
|
72
|
+
return :false
|
73
|
+
end
|
74
|
+
|
75
|
+
def debian_enabled?(svc_info)
|
76
|
+
# If UnitFileState == UnitFileState then we query the older way.
|
77
|
+
if svc_info[:UnitFileState] == 'UnitFileState'
|
78
|
+
system("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start")
|
79
|
+
if [104, 106].include?($CHILD_STATUS.exitstatus)
|
80
|
+
return :true
|
81
|
+
elsif [101, 105].include?($CHILD_STATUS.exitstatus)
|
82
|
+
# 101 is action not allowed, which means we have to do the check manually.
|
83
|
+
# 105 is unknown, which generally means the iniscript does not support query
|
84
|
+
# The debian policy states that the initscript should support methods of query
|
85
|
+
# For those that do not, peform the checks manually
|
86
|
+
# http://www.debian.org/doc/debian-policy/ch-opersys.html
|
87
|
+
if get_start_link_count >= 4
|
88
|
+
return :true
|
89
|
+
else
|
90
|
+
return :false
|
91
|
+
end
|
92
|
+
else
|
93
|
+
return :false
|
94
|
+
end
|
95
|
+
end
|
38
96
|
end
|
39
97
|
|
40
98
|
def status
|
@@ -47,11 +105,22 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
47
105
|
end
|
48
106
|
|
49
107
|
def enable
|
108
|
+
output = systemctl("unmask", @resource[:name])
|
50
109
|
output = systemctl("enable", @resource[:name])
|
51
110
|
rescue Puppet::ExecutionFailure
|
52
111
|
raise Puppet::Error, "Could not enable #{self.name}: #{output}", $!.backtrace
|
53
112
|
end
|
54
113
|
|
114
|
+
def mask
|
115
|
+
self.disable
|
116
|
+
|
117
|
+
begin
|
118
|
+
output = systemctl("mask", @resource[:name])
|
119
|
+
rescue Puppet::ExecutionFailure
|
120
|
+
raise Puppet::Error, "Could not mask #{self.name}: #{output}", $!.backtrace
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
55
124
|
def restartcmd
|
56
125
|
[command(:systemctl), "restart", @resource[:name]]
|
57
126
|
end
|
@@ -18,7 +18,7 @@ Puppet::Type.type(:service).provide :upstart, :parent => :debian do
|
|
18
18
|
Facter.value(:operatingsystem) == 'LinuxMint',
|
19
19
|
]
|
20
20
|
|
21
|
-
defaultfor :operatingsystem => :ubuntu
|
21
|
+
defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["10.04", "12.04", "14.04", "14.10"]
|
22
22
|
|
23
23
|
commands :start => "/sbin/start",
|
24
24
|
:stop => "/sbin/stop",
|
@@ -8,6 +8,7 @@ Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService::
|
|
8
8
|
has_features :manages_homedir, :allows_duplicates, :manages_passwords, :manages_expiry, :manages_shell
|
9
9
|
|
10
10
|
defaultfor :operatingsystem => [:freebsd, :dragonfly]
|
11
|
+
confine :operatingsystem => [:freebsd, :dragonfly]
|
11
12
|
|
12
13
|
options :home, :flag => "-d", :method => :dir
|
13
14
|
options :comment, :method => :gecos
|
@@ -83,6 +83,15 @@ module Puppet
|
|
83
83
|
# while evaluating `@real_resource`.
|
84
84
|
attr_reader :events
|
85
85
|
|
86
|
+
# @!attribute [rw] failed_dependencies
|
87
|
+
# @return [Array<Puppet::Resource>] A cache of all
|
88
|
+
# dependencies of this resource that failed to apply.
|
89
|
+
attr_accessor :failed_dependencies
|
90
|
+
|
91
|
+
def dependency_failed?
|
92
|
+
failed_dependencies && !failed_dependencies.empty?
|
93
|
+
end
|
94
|
+
|
86
95
|
# A list of instance variables that should be serialized with this object
|
87
96
|
# when converted to YAML.
|
88
97
|
YAML_ATTRIBUTES = %w{@resource @file @line @evaluation_time @change_count
|
data/lib/puppet/resource/type.rb
CHANGED
@@ -73,8 +73,10 @@ class Puppet::Resource::Type
|
|
73
73
|
|
74
74
|
# External documentation uses "parameters" but the internal name
|
75
75
|
# is "arguments"
|
76
|
-
|
77
|
-
|
76
|
+
# Dump any arguments as source
|
77
|
+
data['parameters'] = Hash[arguments.map do |k,v|
|
78
|
+
[k, v.respond_to?(:source_text) ? v.source_text : v]
|
79
|
+
end]
|
78
80
|
data['name'] = name
|
79
81
|
|
80
82
|
unless RESOURCE_KINDS_TO_EXTERNAL_NAMES.has_key?(type)
|
data/lib/puppet/settings.rb
CHANGED
@@ -749,13 +749,13 @@ class Puppet::Settings
|
|
749
749
|
|
750
750
|
class SearchPathElement < Struct.new(:name, :type); end
|
751
751
|
|
752
|
-
# The order in which to search for values.
|
752
|
+
# The order in which to search for values, without defaults.
|
753
753
|
#
|
754
754
|
# @param environment [String,Symbol] symbolic reference to an environment name
|
755
755
|
# @param run_mode [Symbol] symbolic reference to a Puppet run mode
|
756
756
|
# @return [Array<SearchPathElement>]
|
757
757
|
# @api private
|
758
|
-
def
|
758
|
+
def configsearchpath(environment = nil, run_mode = preferred_run_mode)
|
759
759
|
searchpath = [
|
760
760
|
SearchPathElement.new(:memory, :values),
|
761
761
|
SearchPathElement.new(:cli, :values),
|
@@ -763,6 +763,16 @@ class Puppet::Settings
|
|
763
763
|
searchpath << SearchPathElement.new(environment.intern, :environment) if environment
|
764
764
|
searchpath << SearchPathElement.new(run_mode, :section) if run_mode
|
765
765
|
searchpath << SearchPathElement.new(:main, :section)
|
766
|
+
end
|
767
|
+
|
768
|
+
# The order in which to search for values.
|
769
|
+
#
|
770
|
+
# @param environment [String,Symbol] symbolic reference to an environment name
|
771
|
+
# @param run_mode [Symbol] symbolic reference to a Puppet run mode
|
772
|
+
# @return [Array<SearchPathElement>]
|
773
|
+
# @api private
|
774
|
+
def searchpath(environment = nil, run_mode = preferred_run_mode)
|
775
|
+
searchpath = configsearchpath(environment, run_mode)
|
766
776
|
searchpath << SearchPathElement.new(:application_defaults, :values)
|
767
777
|
searchpath << SearchPathElement.new(:overridden_defaults, :values)
|
768
778
|
end
|
@@ -799,6 +809,34 @@ class Puppet::Settings
|
|
799
809
|
!@value_sets[:cli].lookup(param).nil?
|
800
810
|
end
|
801
811
|
|
812
|
+
# Get values from a search path entry.
|
813
|
+
# @api private
|
814
|
+
def searchpath_values(source)
|
815
|
+
case source.type
|
816
|
+
when :values
|
817
|
+
@value_sets[source.name]
|
818
|
+
when :section
|
819
|
+
if @configuration_file && section = @configuration_file.sections[source.name]
|
820
|
+
ValuesFromSection.new(source.name, section)
|
821
|
+
end
|
822
|
+
when :environment
|
823
|
+
ValuesFromEnvironmentConf.new(source.name)
|
824
|
+
else
|
825
|
+
raise(Puppet::DevError, "Unknown searchpath case: #{source.type} for the #{source} settings path element.")
|
826
|
+
end
|
827
|
+
end
|
828
|
+
|
829
|
+
# Allow later inspection to determine if the setting was set by user
|
830
|
+
# config, rather than a default setting.
|
831
|
+
def set_by_config?(param)
|
832
|
+
param = param.to_sym
|
833
|
+
configsearchpath.any? do |source|
|
834
|
+
if vals = searchpath_values(source)
|
835
|
+
vals.lookup(param)
|
836
|
+
end
|
837
|
+
end
|
838
|
+
end
|
839
|
+
|
802
840
|
# Patches the value for a param in a section.
|
803
841
|
# This method is required to support the use case of unifying --dns-alt-names and
|
804
842
|
# --dns_alt_names in the certificate face. Ideally this should be cleaned up.
|
@@ -947,6 +985,8 @@ Generated on #{Time.now}.
|
|
947
985
|
|
948
986
|
return if sections.empty?
|
949
987
|
|
988
|
+
Puppet.debug("Applying settings catalog for sections #{sections.join(', ')}")
|
989
|
+
|
950
990
|
begin
|
951
991
|
catalog = to_catalog(*sections).to_ral
|
952
992
|
rescue => detail
|
@@ -1143,20 +1183,7 @@ Generated on #{Time.now}.
|
|
1143
1183
|
|
1144
1184
|
# Yield each search source in turn.
|
1145
1185
|
def value_sets_for(environment, mode)
|
1146
|
-
searchpath(environment, mode).collect
|
1147
|
-
case source.type
|
1148
|
-
when :values
|
1149
|
-
@value_sets[source.name]
|
1150
|
-
when :section
|
1151
|
-
if @configuration_file && section = @configuration_file.sections[source.name]
|
1152
|
-
ValuesFromSection.new(source.name, section)
|
1153
|
-
end
|
1154
|
-
when :environment
|
1155
|
-
ValuesFromEnvironmentConf.new(source.name)
|
1156
|
-
else
|
1157
|
-
raise(Puppet::DevError, "Unknown searchpath case: #{source.type} for the #{source} settings path element.")
|
1158
|
-
end
|
1159
|
-
end.compact
|
1186
|
+
searchpath(environment, mode).collect { |source| searchpath_values(source) }.compact
|
1160
1187
|
end
|
1161
1188
|
|
1162
1189
|
# Read the file in.
|