puppet 3.8.3 → 3.8.4

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.

@@ -9,7 +9,7 @@ gpg_name: 'info@puppetlabs.com'
9
9
  gpg_key: '4BD6EC30'
10
10
  sign_tar: FALSE
11
11
  # a space separated list of mock configs
12
- final_mocks: 'pl-el-5-i386 pl-el-6-i386 pl-el-7-x86_64 pl-fedora-20-i386'
12
+ final_mocks: 'pl-el-5-i386 pl-el-6-i386 pl-el-7-x86_64'
13
13
  yum_host: 'yum.puppetlabs.com'
14
14
  yum_repo_path: '/opt/repository/yum/'
15
15
  build_gem: TRUE
@@ -26,8 +26,8 @@ build_msi:
26
26
  repo: 'git://github.com/puppetlabs/hiera.git'
27
27
  sys:
28
28
  ref:
29
- x86: 'refs/tags/1.9.3-p551.5'
30
- x64: 'refs/tags/2.0.0.8-x64'
29
+ x86: 'refs/tags/1.9.3-p551.6'
30
+ x64: 'refs/tags/2.0.0.9-x64'
31
31
  repo: 'git://github.com/puppetlabs/puppet-win32-ruby.git'
32
32
  apt_host: 'apt.puppetlabs.com'
33
33
  apt_repo_url: 'http://apt.puppetlabs.com'
@@ -82,6 +82,8 @@ module Puppet
82
82
  # setting access and stuff
83
83
  def self.[]=(param,value)
84
84
  @@settings[param] = value
85
+ # Ensure that all environment caches are cleared if we're changing the parser
86
+ lookup(:environments).clear_all if param == :parser
85
87
  end
86
88
 
87
89
  def self.clear
@@ -242,6 +244,8 @@ module Puppet
242
244
  # @api private
243
245
  def self.override(bindings, description = "", &block)
244
246
  @context.override(bindings, description, &block)
247
+ ensure
248
+ lookup(:root_environment).instance_variable_set(:@future_parser, nil)
245
249
  end
246
250
 
247
251
  # @api private
@@ -264,14 +268,7 @@ module Puppet
264
268
  #
265
269
  def self.future_parser?(in_environment = nil)
266
270
  env = in_environment || Puppet.lookup(:current_environment) { return Puppet[:parser] == 'future' }
267
- env_conf = Puppet.lookup(:environments).get_conf(env.name)
268
-
269
- if env_conf.nil?
270
- # Case for non-directory environments
271
- Puppet[:parser] == 'future'
272
- else
273
- env_conf.parser == 'future'
274
- end
271
+ env.future_parser?
275
272
  end
276
273
  end
277
274
 
@@ -2052,6 +2052,10 @@ EOT
2052
2052
  },
