bolt 0.21.7 → 0.21.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/bolt/transport/ssh/connection.rb +4 -5
- data/lib/bolt/transport/ssh.rb +4 -1
- data/lib/bolt/transport/winrm/connection.rb +3 -4
- data/lib/bolt/transport/winrm.rb +4 -1
- data/lib/bolt/version.rb +1 -1
- data/libexec/apply_catalog.rb +10 -2
- data/vendored/puppet/lib/puppet/application/apply.rb +20 -9
- data/vendored/puppet/lib/puppet/application/cert.rb +3 -1
- data/vendored/puppet/lib/puppet/application/device.rb +22 -5
- data/vendored/puppet/lib/puppet/configurer/fact_handler.rb +5 -1
- data/vendored/puppet/lib/puppet/configurer.rb +15 -2
- data/vendored/puppet/lib/puppet/defaults.rb +36 -25
- data/vendored/puppet/lib/puppet/face/certificate.rb +2 -0
- data/vendored/puppet/lib/puppet/feature/base.rb +0 -3
- data/vendored/puppet/lib/puppet/functions/call.rb +37 -0
- data/vendored/puppet/lib/puppet/functions.rb +5 -0
- data/vendored/puppet/lib/puppet/indirector/ldap.rb +6 -0
- data/vendored/puppet/lib/puppet/node/environment.rb +4 -2
- data/vendored/puppet/lib/puppet/parser/scope.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/adapters.rb +14 -0
- data/vendored/puppet/lib/puppet/pops/evaluator/deferred_resolver.rb +128 -0
- data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +4 -1
- data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +2 -0
- data/vendored/puppet/lib/puppet/pops/issues.rb +9 -1
- data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +0 -16
- data/vendored/puppet/lib/puppet/pops/loaders.rb +1 -3
- data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +6 -6
- data/vendored/puppet/lib/puppet/pops/pcore.rb +11 -0
- data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +17 -0
- data/vendored/puppet/lib/puppet/pops/validation/tasks_checker.rb +13 -5
- data/vendored/puppet/lib/puppet/pops.rb +1 -0
- data/vendored/puppet/lib/puppet/provider/service/debian.rb +1 -0
- data/vendored/puppet/lib/puppet/provider/service/smf.rb +2 -3
- data/vendored/puppet/lib/puppet/provider/service/upstart.rb +10 -2
- data/vendored/puppet/lib/puppet/ssl/certificate_authority.rb +6 -84
- data/vendored/puppet/lib/puppet/ssl/certificate_request.rb +11 -3
- data/vendored/puppet/lib/puppet/type/file.rb +3 -0
- data/vendored/puppet/lib/puppet/type/user.rb +17 -3
- data/vendored/puppet/lib/puppet/util/autoload.rb +36 -31
- data/vendored/puppet/lib/puppet/util.rb +2 -0
- metadata +3 -43
- data/vendored/puppet/lib/puppet/indirector/node/write_only_yaml.rb +0 -39
- data/vendored/puppet/lib/puppet/provider/augeas/augeas.rb +0 -573
- data/vendored/puppet/lib/puppet/provider/cisco.rb +0 -9
- data/vendored/puppet/lib/puppet/provider/computer/computer.rb +0 -20
- data/vendored/puppet/lib/puppet/provider/host/parsed.rb +0 -46
- data/vendored/puppet/lib/puppet/provider/interface/cisco.rb +0 -27
- data/vendored/puppet/lib/puppet/provider/macauthorization/macauthorization.rb +0 -298
- data/vendored/puppet/lib/puppet/provider/mcx/mcxcontent.rb +0 -173
- data/vendored/puppet/lib/puppet/provider/mount/parsed.rb +0 -282
- data/vendored/puppet/lib/puppet/provider/mount.rb +0 -76
- data/vendored/puppet/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +0 -590
- data/vendored/puppet/lib/puppet/provider/selboolean/getsetsebool.rb +0 -47
- data/vendored/puppet/lib/puppet/provider/selmodule/semodule.rb +0 -140
- data/vendored/puppet/lib/puppet/provider/ssh_authorized_key/parsed.rb +0 -105
- data/vendored/puppet/lib/puppet/provider/sshkey/parsed.rb +0 -50
- data/vendored/puppet/lib/puppet/provider/vlan/cisco.rb +0 -28
- data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +0 -315
- data/vendored/puppet/lib/puppet/type/augeas.rb +0 -211
- data/vendored/puppet/lib/puppet/type/computer.rb +0 -66
- data/vendored/puppet/lib/puppet/type/host.rb +0 -95
- data/vendored/puppet/lib/puppet/type/interface.rb +0 -121
- data/vendored/puppet/lib/puppet/type/k5login.rb +0 -165
- data/vendored/puppet/lib/puppet/type/macauthorization.rb +0 -167
- data/vendored/puppet/lib/puppet/type/mcx.rb +0 -98
- data/vendored/puppet/lib/puppet/type/mount.rb +0 -314
- data/vendored/puppet/lib/puppet/type/router.rb +0 -17
- data/vendored/puppet/lib/puppet/type/scheduled_task.rb +0 -183
- data/vendored/puppet/lib/puppet/type/selboolean.rb +0 -26
- data/vendored/puppet/lib/puppet/type/selmodule.rb +0 -59
- data/vendored/puppet/lib/puppet/type/ssh_authorized_key.rb +0 -143
- data/vendored/puppet/lib/puppet/type/sshkey.rb +0 -83
- data/vendored/puppet/lib/puppet/type/vlan.rb +0 -26
- data/vendored/puppet/lib/puppet/type/yumrepo.rb +0 -430
- data/vendored/puppet/lib/puppet/util/network_device/cisco/device.rb +0 -285
- data/vendored/puppet/lib/puppet/util/network_device/cisco/facts.rb +0 -72
- data/vendored/puppet/lib/puppet/util/network_device/cisco/interface.rb +0 -94
- data/vendored/puppet/lib/puppet/util/network_device/cisco.rb +0 -4
- data/vendored/puppet/lib/puppet/util/network_device/ipcalc.rb +0 -68
- data/vendored/puppet/lib/puppet/util/network_device/transport/ssh.rb +0 -126
- data/vendored/puppet/lib/puppet/util/network_device/transport/telnet.rb +0 -47
- data/vendored/puppet/lib/puppet/util/windows/taskscheduler.rb +0 -1267
@@ -1,282 +0,0 @@
|
|
1
|
-
require 'puppet/provider/parsedfile'
|
2
|
-
require 'puppet/provider/mount'
|
3
|
-
|
4
|
-
fstab = nil
|
5
|
-
case Facter.value(:osfamily)
|
6
|
-
when "Solaris"; fstab = "/etc/vfstab"
|
7
|
-
when "AIX"; fstab = "/etc/filesystems"
|
8
|
-
else
|
9
|
-
fstab = "/etc/fstab"
|
10
|
-
end
|
11
|
-
|
12
|
-
Puppet::Type.type(:mount).provide(
|
13
|
-
:parsed,
|
14
|
-
:parent => Puppet::Provider::ParsedFile,
|
15
|
-
:default_target => fstab,
|
16
|
-
:filetype => :flat
|
17
|
-
) do
|
18
|
-
include Puppet::Provider::Mount
|
19
|
-
|
20
|
-
commands :mountcmd => "mount", :umount => "umount"
|
21
|
-
|
22
|
-
case Facter.value(:osfamily)
|
23
|
-
when "Solaris"
|
24
|
-
@fields = [:device, :blockdevice, :name, :fstype, :pass, :atboot, :options]
|
25
|
-
else
|
26
|
-
@fields = [:device, :name, :fstype, :options, :dump, :pass]
|
27
|
-
end
|
28
|
-
|
29
|
-
if Facter.value(:osfamily) == "AIX"
|
30
|
-
# * is the comment character on AIX /etc/filesystems
|
31
|
-
text_line :comment, :match => /^\s*\*/
|
32
|
-
else
|
33
|
-
text_line :comment, :match => /^\s*#/
|
34
|
-
end
|
35
|
-
text_line :blank, :match => /^\s*$/
|
36
|
-
|
37
|
-
optional_fields = @fields - [:device, :name, :blockdevice]
|
38
|
-
mandatory_fields = @fields - optional_fields
|
39
|
-
|
40
|
-
# fstab will ignore lines that have fewer than the mandatory number of columns,
|
41
|
-
# so we should, too.
|
42
|
-
field_pattern = '(\s*(?>\S+))'
|
43
|
-
text_line :incomplete, :match => /^(?!#{field_pattern}{#{mandatory_fields.length}})/
|
44
|
-
|
45
|
-
case Facter.value(:osfamily)
|
46
|
-
when "AIX"
|
47
|
-
# The only field that is actually ordered is :name. See `man filesystems` on AIX
|
48
|
-
@fields = [:name, :account, :boot, :check, :dev, :free, :mount, :nodename,
|
49
|
-
:options, :quota, :size, :type, :vfs, :vol, :log]
|
50
|
-
self.line_separator = "\n"
|
51
|
-
# Override lines and use scan instead of split, because we DON'T want to
|
52
|
-
# remove the separators
|
53
|
-
def self.lines(text)
|
54
|
-
lines = text.split("\n")
|
55
|
-
filesystem_stanza = false
|
56
|
-
filesystem_index = 0
|
57
|
-
ret = Array.new
|
58
|
-
lines.each_with_index do |line,i|
|
59
|
-
if line.match(%r{^\S+:})
|
60
|
-
# Begin new filesystem stanza and save the index
|
61
|
-
ret[filesystem_index] = filesystem_stanza.join("\n") if filesystem_stanza
|
62
|
-
filesystem_stanza = Array(line)
|
63
|
-
filesystem_index = i
|
64
|
-
# Eat the preceding blank line
|
65
|
-
ret[i-1] = nil if i > 0 and ret[i-1] and ret[i-1].match(%r{^\s*$})
|
66
|
-
nil
|
67
|
-
elsif line.match(%r{^(\s*\*.*|\s*)$})
|
68
|
-
# Just a comment or blank line; add in place
|
69
|
-
ret[i] = line
|
70
|
-
else
|
71
|
-
# Non-comments or blank lines must be part of a stanza
|
72
|
-
filesystem_stanza << line
|
73
|
-
end
|
74
|
-
end
|
75
|
-
# Add the final stanza to the return
|
76
|
-
ret[filesystem_index] = filesystem_stanza.join("\n") if filesystem_stanza
|
77
|
-
ret = ret.compact.flatten
|
78
|
-
ret.reject { |line| line.match(/^\* HEADER/) }
|
79
|
-
end
|
80
|
-
def self.header
|
81
|
-
super.gsub(/^#/,'*')
|
82
|
-
end
|
83
|
-
|
84
|
-
record_line self.name,
|
85
|
-
:fields => @fields,
|
86
|
-
:separator => /\n/,
|
87
|
-
:block_eval => :instance do
|
88
|
-
|
89
|
-
def post_parse(result)
|
90
|
-
property_map = {
|
91
|
-
:dev => :device,
|
92
|
-
:nodename => :nodename,
|
93
|
-
:options => :options,
|
94
|
-
:vfs => :fstype,
|
95
|
-
}
|
96
|
-
# Result is modified in-place instead of being returned; icky!
|
97
|
-
memo = result.dup
|
98
|
-
result.clear
|
99
|
-
# Save the line for later, just in case it is unparsable
|
100
|
-
result[:line] = @fields.collect do |field|
|
101
|
-
memo[field] if memo[field] != :absent
|
102
|
-
end.compact.join("\n")
|
103
|
-
result[:record_type] = memo[:record_type]
|
104
|
-
special_options = Array.new
|
105
|
-
result[:name] = memo[:name].sub(%r{:\s*$},'').strip
|
106
|
-
memo.each do |_,k_v|
|
107
|
-
if k_v and k_v.is_a?(String) and k_v.match("=")
|
108
|
-
attr_name, attr_value = k_v.split("=",2).map(&:strip)
|
109
|
-
if attr_map_name = property_map[attr_name.to_sym]
|
110
|
-
# These are normal "options" options (see `man filesystems`)
|
111
|
-
result[attr_map_name] = attr_value
|
112
|
-
else
|
113
|
-
# These /etc/filesystem attributes have no mount resource simile,
|
114
|
-
# so are added to the "options" property for puppet's sake
|
115
|
-
special_options << "#{attr_name}=#{attr_value}"
|
116
|
-
end
|
117
|
-
if result[:nodename]
|
118
|
-
result[:device] = "#{result[:nodename]}:#{result[:device]}"
|
119
|
-
result.delete(:nodename)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
result[:options] = [result[:options],special_options.sort].flatten.compact.join(',')
|
124
|
-
if ! result[:device]
|
125
|
-
result[:device] = :absent
|
126
|
-
#TRANSLATORS "prefetch" is a program name and should not be translated
|
127
|
-
Puppet.err _("Prefetch: Mount[%{name}]: Field 'device' is missing") % { name: result[:name] }
|
128
|
-
end
|
129
|
-
if ! result[:fstype]
|
130
|
-
result[:fstype] = :absent
|
131
|
-
#TRANSLATORS "prefetch" is a program name and should not be translated
|
132
|
-
Puppet.err _("Prefetch: Mount[%{name}]: Field 'fstype' is missing") % { name: result[:name] }
|
133
|
-
end
|
134
|
-
end
|
135
|
-
def to_line(result)
|
136
|
-
output = Array.new
|
137
|
-
output << "#{result[:name]}:"
|
138
|
-
if result[:device] and result[:device].match(%r{^/})
|
139
|
-
output << "\tdev\t\t= #{result[:device]}"
|
140
|
-
elsif result[:device] and result[:device] != :absent
|
141
|
-
if ! result[:device].match(%{^.+:/})
|
142
|
-
# Just skip this entry; it was malformed to begin with
|
143
|
-
Puppet.err _("Mount[%{name}]: Field 'device' must be in the format of <absolute path> or <host>:<absolute path>") % { name: result[:name] }
|
144
|
-
return result[:line]
|
145
|
-
end
|
146
|
-
nodename, path = result[:device].split(":")
|
147
|
-
output << "\tdev\t\t= #{path}"
|
148
|
-
output << "\tnodename\t= #{nodename}"
|
149
|
-
else
|
150
|
-
# Just skip this entry; it was malformed to begin with
|
151
|
-
Puppet.err _("Mount[%{name}]: Field 'device' is required") % { name: result[:name] }
|
152
|
-
return result[:line]
|
153
|
-
end
|
154
|
-
if result[:fstype] and result[:fstype] != :absent
|
155
|
-
output << "\tvfs\t\t= #{result[:fstype]}"
|
156
|
-
else
|
157
|
-
# Just skip this entry; it was malformed to begin with
|
158
|
-
Puppet.err _("Mount[%{name}]: Field 'device' is required") % { name: result[:name] }
|
159
|
-
return result[:line]
|
160
|
-
end
|
161
|
-
if result[:options]
|
162
|
-
options = result[:options].split(',')
|
163
|
-
special_options = options.select do |x|
|
164
|
-
x.match('=') and
|
165
|
-
["account", "boot", "check", "free", "mount", "size", "type",
|
166
|
-
"vol", "log", "quota"].include? x.split('=').first
|
167
|
-
end
|
168
|
-
options = options - special_options
|
169
|
-
special_options.sort.each do |x|
|
170
|
-
k, v = x.split("=")
|
171
|
-
output << "\t#{k}\t\t= #{v}"
|
172
|
-
end
|
173
|
-
output << "\toptions\t\t= #{options.join(",")}" unless options.empty?
|
174
|
-
end
|
175
|
-
if result[:line] and result[:line].split("\n").sort == output.sort
|
176
|
-
return "\n#{result[:line]}"
|
177
|
-
else
|
178
|
-
return "\n#{output.join("\n")}"
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
|
-
else
|
183
|
-
record_line self.name, :fields => @fields, :separator => /\s+/, :joiner => "\t", :optional => optional_fields, :block_eval => :instance do
|
184
|
-
def pre_gen(record)
|
185
|
-
if !record[:options] || record[:options].empty?
|
186
|
-
if Facter.value(:kernel) == 'Linux'
|
187
|
-
record[:options] = 'defaults'
|
188
|
-
else
|
189
|
-
raise Puppet::Error, _("Mount[%{name}]: Field 'options' is required") % { name: record[:name] }
|
190
|
-
end
|
191
|
-
end
|
192
|
-
if !record[:fstype] || record[:fstype].empty?
|
193
|
-
raise Puppet::Error, _("Mount[%{name}]: Field 'fstype' is required") % { name: record[:name] }
|
194
|
-
end
|
195
|
-
record
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
# Every entry in fstab is :unmounted until we can prove different
|
201
|
-
def self.prefetch_hook(target_records)
|
202
|
-
target_records.collect do |record|
|
203
|
-
record[:ensure] = :unmounted if record[:record_type] == :parsed
|
204
|
-
record
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
def self.instances
|
209
|
-
providers = super
|
210
|
-
mounts = mountinstances.dup
|
211
|
-
|
212
|
-
# Update fstab entries that are mounted
|
213
|
-
providers.each do |prov|
|
214
|
-
if mounts.delete({:name => prov.get(:name), :mounted => :yes}) then
|
215
|
-
prov.set(:ensure => :mounted)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
# Add mounts that are not in fstab but mounted
|
220
|
-
mounts.each do |mount|
|
221
|
-
providers << new(:ensure => :ghost, :name => mount[:name])
|
222
|
-
end
|
223
|
-
providers
|
224
|
-
end
|
225
|
-
|
226
|
-
def self.prefetch(resources = nil)
|
227
|
-
# Get providers for all resources the user defined and that match
|
228
|
-
# a record in /etc/fstab.
|
229
|
-
super
|
230
|
-
# We need to do two things now:
|
231
|
-
# - Update ensure from :unmounted to :mounted if the resource is mounted
|
232
|
-
# - Check for mounted devices that are not in fstab and
|
233
|
-
# set ensure to :ghost (if the user wants to add an entry
|
234
|
-
# to fstab we need to know if the device was mounted before)
|
235
|
-
mountinstances.each do |hash|
|
236
|
-
if mount = resources[hash[:name]]
|
237
|
-
case mount.provider.get(:ensure)
|
238
|
-
when :absent # Mount not in fstab
|
239
|
-
mount.provider.set(:ensure => :ghost)
|
240
|
-
when :unmounted # Mount in fstab
|
241
|
-
mount.provider.set(:ensure => :mounted)
|
242
|
-
end
|
243
|
-
end
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
def self.mountinstances
|
248
|
-
# XXX: Will not work for mount points that have spaces in path (does fstab support this anyways?)
|
249
|
-
regex = case Facter.value(:osfamily)
|
250
|
-
when "Darwin"
|
251
|
-
/ on (?:\/private\/var\/automount)?(\S*)/
|
252
|
-
when "Solaris", "HP-UX"
|
253
|
-
/^(\S*) on /
|
254
|
-
when "AIX"
|
255
|
-
/^(?:\S*\s+\S+\s+)(\S+)/
|
256
|
-
else
|
257
|
-
/ on (\S*)/
|
258
|
-
end
|
259
|
-
instances = []
|
260
|
-
mount_output = mountcmd.split("\n")
|
261
|
-
if mount_output.length >= 2 and mount_output[1] =~ /^[- \t]*$/
|
262
|
-
# On some OSes (e.g. AIX) mount output begins with a header line
|
263
|
-
# followed by a line consisting of dashes and whitespace.
|
264
|
-
# Discard these two lines.
|
265
|
-
mount_output[0..1] = []
|
266
|
-
end
|
267
|
-
mount_output.each do |line|
|
268
|
-
if match = regex.match(line) and name = match.captures.first
|
269
|
-
instances << {:name => name, :mounted => :yes} # Only :name is important here
|
270
|
-
else
|
271
|
-
raise Puppet::Error, _("Could not understand line %{line} from mount output") % { line: line }
|
272
|
-
end
|
273
|
-
end
|
274
|
-
instances
|
275
|
-
end
|
276
|
-
|
277
|
-
def flush
|
278
|
-
needs_mount = @property_hash.delete(:needs_mount)
|
279
|
-
super
|
280
|
-
mount if needs_mount
|
281
|
-
end
|
282
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
require 'puppet'
|
2
|
-
|
3
|
-
# A module just to store the mount/unmount methods. Individual providers
|
4
|
-
# still need to add the mount commands manually.
|
5
|
-
module Puppet::Provider::Mount
|
6
|
-
# This only works when the mount point is synced to the fstab.
|
7
|
-
def mount
|
8
|
-
args = []
|
9
|
-
|
10
|
-
# In general we do not have to pass mountoptions because we always
|
11
|
-
# flush /etc/fstab before attempting to mount. But old code suggests
|
12
|
-
# that MacOS always needs the mount options to be explicitly passed to
|
13
|
-
# the mount command
|
14
|
-
if Facter.value(:kernel) == 'Darwin'
|
15
|
-
args << "-o" << self.options if self.options and self.options != :absent
|
16
|
-
end
|
17
|
-
args << resource[:name]
|
18
|
-
|
19
|
-
mountcmd(*args)
|
20
|
-
case get(:ensure)
|
21
|
-
when :absent; set(:ensure => :ghost)
|
22
|
-
when :unmounted; set(:ensure => :mounted)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def remount
|
27
|
-
#TRANSLATORS refers to remounting a file system
|
28
|
-
info _("Remounting")
|
29
|
-
os = Facter.value(:operatingsystem)
|
30
|
-
supports_remounts = (resource[:remounts] == :true)
|
31
|
-
if supports_remounts && os == 'AIX'
|
32
|
-
remount_with_option("remount")
|
33
|
-
elsif os.match(/^(FreeBSD|DragonFly|OpenBSD)$/)
|
34
|
-
remount_with_option("update")
|
35
|
-
elsif supports_remounts
|
36
|
-
mountcmd "-o", "remount", resource[:name]
|
37
|
-
else
|
38
|
-
unmount
|
39
|
-
mount
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# Remount by appending the supplied param "option" to any existing explicitly
|
44
|
-
# defined options. If resource has no explicitly defined options, will mount
|
45
|
-
# with only "option".
|
46
|
-
# @param [String] option A remount option to use or append with existing options
|
47
|
-
#
|
48
|
-
def remount_with_option(option)
|
49
|
-
if using_explicit_options?
|
50
|
-
options = self.options + "," + option
|
51
|
-
else
|
52
|
-
options = option
|
53
|
-
end
|
54
|
-
mountcmd "-o", options, resource[:name]
|
55
|
-
end
|
56
|
-
|
57
|
-
def using_explicit_options?
|
58
|
-
!self.options.nil? && !self.options.empty?
|
59
|
-
end
|
60
|
-
|
61
|
-
# This only works when the mount point is synced to the fstab.
|
62
|
-
def unmount
|
63
|
-
umount(resource[:name])
|
64
|
-
|
65
|
-
# Update property hash for future queries (e.g. refresh is called)
|
66
|
-
case get(:ensure)
|
67
|
-
when :mounted; set(:ensure => :unmounted)
|
68
|
-
when :ghost; set(:ensure => :absent)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# Is the mount currently mounted?
|
73
|
-
def mounted?
|
74
|
-
[:mounted, :ghost].include?(get(:ensure))
|
75
|
-
end
|
76
|
-
end
|