puppet 3.2.2 → 3.2.3.rc1

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.

Files changed (50) hide show
  1. data/Gemfile +1 -1
  2. data/Rakefile +7 -2
  3. data/ext/build_defaults.yaml +1 -1
  4. data/ext/debian/changelog.erb +6 -0
  5. data/ext/debian/control +1 -1
  6. data/ext/project_data.yaml +1 -1
  7. data/ext/redhat/puppet.spec.erb +4 -1
  8. data/ext/windows/service/daemon.bat +1 -1
  9. data/lib/puppet/application/agent.rb +1 -1
  10. data/lib/puppet/application.rb +2 -2
  11. data/lib/puppet/defaults.rb +39 -26
  12. data/lib/puppet/parser/ast/block_expression.rb +4 -0
  13. data/lib/puppet/parser/ast/branch.rb +0 -15
  14. data/lib/puppet/parser/functions/collect.rb +8 -7
  15. data/lib/puppet/parser/functions/each.rb +6 -5
  16. data/lib/puppet/parser/functions/foreach.rb +6 -5
  17. data/lib/puppet/parser/functions/reduce.rb +20 -18
  18. data/lib/puppet/parser/functions/reject.rb +6 -5
  19. data/lib/puppet/parser/functions/select.rb +6 -5
  20. data/lib/puppet/parser/functions/slice.rb +4 -3
  21. data/lib/puppet/resource/catalog.rb +6 -4
  22. data/lib/puppet/resource/type.rb +1 -9
  23. data/lib/puppet/scheduler/timer.rb +1 -1
  24. data/lib/puppet/type/file/ensure.rb +10 -11
  25. data/lib/puppet/util/adsi.rb +15 -15
  26. data/lib/puppet/util/monkey_patches.rb +0 -9
  27. data/lib/puppet/util/windows/user.rb +7 -5
  28. data/lib/puppet/version.rb +1 -1
  29. data/spec/integration/application/apply_spec.rb +4 -0
  30. data/spec/unit/application/apply_spec.rb +1 -0
  31. data/spec/unit/application/facts_spec.rb +3 -1
  32. data/spec/unit/configurer_spec.rb +1 -0
  33. data/spec/unit/parser/ast/block_expression_spec.rb +67 -0
  34. data/spec/unit/parser/functions/fqdn_rand_spec.rb +22 -42
  35. data/spec/unit/parser/functions/sprintf_spec.rb +6 -1
  36. data/spec/unit/pops/parser/rgen_sanitycheck_spec.rb +9 -1
  37. data/spec/unit/provider/exec/posix_spec.rb +1 -0
  38. data/spec/unit/provider/group/windows_adsi_spec.rb +1 -1
  39. data/spec/unit/provider/package/pip_spec.rb +4 -0
  40. data/spec/unit/provider/service/redhat_spec.rb +2 -1
  41. data/spec/unit/provider/user/windows_adsi_spec.rb +1 -2
  42. data/spec/unit/resource/catalog_spec.rb +23 -3
  43. data/spec/unit/resource/type_spec.rb +3 -12
  44. data/spec/unit/type/exec_spec.rb +3 -2
  45. data/spec/unit/util/adsi_spec.rb +46 -11
  46. data/spec/unit/util/rdoc/parser_spec.rb +1 -1
  47. data/spec/unit/util/run_mode_spec.rb +38 -10
  48. data/spec/unit/util/zaml_spec.rb +1 -1
  49. data/spec/unit/util_spec.rb +4 -1
  50. metadata +16 -14
@@ -17,7 +17,7 @@ describe Puppet::Util::ADSI do
17
17
  end
18
18
 
19
19
  it "should generate the correct URI for a resource" do
20
- Puppet::Util::ADSI.uri('test', 'user').should == "WinNT://testcomputername/test,user"
20
+ Puppet::Util::ADSI.uri('test', 'user').should == "WinNT://./test,user"
21
21
  end
22
22
 
23
23
  it "should be able to get the name of the computer" do
@@ -25,7 +25,11 @@ describe Puppet::Util::ADSI do
25
25
  end
26
26
 
27
27
  it "should be able to provide the correct WinNT base URI for the computer" do
28
- Puppet::Util::ADSI.computer_uri.should == "WinNT://testcomputername"
28
+ Puppet::Util::ADSI.computer_uri.should == "WinNT://."
29
+ end
30
+
31
+ it "should generate a fully qualified WinNT URI" do
32
+ Puppet::Util::ADSI.computer_uri('testcomputername').should == "WinNT://testcomputername"
29
33
  end
30
34
 
31
35
  describe ".sid_for_account", :if => Puppet.features.microsoft_windows? do