2053
2053
  :parser => {
2054
2054
  :default => "current",
2055
+ :hook => proc do |value|
2056
+ envs = Puppet.lookup(:environments) { nil }
2057
+ envs.clear_all unless envs.nil?
2058
+ end,
2055
2059
  :desc => <<-'EOT'
2056
2060
  Selects the parser to use for parsing puppet manifests (in puppet DSL
2057
2061
  language/'.pp' files). Available choices are `current` (the default)
@@ -38,6 +38,11 @@ module Puppet::Environments
38
38
  raise EnvironmentNotFound, name
39
39
  end
40
40
  end
41
+
42
+ def clear_all
43
+ root = Puppet.lookup(:root_environment) { nil }
44
+ root.instance_variable_set(:@future_parser, nil) unless root.nil?
45
+ end
41
46
  end
42
47
 
43
48
  # @!macro [new] loader_search_paths
@@ -247,12 +252,14 @@ module Puppet::Environments
247
252
  def create_environment(name, setting_values = nil)
248
253
  env_symbol = name.intern
249
254
  setting_values = Puppet.settings.values(env_symbol, Puppet.settings.preferred_run_mode)
250
- Puppet::Node::Environment.create(
255
+ env = Puppet::Node::Environment.create(
251
256
  env_symbol,
252
257
  Puppet::Node::Environment.split_path(setting_values.interpolate(:modulepath)),
253
258
  setting_values.interpolate(:manifest),
254
259
  setting_values.interpolate(:config_version)
255
260
  )
261
+ env.watching = false
262
+ env
256
263
  end
257
264
 
258
265
  def valid_directory?(envdir)
@@ -311,6 +318,9 @@ module Puppet::Environments
311
318
  nil
312
319
  end
313
320
 
321
+ def clear_all
322
+ @loaders.each {|loader| loader.clear_all}
323
+ end
314
324
  end
315
325
 
316
326
  class Cached
@@ -412,6 +422,7 @@ module Puppet::Environments
412
422
  # Clears all cached environments.
413
423
  # (The intention is that this could be used from a MANUAL cache eviction command (TBD)
414
424
  def clear_all()
425
+ super
415
426
  @cache = {}
416
427
  @expirations.clear
417
428
  @next_expiration = END_OF_TIME
@@ -57,14 +57,14 @@ Puppet::Functions.create_function(:filter) do
57
57
  end
58
58
 
59
59
  def filter_Hash_1(hash)
60
- result = hash.select {|x, y| yield([x, y]) }
60
+ result = hash.select {|x, y| yield([x, y]) == true }
61
61
  # Ruby 1.8.7 returns Array
62
62
  result = Hash[result] unless result.is_a? Hash
63
63
  result
64
64
  end
65
65
 
66
66
  def filter_Hash_2(hash)
67
- result = hash.select {|x, y| yield(x, y) }
67
+ result = hash.select {|x, y| yield(x, y) == true }
68
68
  # Ruby 1.8.7 returns Array
69
69
  result = Hash[result] unless result.is_a? Hash
70
70
  result
@@ -258,6 +258,15 @@ class Puppet::Node::Environment
258
258
  !original_manifest.nil? && !original_manifest.empty? && original_manifest != Puppet[:default_manifest]
259
259
  end
260
260
 
261
+ # @api private
262
+ def future_parser?
263
+ if @future_parser.nil?
264
+ environment_conf = Puppet.lookup(:environments).get_conf(name)
265
+ @future_parser = 'future' == (environment_conf.nil? ? Puppet[:parser] : environment_conf.parser)
266
+ end
267
+ @future_parser
268
+ end
269
+
261
270
  # Return an environment-specific Puppet setting.
262
271
  #
263
272
  # @api public
@@ -219,15 +219,16 @@ class Puppet::Settings::FileSetting < Puppet::Settings::StringSetting
219
219
  Puppet::Util::SUIDManager.asuser(*chown) do
220
220
  # Update the umask to make non-executable files
221
221
  Puppet::Util.withumask(File.umask ^ 0111) do
222
- mode = case mode.class
223
- when String
224
- mode.to_i(8)
225
- when NilClass
226
- 0640
227
- else
228
- mode
229
- end
230
- yield mode
222
+ yielded_value = case self.mode
223
+ when String
224
+ self.mode.to_i(8)
225
+ when NilClass
226
+ 0640
227
+ else
228
+ self.mode
229
+ end
230
+
231
+ yield yielded_value
231
232
  end
232
233
  end
233
234
  end
@@ -350,11 +350,8 @@ class Puppet::Transaction
350
350
  resource.appliable_to_host? && resource.appliable_to_device?
351
351
  end
352
352
 
353
- def handle_qualified_tags( qualified )
354
- # The default behavior of Puppet::Util::Tagging is
355
- # to split qualified tags into parts. That would cause
356
- # qualified tags to match too broadly here.
357
- return
353
+ def split_qualified_tags?
354
+ false
358
355
  end
359
356
 
360
357
  # Is this resource tagged appropriately?
@@ -364,6 +361,7 @@ class Puppet::Transaction
364
361
 
365
362
  not resource.tagged?(*tags)
366
363
  end
364
+
367
365
  end
368
366
 
369
367
  require 'puppet/transaction/report'
@@ -14,8 +14,10 @@ module Puppet::Util::Tagging
14
14
  name = tag.to_s.downcase
15
15
  if name =~ ValidTagRegex
16
16
  @tags << name
17
- name.split("::").each do |section|
18
- @tags << section
17
+ if split_qualified_tags?
18
+ name.split("::").each do |section|
19
+ @tags << section
20
+ end
19
21
  end
20
22
  else
21
23
  fail(Puppet::ParseError, "Invalid tag '#{name}'")
@@ -69,6 +71,10 @@ module Puppet::Util::Tagging
69
71
  tag.is_a?(String) and tag =~ ValidTagRegex
70
72
  end
71
73
 
74
+ def split_qualified_tags?
75
+ true
76
+ end
77
+
72
78
  def new_tags
73
79
  Puppet::Util::TagSet.new
74
80
  end
@@ -188,8 +188,11 @@ module Puppet::Util::Windows::ADSI
188
188
  end
189
189
 
190
190
  def password=(password)
191
- native_user.SetPassword(password)
192
- commit
191
+ if !password.nil?
192
+ native_user.SetPassword(password)
193
+ commit
194
+ end
195
+
193
196
  fADS_UF_DONT_EXPIRE_PASSWD = 0x10000
194
197
  add_flag("UserFlags", fADS_UF_DONT_EXPIRE_PASSWD)
195
198
  end
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  module Puppet
10
- PUPPETVERSION = '3.8.3'
10
+ PUPPETVERSION = '3.8.4'
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
@@ -126,6 +126,24 @@ describe 'the filter method' do
126
126
  expect(catalog).to have_resource("File[/file_blueb]").with_parameter(:ensure, 'present')
127
127
  end
128
128
 
129
+ it 'filters on an array will not include elements for which the block returns truthy but not true' do
130
+ catalog = compile_to_catalog(<<-MANIFEST)
131
+ $r = [1, 2, 3].filter |$v| { $v } == []
132
+ notify { "eval_${$r}": }
133
+ MANIFEST
134
+
135
+ expect(catalog).to have_resource('Notify[eval_true]')
136
+ end
137
+
138
+ it 'filters on a hash will not include elements for which the block returns truthy but not true' do
139
+ catalog = compile_to_catalog(<<-MANIFEST)
140
+ $r = {a => 1, b => 2, c => 3}.filter |$k, $v| { $v } == {}
141
+ notify { "eval_${$r}": }
142
+ MANIFEST
143
+
144
+ expect(catalog).to have_resource('Notify[eval_true]')
145
+ end
146
+
129
147
  it_should_behave_like 'all iterative functions argument checks', 'filter'
130
148
  it_should_behave_like 'all iterative functions hash handling', 'filter'
131
149
  end
@@ -124,7 +124,8 @@ describe Puppet::Type.type(:user).provider(:windows_adsi), :if => Puppet.feature
124
124
  resource[:name] = 'DOMAIN\testdomainuser'
125
125
  Puppet::Util::Windows::ADSI::Group.expects(:exists?).with(resource[:name]).returns(false)
126
126
  connection.expects(:Create)
127
- connection.expects(:SetPassword)
127
+ connection.expects(:Get).with('UserFlags')
128
+ connection.expects(:Put).with('UserFlags', true)
128
129
  connection.expects(:SetInfo).raises( WIN32OLERuntimeError.new("(in OLE method `SetInfo': )\n OLE error code:8007089A in Active Directory\n The specified username is invalid.\r\n\n HRESULT error code:0x80020009\n Exception occurred."))
129
130
 
130
131
  expect{ provider.create }.to raise_error(
@@ -295,4 +295,35 @@ describe Puppet::Settings::FileSetting do
295
295
  filesetting.munge(':memory:').should == ':memory:'
296
296
  end
297
297
  end
298
+
299
+ context "when opening", :unless => Puppet.features.microsoft_windows? do
300
+ let(:path) do
301
+ tmpfile('file_setting_spec')
302
+ end
303
+
304
+ let(:setting) do
305
+ settings = mock("settings", :value => path)
306
+ FileSetting.new(:name => :mysetting, :desc => "creates a file", :settings => settings)
307
+ end
308
+
309
+ it "creates a file with mode 0640" do
310
+ setting.mode = '0640'
311
+
312
+ expect(File).to_not be_exist(path)
313
+ setting.open('w')
314
+
315
+ expect(File).to be_exist(path)
316
+ expect(Puppet::FileSystem.stat(path).mode & 0777).to eq(0640)
317
+ end
318
+
319
+ it "preserves the mode of an existing file" do
320
+ setting.mode = '0640'
321
+
322
+ Puppet::FileSystem.touch(path)
323
+ Puppet::FileSystem.chmod(0644, path)
324
+ setting.open('w')
325
+
326
+ expect(Puppet::FileSystem.stat(path).mode & 0777).to eq(0644)
327
+ end
328
+ end
298
329
  end
@@ -707,6 +707,13 @@ describe Puppet::Transaction, " when determining tags" do
707
707
  @transaction.should be_tagged("one::two")
708
708
  end
709
709
 
710
+ it "should tag one::two only as 'one::two' and not 'one', 'two', and 'one::two'" do
711
+ @transaction.tags = "one::two"
712
+ @transaction.should be_tagged("one::two")
713
+ @transaction.should_not be_tagged("one")
714
+ @transaction.should_not be_tagged("two")
715
+ end
716
+
710
717
  it "should accept a comma-delimited string" do
711
718
  @transaction.tags = "one, two"
712
719
  @transaction.should be_tagged("one")
@@ -203,6 +203,19 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
203
203
  user.password = 'pwd'
204
204
  end
205
205
 
206
+ it "should be able manage a user without a password" do
207
+ adsi_user.expects(:SetPassword).with('pwd').never
208
+ adsi_user.expects(:SetInfo).at_least_once
209
+
210
+ flagname = "UserFlags"
211
+ fADS_UF_DONT_EXPIRE_PASSWD = 0x10000
212
+
213
+ adsi_user.expects(:Get).with(flagname).returns(0)
214
+ adsi_user.expects(:Put).with(flagname, fADS_UF_DONT_EXPIRE_PASSWD)
215
+
216
+ user.password = nil
217
+ end
218
+
206
219
  it "should generate the correct URI" do
207
220
  Puppet::Util::Windows::SID.stubs(:octet_string_to_sid_object).returns(sid)
208
221
  user.uri.should == "WinNT://testcomputername/#{username},user"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.3
4
+ version: 3.8.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-21 00:00:00.000000000 Z
12
+ date: 2015-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: facter