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.

Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bolt/transport/ssh/connection.rb +4 -5
  3. data/lib/bolt/transport/ssh.rb +4 -1
  4. data/lib/bolt/transport/winrm/connection.rb +3 -4
  5. data/lib/bolt/transport/winrm.rb +4 -1
  6. data/lib/bolt/version.rb +1 -1
  7. data/libexec/apply_catalog.rb +10 -2
  8. data/vendored/puppet/lib/puppet/application/apply.rb +20 -9
  9. data/vendored/puppet/lib/puppet/application/cert.rb +3 -1
  10. data/vendored/puppet/lib/puppet/application/device.rb +22 -5
  11. data/vendored/puppet/lib/puppet/configurer/fact_handler.rb +5 -1
  12. data/vendored/puppet/lib/puppet/configurer.rb +15 -2
  13. data/vendored/puppet/lib/puppet/defaults.rb +36 -25
  14. data/vendored/puppet/lib/puppet/face/certificate.rb +2 -0
  15. data/vendored/puppet/lib/puppet/feature/base.rb +0 -3
  16. data/vendored/puppet/lib/puppet/functions/call.rb +37 -0
  17. data/vendored/puppet/lib/puppet/functions.rb +5 -0
  18. data/vendored/puppet/lib/puppet/indirector/ldap.rb +6 -0
  19. data/vendored/puppet/lib/puppet/node/environment.rb +4 -2
  20. data/vendored/puppet/lib/puppet/parser/scope.rb +2 -2
  21. data/vendored/puppet/lib/puppet/pops/adapters.rb +14 -0
  22. data/vendored/puppet/lib/puppet/pops/evaluator/deferred_resolver.rb +128 -0
  23. data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +4 -1
  24. data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +2 -0
  25. data/vendored/puppet/lib/puppet/pops/issues.rb +9 -1
  26. data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +0 -16
  27. data/vendored/puppet/lib/puppet/pops/loaders.rb +1 -3
  28. data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +6 -6
  29. data/vendored/puppet/lib/puppet/pops/pcore.rb +11 -0
  30. data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +17 -0
  31. data/vendored/puppet/lib/puppet/pops/validation/tasks_checker.rb +13 -5
  32. data/vendored/puppet/lib/puppet/pops.rb +1 -0
  33. data/vendored/puppet/lib/puppet/provider/service/debian.rb +1 -0
  34. data/vendored/puppet/lib/puppet/provider/service/smf.rb +2 -3
  35. data/vendored/puppet/lib/puppet/provider/service/upstart.rb +10 -2
  36. data/vendored/puppet/lib/puppet/ssl/certificate_authority.rb +6 -84
  37. data/vendored/puppet/lib/puppet/ssl/certificate_request.rb +11 -3
  38. data/vendored/puppet/lib/puppet/type/file.rb +3 -0
  39. data/vendored/puppet/lib/puppet/type/user.rb +17 -3
  40. data/vendored/puppet/lib/puppet/util/autoload.rb +36 -31
  41. data/vendored/puppet/lib/puppet/util.rb +2 -0
  42. metadata +3 -43
  43. data/vendored/puppet/lib/puppet/indirector/node/write_only_yaml.rb +0 -39
  44. data/vendored/puppet/lib/puppet/provider/augeas/augeas.rb +0 -573
  45. data/vendored/puppet/lib/puppet/provider/cisco.rb +0 -9
  46. data/vendored/puppet/lib/puppet/provider/computer/computer.rb +0 -20
  47. data/vendored/puppet/lib/puppet/provider/host/parsed.rb +0 -46
  48. data/vendored/puppet/lib/puppet/provider/interface/cisco.rb +0 -27
  49. data/vendored/puppet/lib/puppet/provider/macauthorization/macauthorization.rb +0 -298
  50. data/vendored/puppet/lib/puppet/provider/mcx/mcxcontent.rb +0 -173
  51. data/vendored/puppet/lib/puppet/provider/mount/parsed.rb +0 -282
  52. data/vendored/puppet/lib/puppet/provider/mount.rb +0 -76
  53. data/vendored/puppet/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +0 -590
  54. data/vendored/puppet/lib/puppet/provider/selboolean/getsetsebool.rb +0 -47
  55. data/vendored/puppet/lib/puppet/provider/selmodule/semodule.rb +0 -140
  56. data/vendored/puppet/lib/puppet/provider/ssh_authorized_key/parsed.rb +0 -105
  57. data/vendored/puppet/lib/puppet/provider/sshkey/parsed.rb +0 -50
  58. data/vendored/puppet/lib/puppet/provider/vlan/cisco.rb +0 -28
  59. data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +0 -315
  60. data/vendored/puppet/lib/puppet/type/augeas.rb +0 -211
  61. data/vendored/puppet/lib/puppet/type/computer.rb +0 -66
  62. data/vendored/puppet/lib/puppet/type/host.rb +0 -95
  63. data/vendored/puppet/lib/puppet/type/interface.rb +0 -121
  64. data/vendored/puppet/lib/puppet/type/k5login.rb +0 -165
  65. data/vendored/puppet/lib/puppet/type/macauthorization.rb +0 -167
  66. data/vendored/puppet/lib/puppet/type/mcx.rb +0 -98
  67. data/vendored/puppet/lib/puppet/type/mount.rb +0 -314
  68. data/vendored/puppet/lib/puppet/type/router.rb +0 -17
  69. data/vendored/puppet/lib/puppet/type/scheduled_task.rb +0 -183
  70. data/vendored/puppet/lib/puppet/type/selboolean.rb +0 -26
  71. data/vendored/puppet/lib/puppet/type/selmodule.rb +0 -59
  72. data/vendored/puppet/lib/puppet/type/ssh_authorized_key.rb +0 -143
  73. data/vendored/puppet/lib/puppet/type/sshkey.rb +0 -83
  74. data/vendored/puppet/lib/puppet/type/vlan.rb +0 -26
  75. data/vendored/puppet/lib/puppet/type/yumrepo.rb +0 -430
  76. data/vendored/puppet/lib/puppet/util/network_device/cisco/device.rb +0 -285
  77. data/vendored/puppet/lib/puppet/util/network_device/cisco/facts.rb +0 -72
  78. data/vendored/puppet/lib/puppet/util/network_device/cisco/interface.rb +0 -94
  79. data/vendored/puppet/lib/puppet/util/network_device/cisco.rb +0 -4
  80. data/vendored/puppet/lib/puppet/util/network_device/ipcalc.rb +0 -68
  81. data/vendored/puppet/lib/puppet/util/network_device/transport/ssh.rb +0 -126
  82. data/vendored/puppet/lib/puppet/util/network_device/transport/telnet.rb +0 -47
  83. data/vendored/puppet/lib/puppet/util/windows/taskscheduler.rb +0 -1267
