puppet 3.1.0.rc1 → 3.1.0.rc2

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 (127) hide show
  1. data/COMMITTERS.md +185 -0
  2. data/ext/debian/changelog.erb +6 -0
  3. data/ext/debian/puppet-common.manpages +1 -0
  4. data/ext/debian/puppet.default +3 -1
  5. data/ext/debian/puppetmaster.default +6 -3
  6. data/ext/redhat/puppet.spec.erb +16 -5
  7. data/lib/puppet.rb +3 -5
  8. data/lib/puppet/defaults.rb +6 -5
  9. data/lib/puppet/dsl.rb +3 -7
  10. data/lib/puppet/dsl/resource_api.rb +120 -0
  11. data/lib/puppet/dsl/resource_type_api.rb +34 -0
  12. data/lib/puppet/module_tool.rb +23 -11
  13. data/lib/puppet/network/formats.rb +1 -1
  14. data/lib/puppet/node/environment.rb +1 -3
  15. data/lib/puppet/parser/ast/definition.rb +5 -2
  16. data/lib/puppet/parser/ast/hostclass.rb +3 -2
  17. data/lib/puppet/parser/ast/node.rb +5 -2
  18. data/lib/puppet/parser/ast/resourceparam.rb +1 -1
  19. data/lib/puppet/parser/compiler.rb +0 -10
  20. data/lib/puppet/parser/lexer.rb +50 -39
  21. data/lib/puppet/parser/parser_support.rb +29 -11
  22. data/lib/puppet/parser/scope.rb +2 -2
  23. data/lib/puppet/parser/type_loader.rb +7 -31
  24. data/lib/puppet/provider/package/openbsd.rb +16 -2
  25. data/lib/puppet/provider/package/pip.rb +11 -2
  26. data/lib/puppet/provider/package/portage.rb +29 -12
  27. data/lib/puppet/provider/service/launchd.rb +19 -14
  28. data/lib/puppet/provider/service/upstart.rb +1 -1
  29. data/lib/puppet/provider/user/hpux.rb +37 -2
  30. data/lib/puppet/resource.rb +25 -38
  31. data/lib/puppet/resource/type.rb +6 -14
  32. data/lib/puppet/settings.rb +1 -1
  33. data/lib/puppet/ssl/certificate_authority.rb +4 -1
  34. data/lib/puppet/ssl/certificate_request.rb +3 -1
  35. data/lib/puppet/ssl/certificate_signer.rb +22 -0
  36. data/lib/puppet/type.rb +4 -4
  37. data/lib/puppet/util/methodhelper.rb +0 -19
  38. data/lib/puppet/util/rubygems.rb +3 -1
  39. data/lib/puppet/util/selinux.rb +1 -6
  40. data/lib/puppet/version.rb +1 -1
  41. data/man/man5/puppet.conf.5 +81 -95
  42. data/man/man8/extlookup2hiera.8 +23 -0
  43. data/man/man8/puppet-agent.8 +3 -3
  44. data/man/man8/puppet-apply.8 +2 -6
  45. data/man/man8/puppet-ca.8 +6 -7
  46. data/man/man8/puppet-catalog.8 +6 -7
  47. data/man/man8/puppet-cert.8 +4 -4
  48. data/man/man8/puppet-certificate.8 +6 -7
  49. data/man/man8/puppet-certificate_request.8 +6 -7
  50. data/man/man8/puppet-certificate_revocation_list.8 +6 -7
  51. data/man/man8/puppet-config.8 +4 -8
  52. data/man/man8/puppet-describe.8 +1 -1
  53. data/man/man8/puppet-device.8 +1 -1
  54. data/man/man8/puppet-doc.8 +3 -3
  55. data/man/man8/puppet-facts.8 +4 -8
  56. data/man/man8/puppet-file.8 +6 -7
  57. data/man/man8/puppet-filebucket.8 +1 -1
  58. data/man/man8/puppet-help.8 +2 -6
  59. data/man/man8/puppet-inspect.8 +1 -1
  60. data/man/man8/puppet-instrumentation_data.8 +3 -7
  61. data/man/man8/puppet-instrumentation_listener.8 +3 -7
  62. data/man/man8/puppet-instrumentation_probe.8 +3 -7
  63. data/man/man8/puppet-key.8 +6 -7
  64. data/man/man8/puppet-kick.8 +5 -1
  65. data/man/man8/puppet-man.8 +2 -6
  66. data/man/man8/puppet-master.8 +2 -2
  67. data/man/man8/puppet-module.8 +11 -9
  68. data/man/man8/puppet-node.8 +38 -37
  69. data/man/man8/puppet-parser.8 +2 -6
  70. data/man/man8/puppet-plugin.8 +2 -6
  71. data/man/man8/puppet-queue.8 +1 -1
  72. data/man/man8/puppet-report.8 +3 -7
  73. data/man/man8/puppet-resource.8 +1 -1
  74. data/man/man8/puppet-resource_type.8 +3 -7
  75. data/man/man8/puppet-secret_agent.8 +2 -6
  76. data/man/man8/puppet-status.8 +3 -7
  77. data/man/man8/puppet.8 +1 -1
  78. data/spec/integration/parser/ruby_manifest_spec.rb +128 -0
  79. data/spec/lib/puppet_spec/compiler.rb +0 -11
  80. data/spec/spec_helper.rb +3 -4
  81. data/spec/unit/dsl/resource_api_spec.rb +180 -0
  82. data/spec/unit/dsl/resource_type_api_spec.rb +53 -0
  83. data/spec/unit/module_tool_spec.rb +79 -46
  84. data/spec/unit/network/formats_spec.rb +4 -0
  85. data/spec/unit/node/environment_spec.rb +0 -13
  86. data/spec/unit/parser/compiler_spec.rb +0 -26
  87. data/spec/unit/parser/parser_spec.rb +14 -0
  88. data/spec/unit/parser/type_loader_spec.rb +4 -15
  89. data/spec/unit/provider/package/openbsd_spec.rb +148 -35
  90. data/spec/unit/provider/package/pip_spec.rb +49 -25
  91. data/spec/unit/provider/package/portage_spec.rb +65 -0
  92. data/spec/unit/provider/service/launchd_spec.rb +6 -5
  93. data/spec/unit/provider/user/hpux_spec.rb +39 -11
  94. data/spec/unit/provider/user/useradd_spec.rb +14 -14
  95. data/spec/unit/resource/type_spec.rb +7 -49
  96. data/spec/unit/resource_spec.rb +0 -32
  97. data/spec/unit/ssl/certificate_request_spec.rb +18 -0
  98. data/spec/unit/util/rubygems_spec.rb +1 -1
  99. data/spec/unit/util/selinux_spec.rb +0 -2
  100. metadata +17 -50
  101. data/lib/puppet/dsl/actions.rb +0 -283
  102. data/lib/puppet/dsl/blank_slate.rb +0 -55
  103. data/lib/puppet/dsl/context.rb +0 -393
  104. data/lib/puppet/dsl/parser.rb +0 -57
  105. data/lib/puppet/dsl/resource_decorator.rb +0 -56
  106. data/lib/puppet/dsl/resource_reference.rb +0 -95
  107. data/lib/puppet/dsl/type_reference.rb +0 -102
  108. data/lib/puppet/util/manifest_filetype_helper.rb +0 -22
  109. data/spec/integration/dsl/classes_spec.rb +0 -191
  110. data/spec/integration/dsl/defaults_spec.rb +0 -38
  111. data/spec/integration/dsl/definitions_spec.rb +0 -73
  112. data/spec/integration/dsl/functions_spec.rb +0 -95
  113. data/spec/integration/dsl/nodes_spec.rb +0 -96
  114. data/spec/integration/dsl/params_spec.rb +0 -146
  115. data/spec/integration/dsl/relationships_spec.rb +0 -46
  116. data/spec/integration/dsl/resources_spec.rb +0 -202
  117. data/spec/integration/dsl/type_loading_spec.rb +0 -64
  118. data/spec/lib/matchers/catalog.rb +0 -50
  119. data/spec/lib/puppet_spec/dsl.rb +0 -29
  120. data/spec/unit/dsl/actions_spec.rb +0 -402
  121. data/spec/unit/dsl/blank_slate_spec.rb +0 -27
  122. data/spec/unit/dsl/context_spec.rb +0 -678
  123. data/spec/unit/dsl/parser_spec.rb +0 -56
  124. data/spec/unit/dsl/resource_decorator_spec.rb +0 -94
  125. data/spec/unit/dsl/resource_reference_spec.rb +0 -150
  126. data/spec/unit/dsl/type_reference_spec.rb +0 -164
  127. data/spec/unit/util/manifest_filetype_helper_spec.rb +0 -29
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
- require 'puppet_spec/dsl'
3
- require 'puppet/dsl/parser'
4
- include PuppetSpec::DSL
5
-
6
- describe Puppet::DSL::Parser do
7
- prepare_compiler_and_scope_for_evaluation
8
-
9
- describe "scope" do
10
- it "should allow to access current scope" do
11
- scope = mock
12
- scope.stubs(:known_resource_types)
13
- evaluate_in_scope :scope => scope do
14
- Puppet::DSL::Parser.current_scope.should be scope
15
- end
16
- end
17
-
18
- it "should fail when trying to remove scope from empty stack" do
19
- lambda do
20
- Puppet::DSL::Parser.remove_scope
21
- end.should raise_error RuntimeError
22
- end
23
-
24
- it "allows to add and remove a scope" do
25
- scope = mock
26
- Puppet::DSL::Parser.add_scope scope
27
- Puppet::DSL::Parser.current_scope.should be scope
28
- Puppet::DSL::Parser.remove_scope
29
- Puppet::DSL::Parser.current_scope.should be nil
30
- end
31
- end
32
-
33
- describe "#evaluate" do
34
- let(:filename) { "testfile" }
35
- let(:string) { "test" }
36
- let(:ruby_code) { Array.new }
37
- let(:main) { mock "main" }
38
- subject { Puppet::DSL::Parser }
39
-
40
- it "sets ruby_code for main object" do
41
- main.expects(:ruby_code).returns ruby_code
42
- subject.prepare_for_evaluation main, string, filename
43
- ruby_code.count.should == 1
44
- end
45
-
46
- it "sets parsed file's filename for ruby dsl" do
47
- main.stubs(:ruby_code).returns ruby_code
48
- subject.prepare_for_evaluation main, string, filename
49
-
50
- ruby_code.first.inspect.should == filename.inspect
51
- end
52
-
53
- end
54
-
55
- end
56
-
@@ -1,94 +0,0 @@
1
- require 'spec_helper'
2
- require 'puppet_spec/dsl'
3
- require 'puppet/resource'
4
- require 'puppet/dsl/resource_decorator'
5
-
6
- include PuppetSpec::DSL
7
-
8
- describe Puppet::DSL::ResourceDecorator do
9
- it "should yield resource proxy to a block" do
10
- Puppet::DSL::ResourceDecorator.new mock do |r|
11
- # there is no way to test whether r is a ResourceDecorator instance due to
12
- # BlankSlate class nature, so I only test that something is yielded to
13
- # a block
14
- expect {r}.not_to be_nil
15
- end
16
- end
17
-
18
- context "when accessing" do
19
- let(:resource) { mock "Resource" }
20
-
21
- describe "getting" do
22
- it "should proxy messages to a resource" do
23
- resource.expects(:[]).with(:param).returns 42
24
-
25
- Puppet::DSL::ResourceDecorator.new resource do |r|
26
- r.param.should == 42
27
- end
28
- end
29
-
30
-
31
- it "should cache methods for future use" do
32
- resource.expects(:[]).twice.with(:foobar).returns 42
33
-
34
- Puppet::DSL::ResourceDecorator.new resource do |r|
35
- r.foobar.should == 42
36
- r.foobar.should == 42
37
- end
38
- end
39
- end
40
-
41
- describe "setting" do
42
- prepare_compiler_and_scope_for_evaluation
43
- it "should proxy get messages to a resource" do
44
- resource.expects(:[]=).with :param, '42'
45
-
46
- Puppet::DSL::ResourceDecorator.new resource do |r|
47
- r.param = 42
48
- end
49
- end
50
-
51
- it "should call `reference' on resource references" do
52
- evaluate_in_context { notify "bar" }
53
-
54
- resource.expects(:[]=).with :param, "Notify[bar]"
55
- ref = evaluate_in_context { Puppet::DSL::Context::Notify["bar"] }
56
- Puppet::DSL::ResourceDecorator.new resource do |r|
57
- r.param = ref
58
- end
59
- end
60
-
61
- it "should cache methods for future use" do
62
- resource.expects(:[]=).twice.with :foobar, '42'
63
-
64
- Puppet::DSL::ResourceDecorator.new resource do |r|
65
- r.foobar = 42
66
- r.foobar = 42
67
- end
68
- end
69
-
70
- it "doesn't convert values to string when resource is given" do
71
- value = Puppet::Parser::Resource.new "test", "whatever", {:scope => scope}
72
- value.expects(:to_s).never
73
- resource.expects(:[]=)
74
-
75
- Puppet::DSL::ResourceDecorator.new resource do |r|
76
- r.key = value
77
- end
78
- end
79
-
80
- it "converts values to string when unless resource is given" do
81
- value = mock
82
- value.expects :to_s
83
- resource.expects :[]=
84
-
85
- Puppet::DSL::ResourceDecorator.new resource do |r|
86
- r.foo = value
87
- end
88
- end
89
-
90
- end
91
- end
92
-
93
- end
94
-
@@ -1,150 +0,0 @@
1
- require 'spec_helper'
2
- require 'puppet_spec/dsl'
3
- require 'puppet/dsl/resource_reference'
4
- include PuppetSpec::DSL
5
-
6
- describe Puppet::DSL::ResourceReference do
7
- prepare_compiler_and_scope_for_evaluation
8
- let(:typeref) { Puppet::DSL::TypeReference.new "notify" }
9
-
10
- describe "#initialize" do
11
-
12
- it "should validate resource existance" do
13
- scope.expects(:findresource).returns(!nil)
14
- evaluate_in_scope do
15
- Puppet::DSL::ResourceReference.new typeref, "foo"
16
- end
17
- end
18
-
19
- it "should raise ArgumentError when resource doesn't exist" do
20
- scope.expects(:findresource).returns nil
21
- evaluate_in_scope do
22
- lambda do
23
- Puppet::DSL::ResourceReference.new typeref, "foo"
24
- end.should raise_error ArgumentError
25
- end
26
- end
27
-
28
- end
29
-
30
- describe "#reference" do
31
- before :each do
32
- evaluate_in_context { notify "foo" }
33
- end
34
-
35
- it "should return string reference of a resource" do
36
- evaluate_in_scope do
37
- Puppet::DSL::ResourceReference.new(typeref, "foo").reference.should == "Notify[foo]"
38
- end
39
- end
40
-
41
- it "should be aliased to #to_s" do
42
- evaluate_in_scope do
43
- r = Puppet::DSL::ResourceReference.new(typeref, "foo")
44
- r.reference.should == r.to_s
45
- end
46
- end
47
-
48
- end
49
-
50
- describe "#override" do
51
- before :each do
52
- evaluate_in_context { notify "foo" }
53
- end
54
-
55
- it "should create new resource override" do
56
- evaluate_in_scope do
57
- r = Puppet::DSL::ResourceReference.new typeref, "foo"
58
- r.override :message => "asdf"
59
- r.resource[:message].should == "asdf"
60
- end
61
- end
62
-
63
- it "should return the override" do
64
- evaluate_in_scope do
65
- Puppet::DSL::ResourceReference.new(typeref, "foo").
66
- override(:message => "bar").should == {:message => "bar"}
67
- end
68
- end
69
-
70
- it "should allow passing a hash" do
71
- evaluate_in_scope do
72
- lambda do
73
- Puppet::DSL::ResourceReference.new(typeref, "foo").
74
- override(:message => "foobar").should == {:message => "foobar"}
75
- end.should_not raise_error
76
- end
77
- end
78
-
79
- it "should allow passing a block" do
80
- evaluate_in_scope do
81
- Puppet::DSL::ResourceReference.new(typeref, "foo").override do |foo|
82
- foo.message = "foobarbaz"
83
- end.should == {:message => "foobarbaz"}
84
- end
85
- end
86
-
87
- it "should allow passing both block and a hash; block overwrites hash" do
88
- evaluate_in_scope do
89
- Puppet::DSL::ResourceReference.new(typeref, "foo").
90
- override(:message => "foobar") do |foo|
91
- foo.message = "foobarbaz"
92
- end.should == {:message => "foobarbaz"}
93
- end
94
- end
95
-
96
- it "should raise ArgumentError when neither block or hash is passed" do
97
- evaluate_in_scope do
98
- lambda do
99
- Puppet::DSL::ResourceReference.new(typeref, "foo").override
100
- end.should raise_error ArgumentError
101
- end
102
-
103
- end
104
- end
105
-
106
- describe "#realize" do
107
-
108
- it "realizes the resource if it was virtual" do
109
- evaluate_in_context { virtual notify "foobarbaz" }
110
- evaluate_in_scope do
111
- Puppet::DSL::ResourceReference.new(typeref, "foobarbaz").realize
112
- end
113
-
114
- scope.compiler.collections.map(&:resources).flatten.map(&:name).should include "foobarbaz"
115
- end
116
-
117
- it "does nothing when the resource is not virtual" do
118
- evaluate_in_context { notify "foobarbaz" }
119
- evaluate_in_scope do
120
- Puppet::DSL::ResourceReference.new(typeref, "foobarbaz").realize
121
- end
122
-
123
- scope.compiler.collections.map(&:resources).flatten.map(&:name).should_not include "foobarbaz"
124
- end
125
- end
126
-
127
- describe "#collect" do
128
-
129
- it "collects the resource if it was exported" do
130
- evaluate_in_context { export notify "foobarbaz" }
131
- evaluate_in_scope do
132
- Puppet::DSL::ResourceReference.new(typeref, "foobarbaz").collect
133
- end
134
-
135
- scope.compiler.collections.map(&:resources).flatten.map(&:name).should include "foobarbaz"
136
- end
137
-
138
- it "does nothein when resource is not exported" do
139
- evaluate_in_context { notify "foobarbaz" }
140
- evaluate_in_scope do
141
- Puppet::DSL::ResourceReference.new(typeref, "foobarbaz").collect
142
- end
143
-
144
- scope.compiler.collections.map(&:resources).flatten.map(&:name).should_not include "foobarbaz"
145
- end
146
-
147
- end
148
-
149
- end
150
-
@@ -1,164 +0,0 @@
1
- require 'spec_helper'
2
- require 'puppet_spec/dsl'
3
- require 'puppet/dsl/type_reference'
4
- include PuppetSpec::DSL
5
-
6
- describe Puppet::DSL::TypeReference do
7
- prepare_compiler_and_scope_for_evaluation
8
-
9
- describe "#initialize" do
10
-
11
- it "should return a type reference" do
12
- Puppet::DSL::Context.stubs(:const_defined?).returns true
13
-
14
- Puppet::DSL::TypeReference.new("name").should_not be nil
15
- end
16
-
17
- it "should check whether the type exists" do
18
- Puppet::DSL::Context.expects(:const_defined?).returns true
19
-
20
- lambda do
21
- Puppet::DSL::TypeReference.new "name"
22
- end.should_not raise_error NameError
23
- end
24
-
25
- it "should raise NameError when the type doesn't exist" do
26
- Puppet::DSL::Context.expects(:const_defined?).returns false
27
- lambda do
28
- Puppet::DSL::TypeReference.new "name"
29
- end.should raise_error NameError
30
- end
31
-
32
- it "should canonize type name" do
33
- Puppet::DSL::Context.stubs(:const_defined?).returns true
34
- Puppet::DSL::TypeReference.new("name").type_name.should == "Name"
35
- end
36
-
37
- end
38
-
39
- describe "#[]" do
40
- let(:reference) { Puppet::DSL::TypeReference.new "notify" }
41
-
42
- it "should return new ResourceReference instance" do
43
- evaluate_in_context do
44
- notify "test"
45
- end
46
-
47
- evaluate_in_scope do
48
- reference["test"].should be_a Puppet::DSL::ResourceReference
49
- end
50
- end
51
-
52
- it "should raise ArgumentError when the resource doesn't exist" do
53
- evaluate_in_scope do
54
- lambda do
55
- reference["asdf"]
56
- end.should raise_error ArgumentError
57
- end
58
- end
59
-
60
- it "should cache created references" do
61
- evaluate_in_context do
62
- notify "test"
63
- end
64
-
65
- evaluate_in_scope do
66
- resource = reference["test"]
67
- resource.object_id.should be_equal reference["test"].object_id
68
- end
69
- end
70
-
71
- end
72
-
73
- describe "#collect" do
74
- it "should create a new exported collection" do
75
- evaluate_in_context do
76
- Puppet::DSL::Context::Notify.collect
77
- end
78
- compiler.collections.map do |c|
79
- [c.type, c.form]
80
- end.should include ["Notify", :exported]
81
- end
82
-
83
- it "should return the created collection" do
84
- evaluate_in_context do
85
- Puppet::DSL::Context::Notify.collect
86
- end.should be_a Puppet::Parser::Collector
87
- end
88
-
89
- end
90
-
91
- describe "#realize" do
92
- it "should create a new virtual collection" do
93
- evaluate_in_context do
94
- Puppet::DSL::Context::Notify.realize
95
- end
96
- compiler.collections.map do |c|
97
- [c.type, c.form]
98
- end.should include ["Notify", :virtual]
99
- end
100
-
101
- it "should return the created collection" do
102
- evaluate_in_context do
103
- Puppet::DSL::Context::Notify.realize
104
- end.should be_a Puppet::Parser::Collector
105
- end
106
-
107
- end
108
-
109
- describe "#defaults" do
110
-
111
- it "should apply defaults for a type" do
112
- evaluate_in_context do
113
- Puppet::DSL::Context::Notify.defaults :message => 42
114
- end
115
- scope.lookupdefaults("Notify").should have_key :message
116
- end
117
-
118
- it "should return current defaults" do
119
- evaluate_in_context do
120
- Puppet::DSL::Context::Notify.defaults :message => 42
121
- end.should == {:message => 42}
122
- end
123
-
124
- it "should return current defaults when called without arguments" do
125
- evaluate_in_context do
126
- Puppet::DSL::Context::Notify.defaults :message => 42
127
- Puppet::DSL::Context::Notify.defaults
128
- end.should == {:message => 42}
129
- end
130
-
131
- it "should allow to pass a hash" do
132
- lambda do
133
- evaluate_in_context do
134
- Puppet::DSL::Context::Notify.defaults :message => 42
135
- end
136
- end.should_not raise_error
137
- end
138
-
139
- it "should allow to pass a block" do
140
- lambda do
141
- evaluate_in_context do
142
- Puppet::DSL::Context::Notify.defaults do |d|
143
- d.message = 42
144
- end
145
- end
146
- end.should_not raise_error
147
- end
148
-
149
- it "should allow passing both hash and block; block overwrites hash" do
150
- lambda do
151
- evaluate_in_context do
152
- Puppet::DSL::Context::Notify.defaults :message => 30 do |d|
153
- d.message = 42
154
- end
155
- end.should == {:message => '42'}
156
- end.should_not raise_error
157
-
158
- end
159
-
160
- end
161
-
162
-
163
- end
164
-