@@ -52,7 +56,7 @@ describe Puppet::Util::ADSI do
52
56
  let(:username) { 'testuser' }
53
57
 
54
58
  it "should generate the correct URI" do
55
- Puppet::Util::ADSI::User.uri(username).should == "WinNT://testcomputername/#{username},user"
59
+ Puppet::Util::ADSI::User.uri(username).should == "WinNT://./#{username},user"
56
60
  end
57
61
 
58
62
  it "should be able to create a user" do
@@ -68,7 +72,7 @@ describe Puppet::Util::ADSI do
68
72
  end
69
73
 
70
74
  it "should be able to check the existence of a user" do
71
- Puppet::Util::ADSI.expects(:connect).with("WinNT://testcomputername/#{username},user").returns connection
75
+ Puppet::Util::ADSI.expects(:connect).with("WinNT://./#{username},user").returns connection
72
76
  Puppet::Util::ADSI::User.exists?(username).should be_true
73
77
  end
74
78
 
@@ -78,6 +82,22 @@ describe Puppet::Util::ADSI do
78
82
  Puppet::Util::ADSI::User.delete(username)
79
83
  end
80
84
 
85
+ it "should return an enumeration of IADsUser wrapped objects" do
86
+ name = 'Administrator'
87
+ wmi_users = [stub('WMI', :name => name)]
88
+ Puppet::Util::ADSI.expects(:execquery).with("select name from win32_useraccount").returns(wmi_users)
89
+
90
+ native_user = stub('IADsUser')
91
+ homedir = "C:\\Users\\#{name}"
92
+ native_user.expects(:Get).with('HomeDirectory').returns(homedir)
93
+ Puppet::Util::ADSI.expects(:connect).with("WinNT://./#{name},user").returns(native_user)
94
+
95
+ users = Puppet::Util::ADSI::User.to_a
96
+ users.length.should == 1
97
+ users[0].name.should == name
98
+ users[0]['HomeDirectory'].should == homedir
99
+ end
100
+
81
101
  describe "an instance" do
82
102
  let(:adsi_user) { stub 'user' }
83
103
  let(:user) { Puppet::Util::ADSI::User.new(username, adsi_user) }
@@ -114,7 +134,7 @@ describe Puppet::Util::ADSI do
114
134
  end
115
135
 
116
136
  it "should generate the correct URI" do
117
- user.uri.should == "WinNT://testcomputername/#{username},user"
137
+ user.uri.should == "WinNT://./#{username},user"
118
138
  end
119
139
 
120
140
  describe "when given a set of groups to which to add the user" do
@@ -132,8 +152,8 @@ describe Puppet::Util::ADSI do
132
152
  group3 = stub 'group1'
133
153
  group3.expects(:Remove).with("WinNT://testcomputername/#{username},user")
134
154
 
135
- Puppet::Util::ADSI.expects(:connect).with('WinNT://testcomputername/group1,group').returns group1
136
- Puppet::Util::ADSI.expects(:connect).with('WinNT://testcomputername/group3,group').returns group3
155
+ Puppet::Util::ADSI.expects(:connect).with('WinNT://./group1,group').returns group1
156
+ Puppet::Util::ADSI.expects(:connect).with('WinNT://./group3,group').returns group3
137
157
 
138
158
  user.set_groups(groups_to_set, false)
139
159
  end
@@ -144,7 +164,7 @@ describe Puppet::Util::ADSI do
144
164
  group1 = stub 'group1'
145
165
  group1.expects(:Add).with("WinNT://testcomputername/#{username},user")
146
166
 
147
- Puppet::Util::ADSI.expects(:connect).with('WinNT://testcomputername/group1,group').returns group1
167
+ Puppet::Util::ADSI.expects(:connect).with('WinNT://./group1,group').returns group1
148
168
 
149
169
  user.set_groups(groups_to_set, true)
150
170
  end
@@ -193,12 +213,12 @@ describe Puppet::Util::ADSI do
193
213
  end
194
214
 
195
215
  it "should generate the correct URI" do
196
- group.uri.should == "WinNT://testcomputername/#{groupname},group"
216
+ group.uri.should == "WinNT://./#{groupname},group"
197
217
  end
198
218
  end
199
219
 
200
220
  it "should generate the correct URI" do
201
- Puppet::Util::ADSI::Group.uri("people").should == "WinNT://testcomputername/people,group"
221
+ Puppet::Util::ADSI::Group.uri("people").should == "WinNT://./people,group"
202
222
  end
203
223
 
204
224
  it "should be able to create a group" do
