puppet 2.7.18 → 2.7.19
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/CHANGELOG +82 -0
- data/CONTRIBUTING.md +114 -171
- data/README.md +8 -0
- data/README_DEVELOPER.md +38 -3
- data/Rakefile +19 -3
- data/conf/osx/createpackage.sh +3 -1
- data/conf/redhat/logrotate +1 -1
- data/conf/redhat/puppet.spec +35 -8
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/agent.rb +2 -0
- data/lib/puppet/application/master.rb +2 -0
- data/lib/puppet/configurer.rb +2 -3
- data/lib/puppet/defaults.rb +6 -5
- data/lib/puppet/face/module/install.rb +2 -1
- data/lib/puppet/file_bucket/dipper.rb +1 -1
- data/lib/puppet/indirector/file_content.rb +2 -2
- data/lib/puppet/indirector/file_metadata.rb +2 -2
- data/lib/puppet/indirector/indirection.rb +3 -4
- data/lib/puppet/indirector/rest.rb +12 -6
- data/lib/puppet/interface/action_manager.rb +1 -2
- data/lib/puppet/module_tool/applications/unpacker.rb +22 -3
- data/lib/puppet/network/handler/fileserver.rb +2 -2
- data/lib/puppet/parser/ast/resource.rb +9 -2
- data/lib/puppet/parser/functions/fqdn_rand.rb +2 -1
- data/lib/puppet/parser/functions/md5.rb +2 -2
- data/lib/puppet/parser/functions/sha1.rb +2 -2
- data/lib/puppet/parser/functions/template.rb +0 -2
- data/lib/puppet/parser/type_loader.rb +1 -2
- data/lib/puppet/provider/augeas/augeas.rb +19 -1
- data/lib/puppet/provider/confine.rb +1 -1
- data/lib/puppet/provider/package/msi.rb +97 -51
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +1 -0
- data/lib/puppet/provider/service/gentoo.rb +0 -2
- data/lib/puppet/provider/service/openrc.rb +69 -0
- data/lib/puppet/provider/service/windows.rb +6 -4
- data/lib/puppet/provider/user/aix.rb +8 -4
- data/lib/puppet/provider/user/useradd.rb +6 -0
- data/lib/puppet/rails/benchmark.rb +2 -2
- data/lib/puppet/reports/store.rb +9 -9
- data/lib/puppet/resource/catalog.rb +2 -1
- data/lib/puppet/resource/type_collection.rb +2 -1
- data/lib/puppet/ssl/base.rb +1 -2
- data/lib/puppet/ssl/certificate_authority/interface.rb +1 -0
- data/lib/puppet/test/test_helper.rb +2 -1
- data/lib/puppet/type.rb +1 -1
- data/lib/puppet/type/augeas.rb +1 -1
- data/lib/puppet/type/file.rb +4 -2
- data/lib/puppet/type/scheduled_task.rb +8 -10
- data/lib/puppet/type/tidy.rb +1 -1
- data/lib/puppet/util.rb +63 -25
- data/lib/puppet/util/autoload.rb +6 -4
- data/lib/puppet/util/checksums.rb +3 -8
- data/lib/puppet/util/diff.rb +2 -1
- data/lib/puppet/util/filetype.rb +1 -3
- data/lib/puppet/util/run_mode.rb +2 -1
- data/lib/puppet/util/suidmanager.rb +1 -1
- data/lib/puppet/util/windows.rb +1 -0
- data/lib/puppet/util/windows/file.rb +27 -0
- data/lib/puppet/util/windows/user.rb +1 -2
- data/man/man8/puppet-agent.8 +4 -0
- data/man/man8/puppet-master.8 +4 -0
- data/man/man8/puppetmasterd.8 +4 -0
- data/spec/fixtures/unit/provider/augeas/augeas/augeas/lenses/test.aug +13 -0
- data/spec/fixtures/unit/provider/augeas/augeas/etc/fstab +10 -0
- data/spec/fixtures/unit/provider/augeas/augeas/etc/hosts +6 -0
- data/spec/fixtures/unit/provider/augeas/augeas/etc/test +3 -0
- data/spec/fixtures/unit/provider/augeas/augeas/test.aug +13 -0
- data/spec/fixtures/unit/provider/service/openrc/rcservice_list +8 -0
- data/spec/fixtures/unit/provider/service/openrc/rcstatus +43 -0
- data/spec/integration/defaults_spec.rb +3 -3
- data/spec/integration/network/server/mongrel_spec.rb +8 -6
- data/spec/integration/parser/parser_spec.rb +1 -1
- data/spec/integration/type/file_spec.rb +49 -12
- data/spec/lib/puppet_spec/database.rb +5 -3
- data/spec/lib/puppet_spec/files.rb +2 -1
- data/spec/monkey_patches/alias_should_to_must.rb +15 -2
- data/spec/shared_behaviours/file_serving_model.rb +9 -6
- data/spec/shared_behaviours/path_parameters.rb +5 -5
- data/spec/shared_behaviours/things_that_declare_options.rb +5 -5
- data/spec/unit/application/facts_spec.rb +1 -1
- data/spec/unit/application_spec.rb +10 -8
- data/spec/unit/configurer_spec.rb +11 -2
- data/spec/unit/face/ca_spec.rb +15 -15
- data/spec/unit/face/help_spec.rb +5 -5
- data/spec/unit/face/module/install_spec.rb +13 -2
- data/spec/unit/face/node_spec.rb +7 -6
- data/spec/unit/indirector/certificate_request/ca_spec.rb +1 -1
- data/spec/unit/indirector/envelope_spec.rb +0 -13
- data/spec/unit/indirector/facts/inventory_service_spec.rb +1 -1
- data/spec/unit/indirector/queue_spec.rb +3 -3
- data/spec/unit/indirector/rest_spec.rb +31 -20
- data/spec/unit/indirector_spec.rb +5 -5
- data/spec/unit/interface/action_builder_spec.rb +3 -2
- data/spec/unit/interface/action_manager_spec.rb +1 -1
- data/spec/unit/interface/action_spec.rb +4 -3
- data/spec/unit/interface/face_collection_spec.rb +1 -1
- data/spec/unit/interface/option_spec.rb +13 -9
- data/spec/unit/interface_spec.rb +5 -5
- data/spec/unit/module_tool/applications/unpacker_spec.rb +61 -0
- data/spec/unit/network/handler/fileserver_spec.rb +3 -3
- data/spec/unit/other/transbucket_spec.rb +6 -9
- data/spec/unit/parser/ast/resource_spec.rb +27 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +12 -12
- data/spec/unit/parser/lexer_spec.rb +5 -5
- data/spec/unit/provider/augeas/augeas_spec.rb +78 -0
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +6 -6
- data/spec/unit/provider/package/freebsd_spec.rb +2 -2
- data/spec/unit/provider/package/msi_spec.rb +181 -114
- data/spec/unit/provider/package/openbsd_spec.rb +1 -0
- data/spec/unit/provider/package/pkgdmg_spec.rb +3 -3
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +1 -1
- data/spec/unit/provider/service/openrc_spec.rb +209 -0
- data/spec/unit/provider/service/windows_spec.rb +57 -59
- data/spec/unit/provider/user/useradd_spec.rb +7 -0
- data/spec/unit/reports/store_spec.rb +13 -13
- data/spec/unit/resource/catalog_spec.rb +29 -24
- data/spec/unit/resource_spec.rb +13 -13
- data/spec/unit/simple_graph_spec.rb +12 -12
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +3 -3
- data/spec/unit/ssl/certificate_authority_spec.rb +11 -10
- data/spec/unit/transaction_spec.rb +3 -3
- data/spec/unit/type/cron_spec.rb +171 -171
- data/spec/unit/type/exec_spec.rb +29 -27
- data/spec/unit/type/file_spec.rb +22 -13
- data/spec/unit/type/interface_spec.rb +1 -1
- data/spec/unit/type/scheduled_task_spec.rb +15 -14
- data/spec/unit/type/tidy_spec.rb +2 -2
- data/spec/unit/type/user_spec.rb +15 -15
- data/spec/unit/type/vlan_spec.rb +1 -1
- data/spec/unit/type_spec.rb +22 -25
- data/spec/unit/util/autoload_spec.rb +13 -7
- data/spec/unit/util/backups_spec.rb +36 -67
- data/spec/unit/util/storage_spec.rb +2 -9
- data/spec/unit/util/suidmanager_spec.rb +1 -1
- data/spec/unit/util_spec.rb +20 -28
- data/test/ral/manager/attributes.rb +1 -1
- metadata +1553 -1542
@@ -216,14 +216,14 @@ describe Puppet::Transaction do
|
|
216
216
|
@transaction.eval_generate(resource)
|
217
217
|
|
218
218
|
@filenames.each do |file|
|
219
|
-
@transaction.catalog.resource(:file, file).
|
219
|
+
@transaction.catalog.resource(:file, file).must be_a(Puppet::Type.type(:file))
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
223
|
it "should add a sentinel whit for the resource" do
|
224
224
|
@transaction.eval_generate(resource)
|
225
225
|
|
226
|
-
find_vertex(:whit, "completed_#{path}").
|
226
|
+
find_vertex(:whit, "completed_#{path}").must be_a(Puppet::Type.type(:whit))
|
227
227
|
end
|
228
228
|
|
229
229
|
it "should replace dependencies on the resource with dependencies on the sentinel" do
|
@@ -558,7 +558,7 @@ describe Puppet::Transaction do
|
|
558
558
|
transaction.add_dynamically_generated_resources
|
559
559
|
|
560
560
|
generated.each do |res|
|
561
|
-
res.
|
561
|
+
res.must be_tagged(generator.tags)
|
562
562
|
end
|
563
563
|
end
|
564
564
|
end
|
data/spec/unit/type/cron_spec.rb
CHANGED
@@ -38,25 +38,25 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
|
|
38
38
|
|
39
39
|
describe "ensure" do
|
40
40
|
it "should support present as a value for ensure" do
|
41
|
-
|
41
|
+
expect { described_class.new(:name => 'foo', :ensure => :present) }.to_not raise_error
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should support absent as a value for ensure" do
|
45
|
-
|
45
|
+
expect { described_class.new(:name => 'foo', :ensure => :present) }.to_not raise_error
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should not support other values" do
|
49
|
-
|
49
|
+
expect { described_class.new(:name => 'foo', :ensure => :foo) }.to raise_error(Puppet::Error, /Invalid value/)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
describe "minute" do
|
54
54
|
it "should support absent" do
|
55
|
-
|
55
|
+
expect { described_class.new(:name => 'foo', :minute => 'absent') }.to_not raise_error
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should support *" do
|
59
|
-
|
59
|
+
expect { described_class.new(:name => 'foo', :minute => '*') }.to_not raise_error
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should translate absent to :absent" do
|
@@ -68,62 +68,62 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should support valid single values" do
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
expect { described_class.new(:name => 'foo', :minute => '0') }.to_not raise_error
|
72
|
+
expect { described_class.new(:name => 'foo', :minute => '1') }.to_not raise_error
|
73
|
+
expect { described_class.new(:name => 'foo', :minute => '59') }.to_not raise_error
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should not support non numeric characters" do
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
expect { described_class.new(:name => 'foo', :minute => 'z59') }.to raise_error(Puppet::Error, /z59 is not a valid minute/)
|
78
|
+
expect { described_class.new(:name => 'foo', :minute => '5z9') }.to raise_error(Puppet::Error, /5z9 is not a valid minute/)
|
79
|
+
expect { described_class.new(:name => 'foo', :minute => '59z') }.to raise_error(Puppet::Error, /59z is not a valid minute/)
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should not support single values out of range" do
|
83
83
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
expect { described_class.new(:name => 'foo', :minute => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid minute/)
|
85
|
+
expect { described_class.new(:name => 'foo', :minute => '60') }.to raise_error(Puppet::Error, /60 is not a valid minute/)
|
86
|
+
expect { described_class.new(:name => 'foo', :minute => '61') }.to raise_error(Puppet::Error, /61 is not a valid minute/)
|
87
|
+
expect { described_class.new(:name => 'foo', :minute => '120') }.to raise_error(Puppet::Error, /120 is not a valid minute/)
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should support valid multiple values" do
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
expect { described_class.new(:name => 'foo', :minute => ['0','1','59'] ) }.to_not raise_error
|
92
|
+
expect { described_class.new(:name => 'foo', :minute => ['40','30','20'] ) }.to_not raise_error
|
93
|
+
expect { described_class.new(:name => 'foo', :minute => ['10','30','20'] ) }.to_not raise_error
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should not support multiple values if at least one is invalid" do
|
97
97
|
# one invalid
|
98
|
-
|
99
|
-
|
100
|
-
|
98
|
+
expect { described_class.new(:name => 'foo', :minute => ['0','1','60'] ) }.to raise_error(Puppet::Error, /60 is not a valid minute/)
|
99
|
+
expect { described_class.new(:name => 'foo', :minute => ['0','120','59'] ) }.to raise_error(Puppet::Error, /120 is not a valid minute/)
|
100
|
+
expect { described_class.new(:name => 'foo', :minute => ['-1','1','59'] ) }.to raise_error(Puppet::Error, /-1 is not a valid minute/)
|
101
101
|
# two invalid
|
102
|
-
|
102
|
+
expect { described_class.new(:name => 'foo', :minute => ['0','61','62'] ) }.to raise_error(Puppet::Error, /(61|62) is not a valid minute/)
|
103
103
|
# all invalid
|
104
|
-
|
104
|
+
expect { described_class.new(:name => 'foo', :minute => ['-1','61','62'] ) }.to raise_error(Puppet::Error, /(-1|61|62) is not a valid minute/)
|
105
105
|
end
|
106
106
|
|
107
107
|
it "should support valid step syntax" do
|
108
|
-
|
109
|
-
|
108
|
+
expect { described_class.new(:name => 'foo', :minute => '*/2' ) }.to_not raise_error
|
109
|
+
expect { described_class.new(:name => 'foo', :minute => '10-16/2' ) }.to_not raise_error
|
110
110
|
end
|
111
111
|
|
112
112
|
it "should not support invalid steps" do
|
113
|
-
|
114
|
-
|
113
|
+
expect { described_class.new(:name => 'foo', :minute => '*/A' ) }.to raise_error(Puppet::Error, /\*\/A is not a valid minute/)
|
114
|
+
expect { described_class.new(:name => 'foo', :minute => '*/2A' ) }.to raise_error(Puppet::Error, /\*\/2A is not a valid minute/)
|
115
115
|
# As it turns out cron does not complaining about steps that exceed the valid range
|
116
|
-
#
|
116
|
+
# expect { described_class.new(:name => 'foo', :minute => '*/120' ) }.to raise_error(Puppet::Error, /is not a valid minute/)
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
120
|
describe "hour" do
|
121
121
|
it "should support absent" do
|
122
|
-
|
122
|
+
expect { described_class.new(:name => 'foo', :hour => 'absent') }.to_not raise_error
|
123
123
|
end
|
124
124
|
|
125
125
|
it "should support *" do
|
126
|
-
|
126
|
+
expect { described_class.new(:name => 'foo', :hour => '*') }.to_not raise_error
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should translate absent to :absent" do
|
@@ -135,62 +135,62 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
|
|
135
135
|
end
|
136
136
|
|
137
137
|
it "should support valid single values" do
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
138
|
+
expect { described_class.new(:name => 'foo', :hour => '0') }.to_not raise_error
|
139
|
+
expect { described_class.new(:name => 'foo', :hour => '11') }.to_not raise_error
|
140
|
+
expect { described_class.new(:name => 'foo', :hour => '12') }.to_not raise_error
|
141
|
+
expect { described_class.new(:name => 'foo', :hour => '13') }.to_not raise_error
|
142
|
+
expect { described_class.new(:name => 'foo', :hour => '23') }.to_not raise_error
|
143
143
|
end
|
144
144
|
|
145
145
|
it "should not support non numeric characters" do
|
146
|
-
|
147
|
-
|
148
|
-
|
146
|
+
expect { described_class.new(:name => 'foo', :hour => 'z15') }.to raise_error(Puppet::Error, /z15 is not a valid hour/)
|
147
|
+
expect { described_class.new(:name => 'foo', :hour => '1z5') }.to raise_error(Puppet::Error, /1z5 is not a valid hour/)
|
148
|
+
expect { described_class.new(:name => 'foo', :hour => '15z') }.to raise_error(Puppet::Error, /15z is not a valid hour/)
|
149
149
|
end
|
150
150
|
|
151
151
|
it "should not support single values out of range" do
|
152
|
-
|
153
|
-
|
154
|
-
|
152
|
+
expect { described_class.new(:name => 'foo', :hour => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid hour/)
|
153
|
+
expect { described_class.new(:name => 'foo', :hour => '24') }.to raise_error(Puppet::Error, /24 is not a valid hour/)
|
154
|
+
expect { described_class.new(:name => 'foo', :hour => '120') }.to raise_error(Puppet::Error, /120 is not a valid hour/)
|
155
155
|
end
|
156
156
|
|
157
157
|
it "should support valid multiple values" do
|
158
|
-
|
159
|
-
|
160
|
-
|
158
|
+
expect { described_class.new(:name => 'foo', :hour => ['0','1','23'] ) }.to_not raise_error
|
159
|
+
expect { described_class.new(:name => 'foo', :hour => ['5','16','14'] ) }.to_not raise_error
|
160
|
+
expect { described_class.new(:name => 'foo', :hour => ['16','13','9'] ) }.to_not raise_error
|
161
161
|
end
|
162
162
|
|
163
163
|
it "should not support multiple values if at least one is invalid" do
|
164
164
|
# one invalid
|
165
|
-
|
166
|
-
|
167
|
-
|
165
|
+
expect { described_class.new(:name => 'foo', :hour => ['0','1','24'] ) }.to raise_error(Puppet::Error, /24 is not a valid hour/)
|
166
|
+
expect { described_class.new(:name => 'foo', :hour => ['0','-1','5'] ) }.to raise_error(Puppet::Error, /-1 is not a valid hour/)
|
167
|
+
expect { described_class.new(:name => 'foo', :hour => ['-1','1','23'] ) }.to raise_error(Puppet::Error, /-1 is not a valid hour/)
|
168
168
|
# two invalid
|
169
|
-
|
169
|
+
expect { described_class.new(:name => 'foo', :hour => ['0','25','26'] ) }.to raise_error(Puppet::Error, /(25|26) is not a valid hour/)
|
170
170
|
# all invalid
|
171
|
-
|
171
|
+
expect { described_class.new(:name => 'foo', :hour => ['-1','24','120'] ) }.to raise_error(Puppet::Error, /(-1|24|120) is not a valid hour/)
|
172
172
|
end
|
173
173
|
|
174
174
|
it "should support valid step syntax" do
|
175
|
-
|
176
|
-
|
175
|
+
expect { described_class.new(:name => 'foo', :hour => '*/2' ) }.to_not raise_error
|
176
|
+
expect { described_class.new(:name => 'foo', :hour => '10-18/4' ) }.to_not raise_error
|
177
177
|
end
|
178
178
|
|
179
179
|
it "should not support invalid steps" do
|
180
|
-
|
181
|
-
|
180
|
+
expect { described_class.new(:name => 'foo', :hour => '*/A' ) }.to raise_error(Puppet::Error, /\*\/A is not a valid hour/)
|
181
|
+
expect { described_class.new(:name => 'foo', :hour => '*/2A' ) }.to raise_error(Puppet::Error, /\*\/2A is not a valid hour/)
|
182
182
|
# As it turns out cron does not complaining about steps that exceed the valid range
|
183
|
-
#
|
183
|
+
# expect { described_class.new(:name => 'foo', :hour => '*/26' ) }.to raise_error(Puppet::Error, /is not a valid hour/)
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
187
187
|
describe "weekday" do
|
188
188
|
it "should support absent" do
|
189
|
-
|
189
|
+
expect { described_class.new(:name => 'foo', :weekday => 'absent') }.to_not raise_error
|
190
190
|
end
|
191
191
|
|
192
192
|
it "should support *" do
|
193
|
-
|
193
|
+
expect { described_class.new(:name => 'foo', :weekday => '*') }.to_not raise_error
|
194
194
|
end
|
195
195
|
|
196
196
|
it "should translate absent to :absent" do
|
@@ -202,78 +202,78 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
|
|
202
202
|
end
|
203
203
|
|
204
204
|
it "should support valid numeric weekdays" do
|
205
|
-
|
206
|
-
|
207
|
-
|
205
|
+
expect { described_class.new(:name => 'foo', :weekday => '0') }.to_not raise_error
|
206
|
+
expect { described_class.new(:name => 'foo', :weekday => '1') }.to_not raise_error
|
207
|
+
expect { described_class.new(:name => 'foo', :weekday => '6') }.to_not raise_error
|
208
208
|
# According to http://www.manpagez.com/man/5/crontab 7 is also valid (Sunday)
|
209
|
-
|
209
|
+
expect { described_class.new(:name => 'foo', :weekday => '7') }.to_not raise_error
|
210
210
|
end
|
211
211
|
|
212
212
|
it "should support valid weekdays as words (long version)" do
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
213
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Monday') }.to_not raise_error
|
214
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Tuesday') }.to_not raise_error
|
215
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Wednesday') }.to_not raise_error
|
216
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Thursday') }.to_not raise_error
|
217
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Friday') }.to_not raise_error
|
218
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Saturday') }.to_not raise_error
|
219
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Sunday') }.to_not raise_error
|
220
220
|
end
|
221
221
|
|
222
222
|
it "should support valid weekdays as words (3 character version)" do
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
223
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Mon') }.to_not raise_error
|
224
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Tue') }.to_not raise_error
|
225
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Wed') }.to_not raise_error
|
226
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Thu') }.to_not raise_error
|
227
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Fri') }.to_not raise_error
|
228
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Sat') }.to_not raise_error
|
229
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Sun') }.to_not raise_error
|
230
230
|
end
|
231
231
|
|
232
232
|
it "should not support numeric values out of range" do
|
233
|
-
|
234
|
-
|
233
|
+
expect { described_class.new(:name => 'foo', :weekday => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid weekday/)
|
234
|
+
expect { described_class.new(:name => 'foo', :weekday => '8') }.to raise_error(Puppet::Error, /8 is not a valid weekday/)
|
235
235
|
end
|
236
236
|
|
237
237
|
it "should not support invalid weekday names" do
|
238
|
-
|
238
|
+
expect { described_class.new(:name => 'foo', :weekday => 'Sar') }.to raise_error(Puppet::Error, /Sar is not a valid weekday/)
|
239
239
|
end
|
240
240
|
|
241
241
|
it "should support valid multiple values" do
|
242
|
-
|
243
|
-
|
242
|
+
expect { described_class.new(:name => 'foo', :weekday => ['0','1','6'] ) }.to_not raise_error
|
243
|
+
expect { described_class.new(:name => 'foo', :weekday => ['Mon','Wed','Friday'] ) }.to_not raise_error
|
244
244
|
end
|
245
245
|
|
246
246
|
it "should not support multiple values if at least one is invalid" do
|
247
247
|
# one invalid
|
248
|
-
|
249
|
-
|
248
|
+
expect { described_class.new(:name => 'foo', :weekday => ['0','1','8'] ) }.to raise_error(Puppet::Error, /8 is not a valid weekday/)
|
249
|
+
expect { described_class.new(:name => 'foo', :weekday => ['Mon','Fii','Sat'] ) }.to raise_error(Puppet::Error, /Fii is not a valid weekday/)
|
250
250
|
# two invalid
|
251
|
-
|
251
|
+
expect { described_class.new(:name => 'foo', :weekday => ['Mos','Fii','Sat'] ) }.to raise_error(Puppet::Error, /(Mos|Fii) is not a valid weekday/)
|
252
252
|
# all invalid
|
253
|
-
|
254
|
-
|
253
|
+
expect { described_class.new(:name => 'foo', :weekday => ['Mos','Fii','Saa'] ) }.to raise_error(Puppet::Error, /(Mos|Fii|Saa) is not a valid weekday/)
|
254
|
+
expect { described_class.new(:name => 'foo', :weekday => ['-1','8','11'] ) }.to raise_error(Puppet::Error, /(-1|8|11) is not a valid weekday/)
|
255
255
|
end
|
256
256
|
|
257
257
|
it "should support valid step syntax" do
|
258
|
-
|
259
|
-
|
258
|
+
expect { described_class.new(:name => 'foo', :weekday => '*/2' ) }.to_not raise_error
|
259
|
+
expect { described_class.new(:name => 'foo', :weekday => '0-4/2' ) }.to_not raise_error
|
260
260
|
end
|
261
261
|
|
262
262
|
it "should not support invalid steps" do
|
263
|
-
|
264
|
-
|
263
|
+
expect { described_class.new(:name => 'foo', :weekday => '*/A' ) }.to raise_error(Puppet::Error, /\*\/A is not a valid weekday/)
|
264
|
+
expect { described_class.new(:name => 'foo', :weekday => '*/2A' ) }.to raise_error(Puppet::Error, /\*\/2A is not a valid weekday/)
|
265
265
|
# As it turns out cron does not complaining about steps that exceed the valid range
|
266
|
-
#
|
266
|
+
# expect { described_class.new(:name => 'foo', :weekday => '*/9' ) }.to raise_error(Puppet::Error, /is not a valid weekday/)
|
267
267
|
end
|
268
268
|
end
|
269
269
|
|
270
270
|
describe "month" do
|
271
271
|
it "should support absent" do
|
272
|
-
|
272
|
+
expect { described_class.new(:name => 'foo', :month => 'absent') }.to_not raise_error
|
273
273
|
end
|
274
274
|
|
275
275
|
it "should support *" do
|
276
|
-
|
276
|
+
expect { described_class.new(:name => 'foo', :month => '*') }.to_not raise_error
|
277
277
|
end
|
278
278
|
|
279
279
|
it "should translate absent to :absent" do
|
@@ -285,95 +285,95 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
|
|
285
285
|
end
|
286
286
|
|
287
287
|
it "should support valid numeric values" do
|
288
|
-
|
289
|
-
|
288
|
+
expect { described_class.new(:name => 'foo', :month => '1') }.to_not raise_error
|
289
|
+
expect { described_class.new(:name => 'foo', :month => '12') }.to_not raise_error
|
290
290
|
end
|
291
291
|
|
292
292
|
it "should support valid months as words" do
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
293
|
+
expect { described_class.new(:name => 'foo', :month => 'January') }.to_not raise_error
|
294
|
+
expect { described_class.new(:name => 'foo', :month => 'February') }.to_not raise_error
|
295
|
+
expect { described_class.new(:name => 'foo', :month => 'March') }.to_not raise_error
|
296
|
+
expect { described_class.new(:name => 'foo', :month => 'April') }.to_not raise_error
|
297
|
+
expect { described_class.new(:name => 'foo', :month => 'May') }.to_not raise_error
|
298
|
+
expect { described_class.new(:name => 'foo', :month => 'June') }.to_not raise_error
|
299
|
+
expect { described_class.new(:name => 'foo', :month => 'July') }.to_not raise_error
|
300
|
+
expect { described_class.new(:name => 'foo', :month => 'August') }.to_not raise_error
|
301
|
+
expect { described_class.new(:name => 'foo', :month => 'September') }.to_not raise_error
|
302
|
+
expect { described_class.new(:name => 'foo', :month => 'October') }.to_not raise_error
|
303
|
+
expect { described_class.new(:name => 'foo', :month => 'November') }.to_not raise_error
|
304
|
+
expect { described_class.new(:name => 'foo', :month => 'December') }.to_not raise_error
|
305
305
|
end
|
306
306
|
|
307
307
|
it "should support valid months as words (3 character short version)" do
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
308
|
+
expect { described_class.new(:name => 'foo', :month => 'Jan') }.to_not raise_error
|
309
|
+
expect { described_class.new(:name => 'foo', :month => 'Feb') }.to_not raise_error
|
310
|
+
expect { described_class.new(:name => 'foo', :month => 'Mar') }.to_not raise_error
|
311
|
+
expect { described_class.new(:name => 'foo', :month => 'Apr') }.to_not raise_error
|
312
|
+
expect { described_class.new(:name => 'foo', :month => 'May') }.to_not raise_error
|
313
|
+
expect { described_class.new(:name => 'foo', :month => 'Jun') }.to_not raise_error
|
314
|
+
expect { described_class.new(:name => 'foo', :month => 'Jul') }.to_not raise_error
|
315
|
+
expect { described_class.new(:name => 'foo', :month => 'Aug') }.to_not raise_error
|
316
|
+
expect { described_class.new(:name => 'foo', :month => 'Sep') }.to_not raise_error
|
317
|
+
expect { described_class.new(:name => 'foo', :month => 'Oct') }.to_not raise_error
|
318
|
+
expect { described_class.new(:name => 'foo', :month => 'Nov') }.to_not raise_error
|
319
|
+
expect { described_class.new(:name => 'foo', :month => 'Dec') }.to_not raise_error
|
320
320
|
end
|
321
321
|
|
322
322
|
it "should not support numeric values out of range" do
|
323
|
-
|
324
|
-
|
325
|
-
|
323
|
+
expect { described_class.new(:name => 'foo', :month => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid month/)
|
324
|
+
expect { described_class.new(:name => 'foo', :month => '0') }.to raise_error(Puppet::Error, /0 is not a valid month/)
|
325
|
+
expect { described_class.new(:name => 'foo', :month => '13') }.to raise_error(Puppet::Error, /13 is not a valid month/)
|
326
326
|
end
|
327
327
|
|
328
328
|
it "should not support words that are not valid months" do
|
329
|
-
|
329
|
+
expect { described_class.new(:name => 'foo', :month => 'Jal') }.to raise_error(Puppet::Error, /Jal is not a valid month/)
|
330
330
|
end
|
331
331
|
|
332
332
|
it "should not support single values out of range" do
|
333
333
|
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
334
|
+
expect { described_class.new(:name => 'foo', :month => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid month/)
|
335
|
+
expect { described_class.new(:name => 'foo', :month => '60') }.to raise_error(Puppet::Error, /60 is not a valid month/)
|
336
|
+
expect { described_class.new(:name => 'foo', :month => '61') }.to raise_error(Puppet::Error, /61 is not a valid month/)
|
337
|
+
expect { described_class.new(:name => 'foo', :month => '120') }.to raise_error(Puppet::Error, /120 is not a valid month/)
|
338
338
|
end
|
339
339
|
|
340
340
|
it "should support valid multiple values" do
|
341
|
-
|
342
|
-
|
341
|
+
expect { described_class.new(:name => 'foo', :month => ['1','9','12'] ) }.to_not raise_error
|
342
|
+
expect { described_class.new(:name => 'foo', :month => ['Jan','March','Jul'] ) }.to_not raise_error
|
343
343
|
end
|
344
344
|
|
345
345
|
it "should not support multiple values if at least one is invalid" do
|
346
346
|
# one invalid
|
347
|
-
|
348
|
-
|
349
|
-
|
347
|
+
expect { described_class.new(:name => 'foo', :month => ['0','1','12'] ) }.to raise_error(Puppet::Error, /0 is not a valid month/)
|
348
|
+
expect { described_class.new(:name => 'foo', :month => ['1','13','10'] ) }.to raise_error(Puppet::Error, /13 is not a valid month/)
|
349
|
+
expect { described_class.new(:name => 'foo', :month => ['Jan','Feb','Jxx'] ) }.to raise_error(Puppet::Error, /Jxx is not a valid month/)
|
350
350
|
# two invalid
|
351
|
-
|
351
|
+
expect { described_class.new(:name => 'foo', :month => ['Jan','Fex','Jux'] ) }.to raise_error(Puppet::Error, /(Fex|Jux) is not a valid month/)
|
352
352
|
# all invalid
|
353
|
-
|
354
|
-
|
353
|
+
expect { described_class.new(:name => 'foo', :month => ['-1','0','13'] ) }.to raise_error(Puppet::Error, /(-1|0|13) is not a valid month/)
|
354
|
+
expect { described_class.new(:name => 'foo', :month => ['Jax','Fex','Aux'] ) }.to raise_error(Puppet::Error, /(Jax|Fex|Aux) is not a valid month/)
|
355
355
|
end
|
356
356
|
|
357
357
|
it "should support valid step syntax" do
|
358
|
-
|
359
|
-
|
358
|
+
expect { described_class.new(:name => 'foo', :month => '*/2' ) }.to_not raise_error
|
359
|
+
expect { described_class.new(:name => 'foo', :month => '1-12/3' ) }.to_not raise_error
|
360
360
|
end
|
361
361
|
|
362
362
|
it "should not support invalid steps" do
|
363
|
-
|
364
|
-
|
363
|
+
expect { described_class.new(:name => 'foo', :month => '*/A' ) }.to raise_error(Puppet::Error, /\*\/A is not a valid month/)
|
364
|
+
expect { described_class.new(:name => 'foo', :month => '*/2A' ) }.to raise_error(Puppet::Error, /\*\/2A is not a valid month/)
|
365
365
|
# As it turns out cron does not complaining about steps that exceed the valid range
|
366
|
-
#
|
366
|
+
# expect { described_class.new(:name => 'foo', :month => '*/13' ) }.to raise_error(Puppet::Error, /is not a valid month/)
|
367
367
|
end
|
368
368
|
end
|
369
369
|
|
370
370
|
describe "monthday" do
|
371
371
|
it "should support absent" do
|
372
|
-
|
372
|
+
expect { described_class.new(:name => 'foo', :monthday => 'absent') }.to_not raise_error
|
373
373
|
end
|
374
374
|
|
375
375
|
it "should support *" do
|
376
|
-
|
376
|
+
expect { described_class.new(:name => 'foo', :monthday => '*') }.to_not raise_error
|
377
377
|
end
|
378
378
|
|
379
379
|
it "should translate absent to :absent" do
|
@@ -385,76 +385,76 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
|
|
385
385
|
end
|
386
386
|
|
387
387
|
it "should support valid single values" do
|
388
|
-
|
389
|
-
|
390
|
-
|
388
|
+
expect { described_class.new(:name => 'foo', :monthday => '1') }.to_not raise_error
|
389
|
+
expect { described_class.new(:name => 'foo', :monthday => '30') }.to_not raise_error
|
390
|
+
expect { described_class.new(:name => 'foo', :monthday => '31') }.to_not raise_error
|
391
391
|
end
|
392
392
|
|
393
393
|
it "should not support non numeric characters" do
|
394
|
-
|
395
|
-
|
396
|
-
|
394
|
+
expect { described_class.new(:name => 'foo', :monthday => 'z23') }.to raise_error(Puppet::Error, /z23 is not a valid monthday/)
|
395
|
+
expect { described_class.new(:name => 'foo', :monthday => '2z3') }.to raise_error(Puppet::Error, /2z3 is not a valid monthday/)
|
396
|
+
expect { described_class.new(:name => 'foo', :monthday => '23z') }.to raise_error(Puppet::Error, /23z is not a valid monthday/)
|
397
397
|
end
|
398
398
|
|
399
399
|
it "should not support single values out of range" do
|
400
|
-
|
401
|
-
|
402
|
-
|
400
|
+
expect { described_class.new(:name => 'foo', :monthday => '-1') }.to raise_error(Puppet::Error, /-1 is not a valid monthday/)
|
401
|
+
expect { described_class.new(:name => 'foo', :monthday => '0') }.to raise_error(Puppet::Error, /0 is not a valid monthday/)
|
402
|
+
expect { described_class.new(:name => 'foo', :monthday => '32') }.to raise_error(Puppet::Error, /32 is not a valid monthday/)
|
403
403
|
end
|
404
404
|
|
405
405
|
it "should support valid multiple values" do
|
406
|
-
|
407
|
-
|
408
|
-
|
406
|
+
expect { described_class.new(:name => 'foo', :monthday => ['1','23','31'] ) }.to_not raise_error
|
407
|
+
expect { described_class.new(:name => 'foo', :monthday => ['31','23','1'] ) }.to_not raise_error
|
408
|
+
expect { described_class.new(:name => 'foo', :monthday => ['1','31','23'] ) }.to_not raise_error
|
409
409
|
end
|
410
410
|
|
411
411
|
it "should not support multiple values if at least one is invalid" do
|
412
412
|
# one invalid
|
413
|
-
|
414
|
-
|
415
|
-
|
413
|
+
expect { described_class.new(:name => 'foo', :monthday => ['1','23','32'] ) }.to raise_error(Puppet::Error, /32 is not a valid monthday/)
|
414
|
+
expect { described_class.new(:name => 'foo', :monthday => ['-1','12','23'] ) }.to raise_error(Puppet::Error, /-1 is not a valid monthday/)
|
415
|
+
expect { described_class.new(:name => 'foo', :monthday => ['13','32','30'] ) }.to raise_error(Puppet::Error, /32 is not a valid monthday/)
|
416
416
|
# two invalid
|
417
|
-
|
417
|
+
expect { described_class.new(:name => 'foo', :monthday => ['-1','0','23'] ) }.to raise_error(Puppet::Error, /(-1|0) is not a valid monthday/)
|
418
418
|
# all invalid
|
419
|
-
|
419
|
+
expect { described_class.new(:name => 'foo', :monthday => ['-1','0','32'] ) }.to raise_error(Puppet::Error, /(-1|0|32) is not a valid monthday/)
|
420
420
|
end
|
421
421
|
|
422
422
|
it "should support valid step syntax" do
|
423
|
-
|
424
|
-
|
423
|
+
expect { described_class.new(:name => 'foo', :monthday => '*/2' ) }.to_not raise_error
|
424
|
+
expect { described_class.new(:name => 'foo', :monthday => '10-16/2' ) }.to_not raise_error
|
425
425
|
end
|
426
426
|
|
427
427
|
it "should not support invalid steps" do
|
428
|
-
|
429
|
-
|
428
|
+
expect { described_class.new(:name => 'foo', :monthday => '*/A' ) }.to raise_error(Puppet::Error, /\*\/A is not a valid monthday/)
|
429
|
+
expect { described_class.new(:name => 'foo', :monthday => '*/2A' ) }.to raise_error(Puppet::Error, /\*\/2A is not a valid monthday/)
|
430
430
|
# As it turns out cron does not complaining about steps that exceed the valid range
|
431
|
-
#
|
431
|
+
# expect { described_class.new(:name => 'foo', :monthday => '*/32' ) }.to raise_error(Puppet::Error, /is not a valid monthday/)
|
432
432
|
end
|
433
433
|
end
|
434
434
|
|
435
435
|
describe "environment" do
|
436
436
|
it "it should accept an :environment that looks like a path" do
|
437
|
-
|
437
|
+
expect do
|
438
438
|
described_class.new(:name => 'foo',:environment => 'PATH=/bin:/usr/bin:/usr/sbin')
|
439
|
-
end.
|
439
|
+
end.to_not raise_error
|
440
440
|
end
|
441
441
|
|
442
442
|
it "should not accept environment variables that do not contain '='" do
|
443
|
-
|
443
|
+
expect do
|
444
444
|
described_class.new(:name => 'foo',:environment => 'INVALID')
|
445
|
-
end.
|
445
|
+
end.to raise_error(Puppet::Error, /Invalid environment setting "INVALID"/)
|
446
446
|
end
|
447
447
|
|
448
448
|
it "should accept empty environment variables that do not contain '='" do
|
449
|
-
|
449
|
+
expect do
|
450
450
|
described_class.new(:name => 'foo',:environment => 'MAILTO=')
|
451
|
-
end.
|
451
|
+
end.to_not raise_error(Puppet::Error)
|
452
452
|
end
|
453
453
|
|
454
454
|
it "should accept 'absent'" do
|
455
|
-
|
455
|
+
expect do
|
456
456
|
described_class.new(:name => 'foo',:environment => 'absent')
|
457
|
-
end.
|
457
|
+
end.to_not raise_error(Puppet::Error)
|
458
458
|
end
|
459
459
|
|
460
460
|
end
|
@@ -481,7 +481,7 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
|
|
481
481
|
|
482
482
|
it "should require a command when adding an entry" do
|
483
483
|
entry = described_class.new(:name => "test_entry", :ensure => :present)
|
484
|
-
expect { entry.value(:command) }.
|
484
|
+
expect { entry.value(:command) }.to raise_error(Puppet::Error, /No command/)
|
485
485
|
end
|
486
486
|
|
487
487
|
it "should not require a command when removing an entry" do
|