rundeck 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +2 -0
- data/lib/rundeck/api.rb +1 -1
- data/lib/rundeck/client.rb +2 -1
- data/lib/rundeck/client/execution.rb +17 -22
- data/lib/rundeck/client/job.rb +3 -2
- data/lib/rundeck/client/project.rb +84 -0
- data/lib/rundeck/objectified_hash.rb +7 -1
- data/lib/rundeck/version.rb +1 -1
- data/rundeck.gemspec +1 -0
- data/spec/cassettes/12/create_project_invalid.yml +43 -0
- data/spec/cassettes/12/create_project_json.yml +55 -0
- data/spec/cassettes/12/create_project_xml.yml +58 -0
- data/spec/cassettes/12/delete_project_invalid.yml +41 -0
- data/spec/cassettes/12/delete_project_valid.yml +32 -0
- data/spec/cassettes/12/project_invalid.yml +41 -0
- data/spec/cassettes/12/project_valid.yml +55 -0
- data/spec/cassettes/12/projects.yml +44 -0
- data/spec/rundeck/client/execution_spec.rb +128 -89
- data/spec/rundeck/client/job_spec.rb +14 -8
- data/spec/rundeck/client/project_spec.rb +117 -0
- data/spec/rundeck/objectified_hash_spec.rb +16 -0
- data/spec/rundeck/request_spec.rb +1 -1
- data/spec/rundeck_spec.rb +1 -1
- data/spec/support/helpers.rb +36 -20
- metadata +36 -2
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: http://192.168.50.2:4440/api/12/project/anvils
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Rundeck-Auth-Token:
|
11
|
+
- cmJQYoy9EAsSd0905yNjKDNGs0ESIwEd
|
12
|
+
Accept:
|
13
|
+
- application/xml
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 204
|
17
|
+
message: No Content
|
18
|
+
headers:
|
19
|
+
Set-Cookie:
|
20
|
+
- JSESSIONID=h9bppwj9mk20c3su28yyj9v0;Path=/
|
21
|
+
Expires:
|
22
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
23
|
+
Content-Type:
|
24
|
+
- text/html;charset=UTF-8
|
25
|
+
Server:
|
26
|
+
- Jetty(7.6.0.v20120127)
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: ''
|
30
|
+
http_version:
|
31
|
+
recorded_at: Sun, 02 Nov 2014 18:46:20 GMT
|
32
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://192.168.50.2:4440/api/12/project/nonexistent
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Rundeck-Auth-Token:
|
11
|
+
- cmJQYoy9EAsSd0905yNjKDNGs0ESIwEd
|
12
|
+
Accept:
|
13
|
+
- application/xml
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 404
|
17
|
+
message: Not Found
|
18
|
+
headers:
|
19
|
+
Set-Cookie:
|
20
|
+
- JSESSIONID=7gqz90xxaj081m4rig5949nxn;Path=/
|
21
|
+
Expires:
|
22
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
23
|
+
Content-Type:
|
24
|
+
- text/xml;charset=UTF-8
|
25
|
+
X-Rundeck-Api-Version:
|
26
|
+
- '12'
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Server:
|
30
|
+
- Jetty(7.6.0.v20120127)
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: |-
|
34
|
+
<result error='true' apiversion='12'>
|
35
|
+
<error code='api.error.item.doesnotexist'>
|
36
|
+
<message>project does not exist: nonexistent</message>
|
37
|
+
</error>
|
38
|
+
</result>
|
39
|
+
http_version:
|
40
|
+
recorded_at: Sun, 02 Nov 2014 18:39:39 GMT
|
41
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://192.168.50.2:4440/api/12/project/anvils
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Rundeck-Auth-Token:
|
11
|
+
- cmJQYoy9EAsSd0905yNjKDNGs0ESIwEd
|
12
|
+
Accept:
|
13
|
+
- application/xml
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Set-Cookie:
|
20
|
+
- JSESSIONID=19y3li5pw7qg61i5gch7g94hab;Path=/
|
21
|
+
Expires:
|
22
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
23
|
+
X-Rundeck-Api-Xml-Response-Wrapper:
|
24
|
+
- 'false'
|
25
|
+
Content-Type:
|
26
|
+
- application/xml;charset=UTF-8
|
27
|
+
X-Rundeck-Api-Version:
|
28
|
+
- '12'
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Server:
|
32
|
+
- Jetty(7.6.0.v20120127)
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: |-
|
36
|
+
<project url='http://192.168.50.2:4440/api/12/project/anvils'>
|
37
|
+
<name>anvils</name>
|
38
|
+
<description></description>
|
39
|
+
<config>
|
40
|
+
<property key='project.name' value='anvils' />
|
41
|
+
<property key='project.ssh-authentication' value='privateKey' />
|
42
|
+
<property key='resources.source.2.config.directory' value='/var/rundeck/projects/anvils/etc/resources.d' />
|
43
|
+
<property key='resources.source.2.type' value='directory' />
|
44
|
+
<property key='service.NodeExecutor.default.provider' value='jsch-ssh' />
|
45
|
+
<property key='resources.source.1.config.includeServerNode' value='true' />
|
46
|
+
<property key='resources.source.1.config.generateFileAutomatically' value='true' />
|
47
|
+
<property key='resources.source.1.config.file' value='/var/rundeck/projects/anvils/etc/resources.xml' />
|
48
|
+
<property key='project.ssh-keypath' value='/var/lib/rundeck/.ssh/id_rsa' />
|
49
|
+
<property key='service.FileCopier.default.provider' value='jsch-scp' />
|
50
|
+
<property key='resources.source.1.type' value='file' />
|
51
|
+
</config>
|
52
|
+
</project>
|
53
|
+
http_version:
|
54
|
+
recorded_at: Sun, 02 Nov 2014 18:36:16 GMT
|
55
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://192.168.50.2:4440/api/12/projects
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Rundeck-Auth-Token:
|
11
|
+
- cmJQYoy9EAsSd0905yNjKDNGs0ESIwEd
|
12
|
+
Accept:
|
13
|
+
- application/xml
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Set-Cookie:
|
20
|
+
- JSESSIONID=jdrjk0hpsehg8rdfzj4a4ssy;Path=/
|
21
|
+
Expires:
|
22
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
23
|
+
X-Rundeck-Api-Xml-Response-Wrapper:
|
24
|
+
- 'false'
|
25
|
+
Content-Type:
|
26
|
+
- application/xml;charset=UTF-8
|
27
|
+
X-Rundeck-Api-Version:
|
28
|
+
- '12'
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Server:
|
32
|
+
- Jetty(7.6.0.v20120127)
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: |-
|
36
|
+
<projects count='1'>
|
37
|
+
<project url='http://192.168.50.2:4440/api/12/project/anvils'>
|
38
|
+
<name>anvils</name>
|
39
|
+
<description></description>
|
40
|
+
</project>
|
41
|
+
</projects>
|
42
|
+
http_version:
|
43
|
+
recorded_at: Fri, 31 Oct 2014 21:02:49 GMT
|
44
|
+
recorded_with: VCR 2.9.3
|
@@ -15,13 +15,19 @@ describe Rundeck::Client do
|
|
15
15
|
end
|
16
16
|
subject { @execute_job }
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
its(:count) { is_expected.to eq('1') }
|
19
|
+
|
20
|
+
describe '#execution' do
|
21
|
+
subject { @execute_job.execution }
|
22
|
+
|
23
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
24
|
+
it { is_expected.to respond_to(:user) }
|
25
|
+
it { is_expected.to respond_to(:date_started) }
|
26
|
+
its(:job) { is_expected.to respond_to(:name) }
|
27
|
+
its(:job) { is_expected.to respond_to(:group) }
|
28
|
+
its(:job) { is_expected.to respond_to(:project) }
|
29
|
+
its(:job) { is_expected.to respond_to(:description) }
|
30
|
+
end
|
25
31
|
|
26
32
|
it 'expects a post to have been made' do
|
27
33
|
expect(
|
@@ -56,52 +62,83 @@ describe Rundeck::Client do
|
|
56
62
|
end
|
57
63
|
subject { @job_executions }
|
58
64
|
|
59
|
-
it { is_expected.to
|
65
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
66
|
+
|
67
|
+
describe '#execution' do
|
68
|
+
subject { @job_executions.execution }
|
69
|
+
|
70
|
+
it { is_expected.to be_an Array }
|
71
|
+
|
72
|
+
context '#first' do
|
73
|
+
subject { @job_executions.execution[0] }
|
74
|
+
|
75
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
76
|
+
it { is_expected.to respond_to(:user) }
|
77
|
+
it { is_expected.to respond_to(:date_started) }
|
78
|
+
its(:job) { is_expected.to respond_to(:name) }
|
79
|
+
its(:job) { is_expected.to respond_to(:group) }
|
80
|
+
its(:job) { is_expected.to respond_to(:project) }
|
81
|
+
its(:job) { is_expected.to respond_to(:description) }
|
82
|
+
end
|
83
|
+
end
|
60
84
|
|
61
85
|
it 'expects a get to have been made' do
|
62
86
|
expect(a_get('/job/1/executions')).to have_been_made
|
63
87
|
end
|
64
88
|
end
|
65
89
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
90
|
+
describe '.running_job_executions' do
|
91
|
+
before do
|
92
|
+
@running_jobs = Rundeck.running_job_executions('anvils')
|
93
|
+
end
|
94
|
+
subject { @running_jobs }
|
95
|
+
|
96
|
+
context 'when there are multiple executions',
|
97
|
+
vcr: { cassette_name: 'running_jobs_multiple' } do
|
98
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
99
|
+
|
100
|
+
describe '#execution' do
|
101
|
+
subject { @running_jobs.execution }
|
102
|
+
|
103
|
+
it { is_expected.to be_an Array }
|
104
|
+
its('first') { is_expected.to respond_to(:user) }
|
105
|
+
its('first') { is_expected.to respond_to(:date_started) }
|
106
|
+
its('first') { is_expected.to respond_to(:job) }
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'expects a get to have been made' do
|
110
|
+
expect(a_get('/executions/running?project=anvils')).to have_been_made
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'when there is a single execution',
|
115
|
+
vcr: { cassette_name: 'running_jobs_single' } do
|
116
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
117
|
+
|
118
|
+
describe '#execution' do
|
119
|
+
subject { @running_jobs.execution }
|
120
|
+
|
121
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
122
|
+
it { is_expected.to respond_to(:user) }
|
123
|
+
it { is_expected.to respond_to(:date_started) }
|
124
|
+
it { is_expected.to respond_to(:job) }
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'expects a get to have been made' do
|
128
|
+
expect(a_get('/executions/running?project=anvils')).to have_been_made
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'when there are no running executions',
|
133
|
+
vcr: { cassette_name: 'running_jobs_none' } do
|
134
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
135
|
+
its(:count) { is_expected.to eq('0') }
|
136
|
+
|
137
|
+
it 'expects a get to have been made' do
|
138
|
+
expect(a_get('/executions/running?project=anvils')).to have_been_made
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
105
142
|
|
106
143
|
describe '.delete_job_executions' do
|
107
144
|
before do
|
@@ -293,48 +330,50 @@ describe Rundeck::Client do
|
|
293
330
|
end
|
294
331
|
end
|
295
332
|
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
333
|
+
describe '.execution_query' do
|
334
|
+
before do
|
335
|
+
@executions = Rundeck.execution_query(project, query: query)
|
336
|
+
end
|
337
|
+
subject { @executions }
|
338
|
+
|
339
|
+
context 'with a valid project id' do
|
340
|
+
let(:project) { 'anvils' }
|
341
|
+
|
342
|
+
context 'without any query parameters',
|
343
|
+
vcr: { cassette_name: 'execution_query_no_params_valid' } do
|
344
|
+
let(:query) { {} }
|
345
|
+
|
346
|
+
its('count.to_i') { is_expected.to be > 0 }
|
347
|
+
it { is_expected.to respond_to(:execution) }
|
348
|
+
its(:execution) { is_expected.to be_an Array }
|
349
|
+
|
350
|
+
it 'expects a get to have been made' do
|
351
|
+
expect(a_get('/executions?project=anvils')).to have_been_made
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
# context 'with query parameters',
|
356
|
+
# vcr: { cassette_name: 'execution_query_params_valid' } do
|
357
|
+
# let(:query) { }
|
358
|
+
#
|
359
|
+
# it 'expects a get to have been made' do
|
360
|
+
# expect(a_get('/executions')).to have_been_made
|
361
|
+
# end
|
362
|
+
# end
|
363
|
+
end
|
364
|
+
|
365
|
+
context 'with an invalid project id',
|
366
|
+
vcr: { cassette_name: 'execution_query_invalid' } do
|
367
|
+
let(:project) { 'other_project' }
|
368
|
+
let(:query) { {} }
|
369
|
+
|
370
|
+
its(:count) { is_expected.to eq('0') }
|
371
|
+
|
372
|
+
it 'expects a get to have been made' do
|
373
|
+
expect(a_get('/executions?project=other_project')).to have_been_made
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
338
377
|
|
339
378
|
describe '.execution_output' do
|
340
379
|
|
@@ -7,14 +7,20 @@ describe Rundeck::Client do
|
|
7
7
|
end
|
8
8
|
subject { @jobs }
|
9
9
|
|
10
|
-
it { is_expected.to
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
it { is_expected.to be_a Rundeck::ObjectifiedHash }
|
11
|
+
|
12
|
+
describe '#job' do
|
13
|
+
subject { @jobs.job }
|
14
|
+
|
15
|
+
it { is_expected.to be_an Array }
|
16
|
+
its(:length) { is_expected.to eq(6) }
|
17
|
+
|
18
|
+
# Only tests the first element, but it's just a sanity check
|
19
|
+
its('first') { is_expected.to respond_to(:name) }
|
20
|
+
its('first') { is_expected.to respond_to(:group) }
|
21
|
+
its('first') { is_expected.to respond_to(:project) }
|
22
|
+
its('first') { is_expected.to respond_to(:description) }
|
23
|
+
end
|
18
24
|
|
19
25
|
it 'expects a get to have been made' do
|
20
26
|
expect(a_get('/project/anvils/jobs')).to have_been_made
|