@@ -214,7 +234,7 @@ describe Puppet::Util::ADSI do
214
234
  end
215
235
 
216
236
  it "should be able to confirm the existence of a group" do
217
- Puppet::Util::ADSI.expects(:connect).with("WinNT://testcomputername/#{groupname},group").returns connection
237
+ Puppet::Util::ADSI.expects(:connect).with("WinNT://./#{groupname},group").returns connection
218
238
 
219
239
  Puppet::Util::ADSI::Group.exists?(groupname).should be_true
220
240
  end
@@ -224,6 +244,21 @@ describe Puppet::Util::ADSI do
224
244
 
225
245
  Puppet::Util::ADSI::Group.delete(groupname)
226
246
  end
247
+
248
+ it "should return an enumeration of IADsGroup wrapped objects" do
249
+ name = 'Administrators'
250
+ wmi_groups = [stub('WMI', :name => name)]
251
+ Puppet::Util::ADSI.expects(:execquery).with("select name from win32_group").returns(wmi_groups)
252
+
253
+ native_group = stub('IADsGroup')
254
+ native_group.expects(:Members).returns([stub(:Name => 'Administrator')])
255
+ Puppet::Util::ADSI.expects(:connect).with("WinNT://./#{name},group").returns(native_group)
256
+
257
+ groups = Puppet::Util::ADSI::Group.to_a
258
+ groups.length.should == 1
259
+ groups[0].name.should == name
260
+ groups[0].members.should == ['Administrator']
261
+ end
227
262
  end
228
263
 
229
264
  describe Puppet::Util::ADSI::UserProfile do
@@ -176,7 +176,7 @@ describe "RDoc::Parser", :if => Puppet.features.rdoc1? do
176
176
  @parser.split_module("/path/to/manifests/init.pp").should == RDoc::Parser::SITE
177
177
  end
178
178
 
179
- it "should handle windows paths with drive letters", :if => Puppet.features.microsoft_windows? do
179
+ it "should handle windows paths with drive letters", :if => Puppet.features.microsoft_windows? && Puppet.features.rdoc1? do
180
180
  @parser.split_module("C:/temp/init.pp").should == RDoc::Parser::SITE
181
181
  end
182
182
  end
@@ -10,7 +10,7 @@ describe Puppet::Util::RunMode do
10
10
  @run_mode.run_dir.should == '$vardir/run'
11
11
  end
12
12
 
13
- describe Puppet::Util::UnixRunMode do
13
+ describe Puppet::Util::UnixRunMode, :unless => Puppet.features.microsoft_windows? do
14
14
  before do
15
15
  @run_mode = Puppet::Util::UnixRunMode.new('fake')
16
16
  end
@@ -59,17 +59,9 @@ describe Puppet::Util::RunMode do
59
59
  end
60
60
  end
61
61
  end
62
-
63
- def without_home
64
- saved_home = ENV["HOME"]
65
- ENV.delete "HOME"
66
- yield
67
- ensure
68
- ENV["HOME"] = saved_home
69
- end
70
62
  end
71
63
 
72
- describe Puppet::Util::WindowsRunMode do
64
+ describe Puppet::Util::WindowsRunMode, :if => Puppet.features.microsoft_windows? do
73
65
  before do
74
66
  if not Dir.const_defined? :COMMON_APPDATA
75
67
  Dir.const_set :COMMON_APPDATA, "/CommonFakeBase"
@@ -92,6 +84,18 @@ describe Puppet::Util::RunMode do
92
84
  it "has confdir in ~/.puppet when run as non-root" do
93
85
  as_non_root { @run_mode.conf_dir.should == File.expand_path("~/.puppet") }
94
86
  end
87
+
88
+ it "fails when asking for the conf_dir as non-root and there is no %HOME%, %HOMEDRIVE%, and %USERPROFILE%" do
89
+ as_non_root do
90
+ without_env('HOME') do
91
+ without_env('HOMEDRIVE') do
92
+ without_env('USERPROFILE') do
93
+ expect { @run_mode.conf_dir }.to raise_error ArgumentError, /couldn't find HOME/
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
95
99
  end
96
100
 
97
101
  describe "#var_dir" do
@@ -102,6 +106,18 @@ describe Puppet::Util::RunMode do
102
106
  it "has vardir in ~/.puppet/var when run as non-root" do
103
107
  as_non_root { @run_mode.var_dir.should == File.expand_path("~/.puppet/var") }
104
108
  end
109
+
110
+ it "fails when asking for the conf_dir as non-root and there is no %HOME%, %HOMEDRIVE%, and %USERPROFILE%" do
111
+ as_non_root do
112
+ without_env('HOME') do
113
+ without_env('HOMEDRIVE') do
114
+ without_env('USERPROFILE') do
115
+ expect { @run_mode.var_dir }.to raise_error ArgumentError, /couldn't find HOME/
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
105
121
  end
