puppet 3.7.1-x86-mingw32 → 3.7.2-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/build_defaults.yaml +3 -3
- data/ext/debian/control +2 -0
- data/ext/project_data.yaml +2 -2
- data/lib/puppet/application.rb +1 -4
- data/lib/puppet/configurer.rb +6 -4
- data/lib/puppet/environments.rb +47 -3
- data/lib/puppet/indirector/node/exec.rb +1 -1
- data/lib/puppet/indirector/request.rb +1 -2
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/module_tool.rb +1 -1
- data/lib/puppet/network/http/webrick.rb +17 -7
- data/lib/puppet/node.rb +2 -2
- data/lib/puppet/parser/ast/pops_bridge.rb +1 -11
- data/lib/puppet/parser/compiler.rb +1 -2
- data/lib/puppet/parser/resource.rb +1 -3
- data/lib/puppet/parser/resource/param.rb +1 -1
- data/lib/puppet/parser/type_loader.rb +1 -1
- data/lib/puppet/pops/evaluator/access_operator.rb +3 -11
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +30 -4
- data/lib/puppet/pops/model/factory.rb +16 -1
- data/lib/puppet/pops/parser/egrammar.ra +1 -1
- data/lib/puppet/pops/parser/eparser.rb +1 -1
- data/lib/puppet/pops/parser/parser_support.rb +19 -1
- data/lib/puppet/pops/types/type_calculator.rb +19 -14
- data/lib/puppet/provider/package/pkg.rb +12 -1
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +15 -16
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +16 -0
- data/lib/puppet/resource.rb +1 -8
- data/lib/puppet/settings.rb +17 -0
- data/lib/puppet/type/user.rb +11 -1
- data/lib/puppet/util/autoload.rb +10 -6
- data/lib/puppet/util/monkey_patches.rb +2 -2
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.certificate_warning +2 -0
- data/spec/fixtures/unit/type/user/authorized_keys +1 -0
- data/spec/integration/application/apply_spec.rb +29 -23
- data/spec/integration/parser/future_compiler_spec.rb +56 -0
- data/spec/integration/type/user_spec.rb +22 -1
- data/spec/lib/puppet_spec/files.rb +1 -0
- data/spec/unit/environments_spec.rb +99 -0
- data/spec/unit/network/http/webrick_spec.rb +21 -2
- data/spec/unit/parser/compiler_spec.rb +19 -1
- data/spec/unit/parser/functions/lookup_spec.rb +13 -12
- data/spec/unit/parser/resource/param_spec.rb +10 -22
- data/spec/unit/parser/resource_spec.rb +0 -4
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +30 -5
- data/spec/unit/pops/parser/parse_calls_spec.rb +20 -5
- data/spec/unit/pops/types/type_calculator_spec.rb +61 -0
- data/spec/unit/provider/package/pkg_spec.rb +4 -0
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +47 -14
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +15 -0
- data/spec/unit/type/user_spec.rb +5 -0
- data/spec/unit/util/autoload_spec.rb +33 -14
- data/spec/unit/util/monkey_patches_spec.rb +12 -0
- data/tasks/memwalk.rake +195 -0
- metadata +3234 -3207
- checksums.yaml +0 -7
@@ -785,6 +785,14 @@ class Puppet::Pops::Model::Factory
|
|
785
785
|
STATEMENT_CALLS[name]
|
786
786
|
end
|
787
787
|
|
788
|
+
class ArgsToNonCallError < RuntimeError
|
789
|
+
attr_reader :args, :name_expr
|
790
|
+
def initialize(args, name_expr)
|
791
|
+
@args = args
|
792
|
+
@name_expr = name_expr
|
793
|
+
end
|
794
|
+
end
|
795
|
+
|
788
796
|
# Transforms an array of expressions containing literal name expressions to calls if followed by an
|
789
797
|
# expression, or expression list.
|
790
798
|
#
|
@@ -793,7 +801,12 @@ class Puppet::Pops::Model::Factory
|
|
793
801
|
expr = expr.current if expr.is_a?(Puppet::Pops::Model::Factory)
|
794
802
|
name = memo[-1]
|
795
803
|
if name.is_a?(Model::QualifiedName) && STATEMENT_CALLS[name.value]
|
796
|
-
|
804
|
+
if expr.is_a?(Array)
|
805
|
+
expr = expr.reject {|e| e.is_a?(Puppet::Pops::Parser::LexerSupport::TokenValue) }
|
806
|
+
else
|
807
|
+
expr = [expr]
|
808
|
+
end
|
809
|
+
the_call = Puppet::Pops::Model::Factory.CALL_NAMED(name, false, expr)
|
797
810
|
# last positioned is last arg if there are several
|
798
811
|
record_position(the_call, name, expr.is_a?(Array) ? expr[-1] : expr)
|
799
812
|
memo[-1] = the_call
|
@@ -803,6 +816,8 @@ class Puppet::Pops::Model::Factory
|
|
803
816
|
# an argument to the name to call transform above.
|
804
817
|
expr.rval_required = true
|
805
818
|
end
|
819
|
+
elsif expr.is_a?(Array)
|
820
|
+
raise ArgsToNonCallError.new(expr, name)
|
806
821
|
else
|
807
822
|
memo << expr
|
808
823
|
if expr.is_a?(Model::CallNamedFunctionExpression)
|
@@ -86,7 +86,7 @@ syntactic_statements
|
|
86
86
|
#
|
87
87
|
syntactic_statement
|
88
88
|
: assignment =LOW { result = val[0] }
|
89
|
-
| syntactic_statement COMMA assignment =LOW { result = aryfy(val[0]).push
|
89
|
+
| syntactic_statement COMMA assignment =LOW { result = aryfy(val[0]).push(val[1]).push(val[2]) }
|
90
90
|
|
91
91
|
# Assignment (is right recursive since assignment is right associative)
|
92
92
|
assignment
|
@@ -1296,7 +1296,7 @@ module_eval(<<'.,.,', 'egrammar.ra', 87)
|
|
1296
1296
|
|
1297
1297
|
module_eval(<<'.,.,', 'egrammar.ra', 88)
|
1298
1298
|
def _reduce_9(val, _values, result)
|
1299
|
-
result = aryfy(val[0]).push
|
1299
|
+
result = aryfy(val[0]).push(val[1]).push(val[2])
|
1300
1300
|
result
|
1301
1301
|
end
|
1302
1302
|
.,.,
|
@@ -163,7 +163,25 @@ class Puppet::Pops::Parser::Parser
|
|
163
163
|
# expression, or expression list
|
164
164
|
#
|
165
165
|
def transform_calls(expressions)
|
166
|
-
Factory
|
166
|
+
# Factory transform raises an error if a non qualified name is followed by an argument list
|
167
|
+
# since there is no way that that can be transformed back to sanity. This occurs in situations like this:
|
168
|
+
#
|
169
|
+
# $a = 10, notice hello
|
170
|
+
#
|
171
|
+
# where the "10, notice" forms an argument list. The parser builds an Array with the expressions and includes
|
172
|
+
# the comma tokens to enable the error to be reported against the first comma.
|
173
|
+
#
|
174
|
+
begin
|
175
|
+
Factory.transform_calls(expressions)
|
176
|
+
rescue Puppet::Pops::Model::Factory::ArgsToNonCallError => e
|
177
|
+
# e.args[1] is the first comma token in the list
|
178
|
+
# e.name_expr is the function name expression
|
179
|
+
if e.name_expr.is_a?(Puppet::Pops::Model::QualifiedName)
|
180
|
+
error(e.args[1], "attempt to pass argument list to the function '#{e.name_expr.value}' which cannot be called without parentheses")
|
181
|
+
else
|
182
|
+
error(e.args[1], "illegal comma separated argument list")
|
183
|
+
end
|
184
|
+
end
|
167
185
|
end
|
168
186
|
|
169
187
|
# Transforms a LEFT followed by the result of attribute_operations, this may be a call or an invalid sequence
|
@@ -453,12 +453,11 @@ class Puppet::Pops::Types::TypeCalculator
|
|
453
453
|
end
|
454
454
|
|
455
455
|
def instance_of_PNilType(t, o)
|
456
|
-
|
456
|
+
o.nil? || o == :undef
|
457
457
|
end
|
458
458
|
|
459
459
|
def instance_of_POptionalType(t, o)
|
460
|
-
|
461
|
-
instance_of(t.optional_type, o)
|
460
|
+
instance_of_PNilType(t, o) || instance_of(t.optional_type, o)
|
462
461
|
end
|
463
462
|
|
464
463
|
def instance_of_PVariantType(t, o)
|
@@ -786,7 +785,6 @@ class Puppet::Pops::Types::TypeCalculator
|
|
786
785
|
case o
|
787
786
|
when :default
|
788
787
|
Types::PDefaultType.new()
|
789
|
-
|
790
788
|
else
|
791
789
|
infer_Object(o)
|
792
790
|
end
|
@@ -1151,15 +1149,20 @@ class Puppet::Pops::Types::TypeCalculator
|
|
1151
1149
|
|
1152
1150
|
# @api private
|
1153
1151
|
def assignable_PEnumType(t, t2)
|
1154
|
-
return true if t == t2
|
1152
|
+
return true if t == t2
|
1153
|
+
if t.values.empty?
|
1154
|
+
return true if t2.is_a?(Types::PStringType) || t2.is_a?(Types::PEnumType) || t2.is_a?(Types::PPatternType)
|
1155
|
+
end
|
1155
1156
|
case t2
|
1156
1157
|
when Types::PStringType
|
1157
1158
|
# if the set of strings are all found in the set of enums
|
1158
|
-
t2.values.all? { |s| t.values.any? { |e| e == s }}
|
1159
|
+
!t2.values.empty?() && t2.values.all? { |s| t.values.any? { |e| e == s }}
|
1159
1160
|
when Types::PVariantType
|
1160
1161
|
t2.types.all? {|variant_t| assignable_PEnumType(t, variant_t) }
|
1161
1162
|
when Types::PEnumType
|
1162
|
-
|
1163
|
+
# empty means any enum
|
1164
|
+
return true if t.values.empty?
|
1165
|
+
!t2.values.empty? && t2.values.all? { |s| t.values.any? {|e| e == s }}
|
1163
1166
|
else
|
1164
1167
|
false
|
1165
1168
|
end
|
@@ -1184,7 +1187,7 @@ class Puppet::Pops::Types::TypeCalculator
|
|
1184
1187
|
assignable_PIntegerType(size_t, @collection_default_size_t)
|
1185
1188
|
|
1186
1189
|
when Types::PEnumType
|
1187
|
-
if t2.values
|
1190
|
+
if t2.values && !t2.values.empty?
|
1188
1191
|
# true if all enum values are within range
|
1189
1192
|
min, max = t2.values.map(&:size).minmax
|
1190
1193
|
trange = from_to_ordered(size_t.from, size_t.to)
|
@@ -1192,8 +1195,9 @@ class Puppet::Pops::Types::TypeCalculator
|
|
1192
1195
|
# If t2 min and max are within the range of t
|
1193
1196
|
trange[0] <= t2range[0] && trange[1] >= t2range[1]
|
1194
1197
|
else
|
1195
|
-
#
|
1196
|
-
|
1198
|
+
# enum represents all enums, and thus all strings, a sized constrained string can thus not
|
1199
|
+
# be assigned any enum (unless it is max size).
|
1200
|
+
assignable_PIntegerType(size_t, @collection_default_size_t)
|
1197
1201
|
end
|
1198
1202
|
else
|
1199
1203
|
# no other type matches string
|
@@ -1217,6 +1221,8 @@ class Puppet::Pops::Types::TypeCalculator
|
|
1217
1221
|
values = t2.values
|
1218
1222
|
when Types::PVariantType
|
1219
1223
|
return t2.types.all? {|variant_t| assignable_PPatternType(t, variant_t) }
|
1224
|
+
when Types::PPatternType
|
1225
|
+
return t.patterns.empty? ? true : false
|
1220
1226
|
else
|
1221
1227
|
return false
|
1222
1228
|
end
|
@@ -1226,9 +1232,10 @@ class Puppet::Pops::Types::TypeCalculator
|
|
1226
1232
|
# (There should really always be a pattern, but better safe than sorry).
|
1227
1233
|
return t.patterns.empty? ? true : false
|
1228
1234
|
end
|
1229
|
-
# all strings in String/Enum type must match one of the patterns in Pattern type
|
1235
|
+
# all strings in String/Enum type must match one of the patterns in Pattern type,
|
1236
|
+
# or Pattern represents all Patterns == all Strings
|
1230
1237
|
regexps = t.patterns.map {|p| p.regexp }
|
1231
|
-
t2.values.all? { |v| regexps.any? {|re| re.match(v) } }
|
1238
|
+
regexps.empty? || t2.values.all? { |v| regexps.any? {|re| re.match(v) } }
|
1232
1239
|
end
|
1233
1240
|
|
1234
1241
|
# @api private
|
@@ -1539,8 +1546,6 @@ class Puppet::Pops::Types::TypeCalculator
|
|
1539
1546
|
# translate to string, and skip Unit types
|
1540
1547
|
types = t.param_types.types.map {|t2| string(t2) unless t2.class == Types::PUnitType }.compact
|
1541
1548
|
|
1542
|
-
params_part= types.join(', ')
|
1543
|
-
|
1544
1549
|
s = "Callable[" << types.join(', ')
|
1545
1550
|
unless range.empty?
|
1546
1551
|
(s << ', ') unless types.empty?
|
@@ -126,7 +126,18 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
|
|
126
126
|
# http://defect.opensolaris.org/bz/show_bug.cgi?id=19159%
|
127
127
|
# notes that we can't use -Ha for the same even though the manual page reads that way.
|
128
128
|
def latest
|
129
|
-
|
129
|
+
lines = pkg(:list, "-Hn", @resource[:name]).split("\n")
|
130
|
+
|
131
|
+
# remove certificate expiration warnings from the output, but report them
|
132
|
+
# Note: we'd like to use select! here to modify the lines array and avoid
|
133
|
+
# the second select further down. But Solaris 11 comes with ruby 1.8.7
|
134
|
+
# which doesn't support select!, so do this as two selects.
|
135
|
+
cert_warnings = lines.select { |line| line =~ /^Certificate/ }
|
136
|
+
if cert_warnings
|
137
|
+
Puppet.warning("pkg warning: #{cert_warnings}")
|
138
|
+
end
|
139
|
+
|
140
|
+
lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }
|
130
141
|
|
131
142
|
# Now we know there is a newer version. But is that installable? (i.e are there any constraints?)
|
132
143
|
# return the first known we find. The only way that is currently available is to do a dry run of
|
@@ -105,7 +105,6 @@ Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
|
|
105
105
|
|
106
106
|
@triggers << puppet_trigger
|
107
107
|
end
|
108
|
-
@triggers = @triggers[0] if @triggers.length == 1
|
109
108
|
|
110
109
|
@triggers
|
111
110
|
end
|
@@ -235,7 +234,7 @@ Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
|
|
235
234
|
return false if current_trigger.has_key?('enabled') && !current_trigger['enabled']
|
236
235
|
|
237
236
|
desired = desired_trigger.dup
|
238
|
-
|
237
|
+
desired['start_date'] ||= current_trigger['start_date'] if current_trigger.has_key?('start_date')
|
239
238
|
desired['every'] ||= current_trigger['every'] if current_trigger.has_key?('every')
|
240
239
|
desired['months'] ||= current_trigger['months'] if current_trigger.has_key?('months')
|
241
240
|
desired['on'] ||= current_trigger['on'] if current_trigger.has_key?('on')
|
@@ -255,13 +254,11 @@ Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
|
|
255
254
|
|
256
255
|
def dummy_time_trigger
|
257
256
|
now = Time.now
|
258
|
-
|
259
257
|
{
|
260
258
|
'flags' => 0,
|
261
259
|
'random_minutes_interval' => 0,
|
262
260
|
'end_day' => 0,
|
263
261
|
"end_year" => 0,
|
264
|
-
"trigger_type" => 0,
|
265
262
|
"minutes_interval" => 0,
|
266
263
|
"end_month" => 0,
|
267
264
|
"minutes_duration" => 0,
|
@@ -274,22 +271,16 @@ Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
|
|
274
271
|
}
|
275
272
|
end
|
276
273
|
|
277
|
-
def translate_hash_to_trigger(puppet_trigger
|
274
|
+
def translate_hash_to_trigger(puppet_trigger)
|
278
275
|
trigger = dummy_time_trigger
|
279
276
|
|
280
|
-
if
|
281
|
-
self.fail "'enabled' is read-only on scheduled_task triggers and should be removed ('enabled' is usually provided in puppet resource scheduled_task)." if puppet_trigger.has_key?('enabled')
|
282
|
-
self.fail "'index' is read-only on scheduled_task triggers and should be removed ('index' is usually provided in puppet resource scheduled_task)." if puppet_trigger.has_key?('index')
|
283
|
-
end
|
284
|
-
puppet_trigger.delete('index')
|
285
|
-
|
286
|
-
if puppet_trigger.delete('enabled') == false
|
277
|
+
if puppet_trigger['enabled'] == false
|
287
278
|
trigger['flags'] |= Win32::TaskScheduler::TASK_TRIGGER_FLAG_DISABLED
|
288
279
|
else
|
289
280
|
trigger['flags'] &= ~Win32::TaskScheduler::TASK_TRIGGER_FLAG_DISABLED
|
290
281
|
end
|
291
282
|
|
292
|
-
extra_keys = puppet_trigger.keys.sort - ['schedule', 'start_date', 'start_time', 'every', 'months', 'on', 'which_occurrence', 'day_of_week']
|
283
|
+
extra_keys = puppet_trigger.keys.sort - ['index', 'enabled', 'schedule', 'start_date', 'start_time', 'every', 'months', 'on', 'which_occurrence', 'day_of_week']
|
293
284
|
self.fail "Unknown trigger option(s): #{Puppet::Parameter.format_value_for_display(extra_keys)}" unless extra_keys.empty?
|
294
285
|
self.fail "Must specify 'start_time' when defining a trigger" unless puppet_trigger['start_time']
|
295
286
|
|
@@ -361,9 +352,17 @@ Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
|
|
361
352
|
def validate_trigger(value)
|
362
353
|
value = [value] unless value.is_a?(Array)
|
363
354
|
|
364
|
-
|
365
|
-
|
366
|
-
|
355
|
+
value.each do |t|
|
356
|
+
if t.has_key?('index')
|
357
|
+
self.fail "'index' is read-only on scheduled_task triggers and should be removed ('index' is usually provided in puppet resource scheduled_task)."
|
358
|
+
end
|
359
|
+
|
360
|
+
if t.has_key?('enabled')
|
361
|
+
self.fail "'enabled' is read-only on scheduled_task triggers and should be removed ('enabled' is usually provided in puppet resource scheduled_task)."
|
362
|
+
end
|
363
|
+
|
364
|
+
translate_hash_to_trigger(t)
|
365
|
+
end
|
367
366
|
|
368
367
|
true
|
369
368
|
end
|
@@ -22,6 +22,8 @@ Puppet::Type.type(:ssh_authorized_key).provide(
|
|
22
22
|
h[:options] = Puppet::Type::Ssh_authorized_key::ProviderParsed.parse_options(h[:options]) if h[:options].is_a? String
|
23
23
|
},
|
24
24
|
:pre_gen => proc { |h|
|
25
|
+
# if this name was generated, don't write it back to disk
|
26
|
+
h[:name] = "" if h[:unnamed]
|
25
27
|
h[:options] = [] if h[:options].include?(:absent)
|
26
28
|
h[:options] = h[:options].join(',')
|
27
29
|
}
|
@@ -85,5 +87,19 @@ Puppet::Type.type(:ssh_authorized_key).provide(
|
|
85
87
|
end
|
86
88
|
result
|
87
89
|
end
|
90
|
+
|
91
|
+
def self.prefetch_hook(records)
|
92
|
+
name_index = 0
|
93
|
+
records.each do |record|
|
94
|
+
if record[:record_type] == :parsed && record[:name].empty?
|
95
|
+
record[:unnamed] = true
|
96
|
+
# Generate a unique ID for unnamed keys, in case they need purging.
|
97
|
+
# If you change this, you have to keep
|
98
|
+
# Puppet::Type::User#unknown_keys_in_file in sync! (PUP-3357)
|
99
|
+
record[:name] = "#{record[:target]}:unnamed-#{ name_index += 1 }"
|
100
|
+
Puppet.debug("generating name for on-disk ssh_authorized_key #{record[:key]}: #{record[:name]}")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
88
104
|
end
|
89
105
|
|
data/lib/puppet/resource.rb
CHANGED
@@ -186,9 +186,6 @@ class Puppet::Resource
|
|
186
186
|
@is_stage ||= @type.to_s.downcase == "stage"
|
187
187
|
end
|
188
188
|
|
189
|
-
# Cache to reduce respond_to? lookups
|
190
|
-
@@nondeprecating_type = {}
|
191
|
-
|
192
189
|
# Construct a resource from data.
|
193
190
|
#
|
194
191
|
# Constructs a resource instance with the given `type` and `title`. Multiple
|
@@ -242,12 +239,8 @@ class Puppet::Resource
|
|
242
239
|
extract_parameters(params)
|
243
240
|
end
|
244
241
|
|
245
|
-
if resource_type
|
246
|
-
if resource_type.respond_to?(:deprecate_params)
|
242
|
+
if resource_type && resource_type.respond_to?(:deprecate_params)
|
247
243
|
resource_type.deprecate_params(title, attributes[:parameters])
|
248
|
-
else
|
249
|
-
@@nondeprecating_type[resource_type] = true
|
250
|
-
end
|
251
244
|
end
|
252
245
|
|
253
246
|
tag(self.type)
|
data/lib/puppet/settings.rb
CHANGED
@@ -205,6 +205,23 @@ class Puppet::Settings
|
|
205
205
|
end
|
206
206
|
private :unsafe_clear
|
207
207
|
|
208
|
+
# Clears all cached settings for a particular environment to ensure
|
209
|
+
# that changes to environment.conf are reflected in the settings if
|
210
|
+
# the environment timeout has expired.
|
211
|
+
#
|
212
|
+
# param [String, Symbol] environment the name of environment to clear settings for
|
213
|
+
#
|
214
|
+
# @api private
|
215
|
+
def clear_environment_settings(environment)
|
216
|
+
|
217
|
+
if environment.nil?
|
218
|
+
return
|
219
|
+
end
|
220
|
+
|
221
|
+
@cache[environment.to_sym].clear
|
222
|
+
@values[environment.to_sym] = {}
|
223
|
+
end
|
224
|
+
|
208
225
|
# Clear @cache, @used and the Environment.
|
209
226
|
#
|
210
227
|
# Whenever an object is returned by Settings, a copy is stored in @cache.
|
data/lib/puppet/type/user.rb
CHANGED
@@ -670,10 +670,20 @@ module Puppet
|
|
670
670
|
# representing the found keys
|
671
671
|
def unknown_keys_in_file(keyfile)
|
672
672
|
names = []
|
673
|
+
name_index = 0
|
673
674
|
File.new(keyfile).each do |line|
|
674
675
|
next unless line =~ Puppet::Type.type(:ssh_authorized_key).keyline_regex
|
675
676
|
# the name is stored in the 4th capture of the regex
|
676
|
-
|
677
|
+
name = $4
|
678
|
+
if name.empty?
|
679
|
+
key = $3.delete("\n")
|
680
|
+
# If no comment is specified for this key, generate a unique internal
|
681
|
+
# name. This uses the same rules as
|
682
|
+
# provider/ssh_authorized_key/parsed (PUP-3357)
|
683
|
+
name = "#{keyfile}:unnamed-#{name_index += 1}"
|
684
|
+
end
|
685
|
+
names << name
|
686
|
+
Puppet.debug "#{self.ref} parsed for purging Ssh_authorized_key[#{name}]"
|
677
687
|
end
|
678
688
|
|
679
689
|
names.map { |keyname|
|
data/lib/puppet/util/autoload.rb
CHANGED
@@ -127,14 +127,18 @@ class Puppet::Util::Autoload
|
|
127
127
|
# now we are accomplishing that by calling the
|
128
128
|
# "app_defaults_initialized?" method on the main puppet Settings object.
|
129
129
|
# --cprice 2012-03-16
|
130
|
-
if Puppet.settings.app_defaults_initialized?
|
130
|
+
if Puppet.settings.app_defaults_initialized?
|
131
131
|
env ||= Puppet.lookup(:environments).get(Puppet[:environment])
|
132
132
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
133
|
+
if env
|
134
|
+
# if the app defaults have been initialized then it should be safe to access the module path setting.
|
135
|
+
$env_module_directories[env] ||= env.modulepath.collect do |dir|
|
136
|
+
Dir.entries(dir).reject { |f| f =~ /^\./ }.collect { |f| File.join(dir, f, "lib") }
|
137
|
+
end.flatten.find_all do |d|
|
138
|
+
FileTest.directory?(d)
|
139
|
+
end
|
140
|
+
else
|
141
|
+
[]
|
138
142
|
end
|
139
143
|
else
|
140
144
|
# if we get here, the app defaults have not been initialized, so we basically use an empty module path.
|
@@ -171,9 +171,9 @@ end
|
|
171
171
|
require 'openssl'
|
172
172
|
class OpenSSL::SSL::SSLContext
|
173
173
|
if DEFAULT_PARAMS[:options]
|
174
|
-
DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv2
|
174
|
+
DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv2 | OpenSSL::SSL::OP_NO_SSLv3
|
175
175
|
else
|
176
|
-
DEFAULT_PARAMS[:options] = OpenSSL::SSL::OP_NO_SSLv2
|
176
|
+
DEFAULT_PARAMS[:options] = OpenSSL::SSL::OP_NO_SSLv2 | OpenSSL::SSL::OP_NO_SSLv3
|
177
177
|
end
|
178
178
|
DEFAULT_PARAMS[:ciphers] << ':!SSLv2'
|
179
179
|
|
data/lib/puppet/version.rb
CHANGED
@@ -3,3 +3,4 @@
|
|
3
3
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTXvM7AslzjNUYrPLiNVBsF5VnqL2RmqrkzscdVdHzVxvieNwmLGeUkg8EfXPiz7j5F/Lr0J8oItTCWzyN2KmM+DhUMjvP4AbELO/VYbnVrZICRiUNYSO3EN9/uapKAuiev88d7ynbonCU0VZoTPg/ug4OondOrLCtcGri5ltF+mausGfAYiFAQVEWqXV+1tyejoawJ884etb3n4ilpsrH9JK6AtOkEWVD3TDrNi29O1mQQ/Cn88g472zAJ+DhsIn+iehtfX5nmOtDNN/1t1bGMIBzkSYEAYwUiRJbRXvbobT7qKZQPA3dh0m8AYQS5/hd4/c4pmlxL8kgr24SnBY5 key1 name
|
4
4
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTXvM7AslzjNUYrPLiNVBsF5VnqL2RmqrkzscdVdHzVxvieNwmLGeUkg8EfXPiz7j5F/Lr0J8oItTCWzyN2KmM+DhUMjvP4AbELO/VYbnVrZICRiUNYSO3EN9/uapKAuiev88d7ynbonCU0VZoTPg/ug4OondOrLCtcGri5ltF+mausGfAYiFAQVEWqXV+1tyejoawJ884etb3n4ilpsrH9JK6AtOkEWVD3TDrNi29O1mQQ/Cn88g472zAJ+DhsIn+iehtfX5nmOtDNN/1t1bGMIBzkSYEAYwUiRJbRXvbobT7qKZQPA3dh0m8AYQS5/hd4/c4pmlxL8kgr24SnBY5 keyname2
|
5
5
|
#ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTXvM7AslzjNUYrPLiNVBsF5VnqL2RmqrkzscdVdHzVxvieNwmLGeUkg8EfXPiz7j5F/Lr0J8oItTCWzyN2KmM+DhUMjvP4AbELO/VYbnVrZICRiUNYSO3EN9/uapKAuiev88d7ynbonCU0VZoTPg/ug4OondOrLCtcGri5ltF+mausGfAYiFAQVEWqXV+1tyejoawJ884etb3n4ilpsrH9JK6AtOkEWVD3TDrNi29O1mQQ/Cn88g472zAJ+DhsIn+iehtfX5nmOtDNN/1t1bGMIBzkSYEAYwUiRJbRXvbobT7qKZQPA3dh0m8AYQS5/hd4/c4pmlxL8kgr24SnBY5 keyname3
|
6
|
+
ssh-rsa KEY-WITH-NO-NAME
|
@@ -1,7 +1,5 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
1
|
require 'spec_helper'
|
3
2
|
require 'puppet_spec/files'
|
4
|
-
require 'puppet/application/apply'
|
5
3
|
|
6
4
|
describe "apply" do
|
7
5
|
include PuppetSpec::Files
|
@@ -17,9 +15,8 @@ describe "apply" do
|
|
17
15
|
resource = Puppet::Resource.new(:file, file_to_create, :parameters => {:content => "my stuff"})
|
18
16
|
catalog.add_resource resource
|
19
17
|
|
20
|
-
manifest =
|
18
|
+
manifest = file_containing("manifest", catalog.to_pson)
|
21
19
|
|
22
|
-
File.open(manifest, "w") { |f| f.print catalog.to_pson }
|
23
20
|
puppet = Puppet::Application[:apply]
|
24
21
|
puppet.options[:catalog] = manifest
|
25
22
|
|
@@ -31,12 +28,7 @@ describe "apply" do
|
|
31
28
|
end
|
32
29
|
|
33
30
|
it "applies a given file even when a directory environment is specified" do
|
34
|
-
manifest =
|
35
|
-
File.open(manifest, "w") do |f|
|
36
|
-
f.puts <<-EOF
|
37
|
-
notice('it was applied')
|
38
|
-
EOF
|
39
|
-
end
|
31
|
+
manifest = file_containing("manifest.pp", "notice('it was applied')")
|
40
32
|
|
41
33
|
special = Puppet::Node::Environment.create(:special, [])
|
42
34
|
Puppet.override(:current_environment => special) do
|
@@ -49,27 +41,41 @@ describe "apply" do
|
|
49
41
|
expect(@logs.map(&:to_s)).to include('it was applied')
|
50
42
|
end
|
51
43
|
|
44
|
+
it "applies a given file even when an ENC is configured", :if => !Puppet.features.microsoft_windows? do
|
45
|
+
manifest = file_containing("manifest.pp", "notice('specific manifest applied')")
|
46
|
+
site_manifest = file_containing("site_manifest.pp", "notice('the site manifest was applied instead')")
|
47
|
+
enc = file_containing("enc_script", "#!/bin/sh\necho 'classes: []'")
|
48
|
+
File.chmod(0755, enc)
|
49
|
+
|
50
|
+
special = Puppet::Node::Environment.create(:special, [])
|
51
|
+
Puppet.override(:current_environment => special) do
|
52
|
+
Puppet[:environment] = 'special'
|
53
|
+
Puppet[:node_terminus] = 'exec'
|
54
|
+
Puppet[:external_nodes] = enc
|
55
|
+
Puppet[:manifest] = site_manifest
|
56
|
+
puppet = Puppet::Application[:apply]
|
57
|
+
puppet.stubs(:command_line).returns(stub('command_line', :args => [manifest]))
|
58
|
+
expect { puppet.run_command }.to exit_with(0)
|
59
|
+
end
|
60
|
+
|
61
|
+
expect(@logs.map(&:to_s)).to include('specific manifest applied')
|
62
|
+
end
|
63
|
+
|
52
64
|
context "with a module" do
|
53
65
|
let(:modulepath) { tmpdir('modulepath') }
|
54
66
|
let(:execute) { 'include amod' }
|
55
67
|
let(:args) { ['-e', execute, '--modulepath', modulepath] }
|
56
68
|
|
57
69
|
before(:each) do
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
70
|
+
dir_contained_in(modulepath, {
|
71
|
+
"amod" => {
|
72
|
+
"manifests" => {
|
73
|
+
"init.pp" => "class amod{ notice('amod class included') }"
|
74
|
+
}
|
63
75
|
}
|
64
|
-
|
65
|
-
end
|
66
|
-
environmentdir = Dir.mktmpdir('environments')
|
67
|
-
Puppet[:environmentpath] = environmentdir
|
68
|
-
create_default_directory_environment
|
69
|
-
end
|
76
|
+
})
|
70
77
|
|
71
|
-
|
72
|
-
Puppet::FileSystem.mkpath("#{Puppet[:environmentpath]}/#{Puppet[:environment]}")
|
78
|
+
Puppet[:environmentpath] = dir_containing("environments", { Puppet[:environment] => {} })
|
73
79
|
end
|
74
80
|
|
75
81
|
def init_cli_args_and_apply_app(args, execute)
|