scooter 4.2.8 → 4.2.9
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a35da87770dbadd3fc9e1d8bef641f96db670017
|
4
|
+
data.tar.gz: 6540f2f6bc94b4aed535d09f5cbe10b3eb7227ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 323fe60aa3c2acdcc1904cb08bbb6e3282150222ac777f4605e170f341b076e62c007a79440cc8cae1e0280065f642d17c122bbf7acf7448b0cb8e608944585a
|
7
|
+
data.tar.gz: 4e8d002e664caafd94a07176495e8aebe692b64fb6bc751ce0616ead4f72efeaf0114b2770257b2d018c09e0734258a44ea8ae126b359be6aa239a1b8b78a000
|
@@ -72,6 +72,12 @@ module Scooter
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
def post_schedule_task(payload)
|
76
|
+
@connection.post("#{@version}/command/schedule_task") do |req|
|
77
|
+
req.body = payload
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
75
81
|
#inventory endpoints
|
76
82
|
def get_inventory(node=nil)
|
77
83
|
url = "#{@version}/inventory"
|
@@ -134,6 +140,18 @@ module Scooter
|
|
134
140
|
def get_plan_job(plan_job_id)
|
135
141
|
@connection.get("#{@version}/plan_jobs/#{plan_job_id}")
|
136
142
|
end
|
143
|
+
|
144
|
+
def get_scheduled_jobs(limit=nil, offset=nil)
|
145
|
+
path = "#{@version}/scheduled_jobs"
|
146
|
+
@connection.get(path) do |request|
|
147
|
+
request.params['limit'] = limit if limit
|
148
|
+
request.params['offset'] = offset if offset
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def delete_scheduled_job(job_id)
|
153
|
+
@connection.delete("#{@version}/scheduled_jobs/#{job_id}")
|
154
|
+
end
|
137
155
|
end
|
138
156
|
end
|
139
157
|
end
|
@@ -83,6 +83,21 @@ module Scooter
|
|
83
83
|
def create_dumpling(dumpling)
|
84
84
|
post_dumpling(dumpling)
|
85
85
|
end
|
86
|
+
|
87
|
+
# @return [Faraday::Response] response object from Faraday http client
|
88
|
+
def create_scheduled_job(payload)
|
89
|
+
post_schedule_task(payload)
|
90
|
+
end
|
91
|
+
|
92
|
+
# @return [Faraday::Response] response object from Faraday http client
|
93
|
+
def remove_scheduled_job(job_id)
|
94
|
+
delete_scheduled_job(job_id)
|
95
|
+
end
|
96
|
+
|
97
|
+
# @return [Faraday::Response] response object from Faraday http client
|
98
|
+
def list_scheduled_jobs(limit=nil, offset=nil)
|
99
|
+
get_scheduled_jobs(limit, offset)
|
100
|
+
end
|
86
101
|
end
|
87
102
|
end
|
88
103
|
end
|
data/lib/scooter/version.rb
CHANGED
@@ -167,6 +167,17 @@ describe Scooter::HttpDispatchers::OrchestratorDispatcher do
|
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
|
+
describe '.create_scheduled_job' do
|
171
|
+
it { is_expected.not_to respond_to(:create_scheduled_job).with(0).arguments }
|
172
|
+
it { is_expected.to respond_to(:create_scheduled_job).with(1).arguments }
|
173
|
+
it { is_expected.not_to respond_to(:create_scheduled_job).with(2).arguments }
|
174
|
+
|
175
|
+
it 'should take a job id' do
|
176
|
+
expect(orchestrator_api.connection).to receive(:post).with("v1/command/schedule_task")
|
177
|
+
expect{ orchestrator_api.create_scheduled_job(job_id) }.not_to raise_error
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
170
181
|
describe '.get_inventory' do
|
171
182
|
let(:certname) {'thisismycertname'}
|
172
183
|
|
@@ -258,4 +269,45 @@ describe Scooter::HttpDispatchers::OrchestratorDispatcher do
|
|
258
269
|
expect{ orchestrator_api.create_dumpling(dumpling) }.not_to raise_error
|
259
270
|
end
|
260
271
|
end
|
272
|
+
|
273
|
+
describe '.list_scheduled_jobs' do
|
274
|
+
it {is_expected.to respond_to(:list_scheduled_jobs).with(0).arguments }
|
275
|
+
it {is_expected.to respond_to(:list_scheduled_jobs).with(1).arguments }
|
276
|
+
it {is_expected.to respond_to(:list_scheduled_jobs).with(2).arguments }
|
277
|
+
|
278
|
+
before do
|
279
|
+
# find the index of the default Faraday::Adapter::NetHttp handler
|
280
|
+
# and replace it with the Test adapter
|
281
|
+
index = subject.connection.builder.handlers.index(Faraday::Adapter::NetHttp)
|
282
|
+
subject.connection.builder.swap(index, Faraday::Adapter::Test) do |stub|
|
283
|
+
stub.get('/orchestrator/v1/scheduled_jobs') { [200, {}] }
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
it 'should make a request with query params' do
|
288
|
+
expect { subject.list_scheduled_jobs(50, 100) }.not_to raise_error
|
289
|
+
response = subject.list_scheduled_jobs(50, 100)
|
290
|
+
expect(response.status).to eq(200)
|
291
|
+
hashed_query = CGI.parse(response.env.url.query)
|
292
|
+
expect(hashed_query).to eq({"limit"=>["50"], "offset"=>["100"]})
|
293
|
+
end
|
294
|
+
|
295
|
+
it 'should make a request with no query params' do
|
296
|
+
expect { subject.list_scheduled_jobs}.not_to raise_error
|
297
|
+
response = subject.list_scheduled_jobs
|
298
|
+
expect(response.status).to eq(200)
|
299
|
+
expect(response.env.url.query).to be(nil)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
describe '.remove_scheduled_job' do
|
304
|
+
it { is_expected.not_to respond_to(:remove_scheduled_job).with(0).arguments }
|
305
|
+
it { is_expected.to respond_to(:remove_scheduled_job).with(1).arguments }
|
306
|
+
it { is_expected.not_to respond_to(:remove_scheduled_job).with(2).arguments }
|
307
|
+
|
308
|
+
it 'should take a job id' do
|
309
|
+
expect(orchestrator_api.connection).to receive(:delete).with("v1/scheduled_jobs/#{job_id}")
|
310
|
+
expect{ orchestrator_api.remove_scheduled_job(job_id) }.not_to raise_error
|
311
|
+
end
|
312
|
+
end
|
261
313
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scooter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|