106
122
  end
107
123
 
@@ -114,4 +130,16 @@ describe Puppet::Util::RunMode do
114
130
  Puppet.features.stubs(:root?).returns(false)
115
131
  yield
116
132
  end
133
+
134
+ def without_env(name, &block)
135
+ saved = ENV[name]
136
+ ENV.delete name
137
+ yield
138
+ ensure
139
+ ENV[name] = saved
140
+ end
141
+
142
+ def without_home(&block)
143
+ without_env('HOME', &block)
144
+ end
117
145
  end
@@ -69,7 +69,7 @@ describe "Pure ruby yaml implementation" do
69
69
  end
70
70
 
71
71
  it "serializes a time in UTC" do
72
- pending("not supported on Windows", :if => Puppet.features.microsoft_windows?) do
72
+ pending("not supported on Windows", :if => Puppet.features.microsoft_windows? && RUBY_VERSION[0,3] == '1.8') do
73
73
  the_time_in("Europe/London").should be_equivalent_to(the_time_in_yaml_offset_by("+00:00"))
74
74
  end
75
75
  end
@@ -273,7 +273,10 @@ describe Puppet::Util do
273
273
  it "should warn if the user's HOME is not set but their PATH contains a ~" do
274
274
  env_path = %w[~/bin /usr/bin /bin].join(File::PATH_SEPARATOR)
275
275
 
276
- Puppet::Util.withenv({:HOME => nil, :PATH => env_path}) do
276
+ env = {:HOME => nil, :PATH => env_path}
277
+ env.merge!({:HOMEDRIVE => nil, :USERPROFILE => nil}) if Puppet.features.microsoft_windows?
278
+
279
+ Puppet::Util.withenv(env) do
277
280
  Puppet::Util::Warnings.expects(:warnonce).once
278
281
  Puppet::Util.which('foo')
279
282
  end
metadata CHANGED
@@ -1,24 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
5
- prerelease:
4
+ version: 3.2.3.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Puppet Labs
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-13 00:00:00.000000000 Z
12
+ date: 2013-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: facter
15
+ name: rgen
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '1.6'
21
+ version: 0.6.5
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,15 +26,15 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '1.6'
29
+ version: 0.6.5
30
30
  - !ruby/object:Gem::Dependency
31
- name: hiera
31
+ name: facter
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '1.0'
37
+ version: '1.6'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,15 +42,15 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '1.0'
45
+ version: '1.6'
46
46
  - !ruby/object:Gem::Dependency
47
- name: rgen
47
+ name: hiera
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: '0.6'
53
+ version: '1.0'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0.6'
61
+ version: '1.0'
62
62
  description: Puppet, an automated configuration management tool
63
63
  email: info@puppetlabs.com
64
64
  executables:
@@ -1589,6 +1589,7 @@ files:
1589
1589
  - spec/unit/parser/ast/resource_defaults_spec.rb
1590
1590
  - spec/unit/parser/ast/astarray_spec.rb
1591
1591
  - spec/unit/parser/ast/resource_reference_spec.rb
1592
+ - spec/unit/parser/ast/block_expression_spec.rb
1592
1593
  - spec/unit/parser/ast/function_spec.rb
1593
1594
  - spec/unit/parser/ast/hostclass_spec.rb
1594
1595
  - spec/unit/parser/ast/vardef_spec.rb
@@ -2047,9 +2048,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
2047
2048
  required_rubygems_version: !ruby/object:Gem::Requirement
2048
2049
  none: false
2049
2050
  requirements:
2050
- - - ! '>='
2051
+ - - ! '>'
2051
2052
  - !ruby/object:Gem::Version
2052
- version: '0'
2053
+ version: 1.3.1
2053
2054
  requirements: []
2054
2055
  rubyforge_project: puppet
2055
2056
  rubygems_version: 1.8.23
@@ -2497,6 +2498,7 @@ test_files:
2497
2498
  - spec/unit/parser/ast/resource_defaults_spec.rb
2498
2499
  - spec/unit/parser/ast/astarray_spec.rb
2499
2500
  - spec/unit/parser/ast/resource_reference_spec.rb
2501
+ - spec/unit/parser/ast/block_expression_spec.rb
2500
2502
  - spec/unit/parser/ast/function_spec.rb
2501
2503
  - spec/unit/parser/ast/hostclass_spec.rb
2502
2504
  - spec/unit/parser/ast/vardef_spec.rb