@@ -1,298 +0,0 @@
1
- require 'facter'
2
- require 'puppet/util/plist' if Puppet.features.cfpropertylist?
3
- require 'puppet'
4
- require 'tempfile'
5
-
6
- Puppet::Type.type(:macauthorization).provide :macauthorization, :parent => Puppet::Provider do
7
-
8
- desc "Manage Mac OS X authorization database rules and rights.
9
-
10
- "
11
-
12
- commands :security => "/usr/bin/security"
13
-
14
- confine :operatingsystem => :darwin
15
- confine :feature => :cfpropertylist
16
-
17
- defaultfor :operatingsystem => :darwin
18
-
19
- AuthDB = "/etc/authorization"
20
-
21
- @rights = {}
22
- @rules = {}
23
- @parsed_auth_db = {}
24
- @comment = "" # Not implemented yet. Is there any real need to?
25
-
26
- # This map exists due to the use of hyphens and reserved words in
27
- # the authorization schema.
28
- PuppetToNativeAttributeMap = { :allow_root => "allow-root",
29
- :authenticate_user => "authenticate-user",
30
- :auth_class => "class",
31
- :k_of_n => "k-of-n",
32
- :session_owner => "session-owner", }
33
-
34
- class << self
35
- attr_accessor :parsed_auth_db
36
- attr_accessor :rights
37
- attr_accessor :rules
38
- attr_accessor :comments # Not implemented yet.
39
-
40
- def prefetch(resources)
41
- self.populate_rules_rights
42
- end
43
-
44
- def instances
45
- if self.parsed_auth_db == {}
46
- self.prefetch(nil)
47
- end
48
- self.parsed_auth_db.collect do |k,v|
49
- new(:name => k)
50
- end
51
- end
52
-
53
- def populate_rules_rights
54
- auth_plist = Puppet::Util::Plist.parse_plist(AuthDB)
55
- raise Puppet::Error.new(_("Cannot parse: %{auth}") % { auth: AuthDB }) if not auth_plist
56
- self.rights = auth_plist["rights"].dup
57
- self.rules = auth_plist["rules"].dup
58
- self.parsed_auth_db = self.rights.dup
59
- self.parsed_auth_db.merge!(self.rules.dup)
60
- end
61
-
62
- end
63
-
64
- # standard required provider instance methods
65
-
66
- def initialize(resource)
67
- if self.class.parsed_auth_db == {}
68
- self.class.prefetch(resource)
69
- end
70
- super
71
- end
72
-
73
-
74
- def create
75
- # we just fill the @property_hash in here and let the flush method
76
- # deal with it rather than repeating code.
77
- new_values = {}
78
- validprops = Puppet::Type.type(resource.class.name).validproperties
79
- validprops.each do |prop|
80
- next if prop == :ensure
81
- if value = resource.should(prop) and value != ""
82
- new_values[prop] = value
83
- end
84
- end
85
- @property_hash = new_values.dup
86
- end
87
-
88
- def destroy
89
- # We explicitly delete here rather than in the flush method.
90
- case resource[:auth_type]
91
- when :right
92
- destroy_right
93
- when :rule
94
- destroy_rule
95
- else
96
- raise Puppet::Error.new(_("Must specify auth_type when destroying."))
97
- end
98
- end
99
-
100
- def exists?
101
- !!self.class.parsed_auth_db.has_key?(resource[:name])
102
- end
103
-
104
-
105
- def flush
106
- # deletion happens in the destroy methods
107
- if resource[:ensure] != :absent
108
- case resource[:auth_type]
109
- when :right
110
- flush_right
111
- when :rule
112
- flush_rule
113
- else
114
- raise Puppet::Error.new(_("flush requested for unknown type."))
115
- end
116
- @property_hash.clear
117
- end
118
- end
119
-
120
-
121
- # utility methods below
122
-
123
- def destroy_right
124
- security "authorizationdb", :remove, resource[:name]
125
- end
126
-
127
- def destroy_rule
128
- authdb = Puppet::Util::Plist.parse_plist(AuthDB)
129
- authdb_rules = authdb["rules"].dup
130
- if authdb_rules[resource[:name]]
131
- begin
132
- authdb["rules"].delete(resource[:name])
133
- Puppet::Util::Plist.write_plist_file(authdb, AuthDB)
134
- rescue Errno::EACCES => e
135
- raise Puppet::Error.new(_("Error saving %{auth}: %{error}") % { auth: AuthDB, error: e }, e)
136
- end
137
- end
138
- end
139
-
140
- def flush_right
141
- # first we re-read the right just to make sure we're in sync for
142
- # values that weren't specified in the manifest. As we're supplying
143
- # the whole plist when specifying the right it seems safest to be
144
- # paranoid given the low cost of querying the db once more.
145
- cmds = []
146
- cmds << :security << "authorizationdb" << "read" << resource[:name]
147
- output = execute(cmds, :failonfail => false, :combine => false)
148
- current_values = Puppet::Util::Plist.parse_plist(output)
149
- current_values ||= {}
150
- specified_values = convert_plist_to_native_attributes(@property_hash)
151
-
152
- # take the current values, merge the specified values to obtain a
153
- # complete description of the new values.
154
- new_values = current_values.merge(specified_values)
155
- set_right(resource[:name], new_values)
156
- end
157
-
158
- def flush_rule
159
- authdb = Puppet::Util::Plist.parse_plist(AuthDB)
160
- authdb_rules = authdb["rules"].dup
161
- current_values = {}
162
- current_values = authdb_rules[resource[:name]] if authdb_rules[resource[:name]]
163
- specified_values = convert_plist_to_native_attributes(@property_hash)
164
- new_values = current_values.merge(specified_values)
165
- set_rule(resource[:name], new_values)
166
- end
167
-
168
- def set_right(name, values)
169
- # Both creates and modifies rights as it simply overwrites them.
170
- # The security binary only allows for writes using stdin, so we
171
- # dump the values to a tempfile.
172
- values = convert_plist_to_native_attributes(values)
173
- tmp = Tempfile.new('puppet_macauthorization')
174
- begin
175
- Puppet::Util::Plist.write_plist_file(values, tmp.path)
176
- cmds = []
177
- cmds << :security << "authorizationdb" << "write" << name
178
- execute(cmds, :failonfail => false, :combine => false, :stdinfile => tmp.path.to_s)
179
- rescue Errno::EACCES => e
180
- raise Puppet::Error.new(_("Cannot save right to %{path}: %{error}") % { path: tmp.path, error: e }, e)
181
- ensure
182
- tmp.close
183
- tmp.unlink
184
- end
185
- end
186
-
187
- def set_rule(name, values)
188
- # Both creates and modifies rules as it overwrites the entry in the
189
- # rules dictionary. Unfortunately the security binary doesn't
190
- # support modifying rules at all so we have to twiddle the whole
191
- # plist... :( See Apple Bug #6386000
192
- values = convert_plist_to_native_attributes(values)
193
- authdb = Puppet::Util::Plist.parse_plist(AuthDB)
194
- authdb["rules"][name] = values
195
-
196
- begin
197
- Puppet::Util::Plist.write_plist_file(authdb, AuthDB)
198
- rescue
199
- raise Puppet::Error.new(_("Error writing to: %{auth_db}") % { auth_db: AuthDB })
200
- end
201
- end
202
-
203
- def convert_plist_to_native_attributes(propertylist)
204
- # This mainly converts the keys from the puppet attributes to the
205
- # 'native' ones, but also enforces that the keys are all Strings
206
- # rather than Symbols so that any merges of the resultant Hash are
207
- # sane. The exception is booleans, where we coerce to a proper bool
208
- # if they come in as a symbol.
209
- newplist = {}
210
- propertylist.each_pair do |key, value|
211
- next if key == :ensure # not part of the auth db schema.
212
- next if key == :auth_type # not part of the auth db schema.
213
- case value
214
- when true, :true
215
- value = true
216
- when false, :false
217
- value = false
218
- end
219
- new_key = key
220
- if PuppetToNativeAttributeMap.has_key?(key)
221
- new_key = PuppetToNativeAttributeMap[key].to_s
222
- elsif not key.is_a?(String)
223
- new_key = key.to_s
224
- end
225
- newplist[new_key] = value
226
- end
227
- newplist
228
- end
229
-
230
- def retrieve_value(resource_name, attribute)
231
- # We set boolean values to symbols when retrieving values
232
- raise Puppet::Error.new(_("Cannot find %{resource_name} in auth db") % { resource_name: resource_name }) if not self.class.parsed_auth_db.has_key?(resource_name)
233
-
234
- if PuppetToNativeAttributeMap.has_key?(attribute)
235
- native_attribute = PuppetToNativeAttributeMap[attribute]
236
- else
237
- native_attribute = attribute.to_s
238
- end
239
-
240
- if self.class.parsed_auth_db[resource_name].has_key?(native_attribute)
241
- value = self.class.parsed_auth_db[resource_name][native_attribute]
242
- case value
243
- when true, :true
244
- value = :true
245
- when false, :false
246
- value = :false
247
- end
248
-
249
- @property_hash[attribute] = value
250
- return value
251
- else
252
- @property_hash.delete(attribute)
253
- return "" # so ralsh doesn't display it.
254
- end
255
- end
256
-
257
-
258
- # property methods below
259
- #
260
- # We define them all dynamically apart from auth_type which is a special
261
- # case due to not being in the actual authorization db schema.
262
-
263
- properties = [ :allow_root, :authenticate_user, :auth_class, :comment,
264
- :group, :k_of_n, :mechanisms, :rule, :session_owner,
265
- :shared, :timeout, :tries ]
266
-
267
- properties.each do |field|
268
- define_method(field.to_s) do
269
- retrieve_value(resource[:name], field)
270
- end
271
-
272
- define_method(field.to_s + "=") do |value|
273
- @property_hash[field] = value
274
- end
275
- end
276
-
277
- def auth_type
278
- if resource.should(:auth_type) != nil
279
- return resource.should(:auth_type)
280
- elsif self.exists?
281
- # this is here just for ralsh, so it can work out what type it is.
282
- if self.class.rights.has_key?(resource[:name])
283
- return :right
284
- elsif self.class.rules.has_key?(resource[:name])
285
- return :rule
286
- else
287
- raise Puppet::Error.new(_("%{resource} is unknown type.") % { resource: resource[:name] })
288
- end
289
- else
290
- raise Puppet::Error.new(_("auth_type required for new resources."))
291
- end
292
- end
293
-
294
- def auth_type=(value)
295
- @property_hash[:auth_type] = value
296
- end
297
-
298
- end
@@ -1,173 +0,0 @@
1
- require 'tempfile'
2
-
3
- Puppet::Type.type(:mcx).provide :mcxcontent, :parent => Puppet::Provider do
4
-
5
- desc "MCX Settings management using DirectoryService on OS X.
6
-
7
- This provider manages the entire MCXSettings attribute available
8
- to some directory services nodes. This management is 'all or nothing'
9
- in that discrete application domain key value pairs are not managed
10
- by this provider.
11
-
12
- It is recommended to use WorkGroup Manager to configure Users, Groups,
13
- Computers, or ComputerLists, then use 'ralsh mcx' to generate a puppet
14
- manifest from the resulting configuration.
15
-
16
- Original Author: Jeff McCune (mccune.jeff@gmail.com)
17
-
18
- "
19
-
20
- # This provides a mapping of puppet types to DirectoryService
21
- # type strings.
22
- TypeMap = {
23
- :user => "Users",
24
- :group => "Groups",
25
- :computer => "Computers",
26
- :computerlist => "ComputerLists",
27
- }
28
-
29
- class MCXContentProviderException < Exception
30
-
31
- end
32
-
33
- commands :dscl => "/usr/bin/dscl"
34
- confine :operatingsystem => :darwin
35
- defaultfor :operatingsystem => :darwin
36
-
37
- def self.instances
38
- mcx_list = []
39
- TypeMap.each_key do |ds_type|
40
- ds_path = "/Local/Default/#{TypeMap[ds_type]}"
41
- output = dscl 'localhost', '-list', ds_path
42
- member_list = output.split
43
- member_list.each do |ds_name|
44
- content = mcxexport(ds_type, ds_name)
45
- if content.empty?
46
- Puppet.debug "/#{TypeMap[ds_type]}/#{ds_name} has no MCX data."
47
- else
48
- # This node has MCX data.
49
-
50
- mcx_list << self.new(
51
- :name => "/#{TypeMap[ds_type]}/#{ds_name}",
52
- :ds_type => ds_type,
53
- :ds_name => ds_name,
54
- :content => content
55
- )
56
- end
57
- end
58
- end
59
- mcx_list
60
- end
61
-
62
- def self.mcxexport(ds_type, ds_name)
63
- ds_t = TypeMap[ds_type]
64
- ds_n = ds_name.to_s
65
- ds_path = "/Local/Default/#{ds_t}/#{ds_n}"
66
- dscl 'localhost', '-mcxexport', ds_path
67
- end
68
-
69
-
70
- def create
71
- self.content=(resource[:content])
72
- end
73
-
74
- def destroy
75
- ds_parms = get_dsparams
76
- ds_t = TypeMap[ds_parms[:ds_type]]
77
- ds_n = ds_parms[:ds_name].to_s
78
- ds_path = "/Local/Default/#{ds_t}/#{ds_n}"
79
-
80
- dscl 'localhost', '-mcxdelete', ds_path
81
- end
82
-
83
- def exists?
84
- begin
85
- has_mcx?
86
- rescue Puppet::ExecutionFailure
87
- return false
88
- end
89
- end
90
-
91
- def content
92
- ds_parms = get_dsparams
93
-
94
- self.class.mcxexport(ds_parms[:ds_type], ds_parms[:ds_name])
95
- end
96
-
97
- def content=(value)
98
- # dscl localhost -mcximport
99
- ds_parms = get_dsparams
100
-
101
- mcximport(ds_parms[:ds_type], ds_parms[:ds_name], resource[:content])
102
- end
103
-
104
- private
105
-
106
- def has_mcx?
107
- !content.empty?
108
- end
109
-
110
- def mcximport(ds_type, ds_name, val)
111
- ds_t = TypeMap[ds_type]
112
- ds_path = "/Local/Default/#{ds_t}/#{ds_name}"
113
-
114
- if has_mcx?
115
- Puppet.debug "Removing MCX from #{ds_path}"
116
- dscl 'localhost', '-mcxdelete', ds_path
117
- end
118
-
119
- # val being passed in is resource[:content] which should be UTF-8
120
- tmp = Tempfile.new('puppet_mcx', :encoding => Encoding::UTF_8)
121
- begin
122
- tmp << val
123
- tmp.flush
124
- Puppet.debug "Importing MCX into #{ds_path}"
125
- dscl 'localhost', '-mcximport', ds_path, tmp.path
126
- ensure
127
- tmp.close
128
- tmp.unlink
129
- end
130
- end
131
-
132
- # Given the resource name string, parse ds_type out.
133
- def parse_type(name)
134
- ds_type = name.split('/')[1]
135
- unless ds_type
136
- raise MCXContentProviderException,
137
- _("Could not parse ds_type from resource name '%{name}'. Specify with ds_type parameter.") % { name: name }
138
- end
139
- # De-pluralize and downcase.
140
- ds_type = ds_type.chop.downcase.to_sym
141
- unless TypeMap.key? ds_type
142
- raise MCXContentProviderException,
143
- _("Could not parse ds_type from resource name '%{name}'. Specify with ds_type parameter.") % { name: name }
144
- end
145
- ds_type
146
- end
147
-
148
- # Given the resource name string, parse ds_name out.
149
- def parse_name(name)
150
- ds_name = name.split('/')[2]
151
- unless ds_name
152
- raise MCXContentProviderException,
153
- _("Could not parse ds_name from resource name '%{name}'. Specify with ds_name parameter.") % { name: name }
154
- end
155
- ds_name
156
- end
157
-
158
- # Gather ds_type and ds_name from resource or parse it out of the name.
159
- def get_dsparams
160
- ds_type = resource[:ds_type]
161
- ds_type ||= parse_type(resource[:name])
162
- raise MCXContentProviderException unless TypeMap.keys.include? ds_type.to_sym
163
-
164
- ds_name = resource[:ds_name]
165
- ds_name ||= parse_name(resource[:name])
166
-
167
- {
168
- :ds_type => ds_type.to_sym,
169
- :ds_name => ds_name,
170
- }
171
- end
172
-
173
- end