runcible 1.5.1 → 1.6.0
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/lib/runcible/extensions/docker_tag.rb +9 -0
- data/lib/runcible/extensions/repository.rb +27 -1
- data/lib/runcible/models/export_distributor.rb +4 -2
- data/lib/runcible/models/group_export_distributor.rb +44 -0
- data/lib/runcible/resources/repository_group.rb +19 -0
- data/lib/runcible/resources/task_group.rb +37 -0
- data/lib/runcible/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa61ed331487854ba6aa2914739fd80856d03591
|
4
|
+
data.tar.gz: 5b3ade65b768e0304a89dfe826c83a378c249a48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 120c8d0229e1e3fd352cbd47f3c764a7b41e050ac24e17ee8e7e5dbfebcc10ea6d756906951ebca1ec7211e2b2fd4a94a422e21553bc7c21e27dfb6ac386eaaa
|
7
|
+
data.tar.gz: ece06e609cb189105612f083356eff7940939a61fa1f4448efb46627fc548717189fb6d78834d26d22386019054bd064c405dffb4a99a620c1cafdbbcf0e707b
|
@@ -260,6 +260,26 @@ module Runcible
|
|
260
260
|
unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }
|
261
261
|
end
|
262
262
|
|
263
|
+
# Retrieves the docker tag IDs for a single repository
|
264
|
+
#
|
265
|
+
# @param [String] id the ID of the repository
|
266
|
+
# @return [RestClient::Response] the set of repository docker tag IDs
|
267
|
+
def docker_tag_ids(id)
|
268
|
+
criteria = {:type_ids => [Runcible::Extensions::DockerTag.content_type],
|
269
|
+
:fields => {:unit => [], :association => ['unit_id']}}
|
270
|
+
|
271
|
+
unit_search(id, criteria).map { |i| i['unit_id'] }
|
272
|
+
end
|
273
|
+
|
274
|
+
# Retrieves the docker tags for a single repository
|
275
|
+
#
|
276
|
+
# @param [String] id the ID of the repository
|
277
|
+
# @return [RestClient::Response] the set of repository docker tags
|
278
|
+
def docker_tags(id)
|
279
|
+
criteria = {:type_ids => [Runcible::Extensions::DockerTag.content_type]}
|
280
|
+
unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }
|
281
|
+
end
|
282
|
+
|
263
283
|
# Retrieves the docker image IDs for a single repository
|
264
284
|
#
|
265
285
|
# @param [String] id the ID of the repository
|
@@ -340,9 +360,15 @@ module Runcible
|
|
340
360
|
# Regenerate the applicability for consumers bound to a given set of repositories
|
341
361
|
#
|
342
362
|
# @param [String, Array] ids array of repo ids
|
363
|
+
# @param [boolean] parallel when true run the regeneration in parallel and return a task group
|
364
|
+
# tracking the summary,
|
365
|
+
# when false run this operation serially and return a list of
|
366
|
+
# spawned tasks that are to be tracked separately.
|
367
|
+
# False is the default option.
|
343
368
|
# @return [RestClient::Response]
|
344
|
-
def regenerate_applicability_by_ids(ids)
|
369
|
+
def regenerate_applicability_by_ids(ids, parallel = false)
|
345
370
|
criteria = {
|
371
|
+
'parallel' => parallel,
|
346
372
|
'repo_criteria' => { 'filters' => { 'id' => { '$in' => ids } } }
|
347
373
|
}
|
348
374
|
regenerate_applicability(criteria)
|
@@ -5,16 +5,18 @@ module Runcible
|
|
5
5
|
module Models
|
6
6
|
class ExportDistributor < Distributor
|
7
7
|
#required attributes
|
8
|
-
attr_accessor 'http', 'https'
|
8
|
+
attr_accessor 'http', 'https', 'relative_url'
|
9
9
|
|
10
10
|
# Instantiates a export distributor
|
11
11
|
#
|
12
12
|
# @param [boolean] http serve the contents over http
|
13
13
|
# @param [boolean] https serve the contents over https
|
14
|
+
# @param [string] relative_url relative url (aka relative path)
|
14
15
|
# @return [Runcible::Extensions::ExportDistributor]
|
15
|
-
def initialize(http, https)
|
16
|
+
def initialize(http, https, relative_url = nil)
|
16
17
|
@http = http
|
17
18
|
@https = https
|
19
|
+
@relative_url = relative_url
|
18
20
|
# Pulp seems to expect the ID to be export_distributor, not a random
|
19
21
|
super({:id => type_id})
|
20
22
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'active_support/json'
|
2
|
+
require 'securerandom'
|
3
|
+
|
4
|
+
module Runcible
|
5
|
+
module Models
|
6
|
+
class GroupExportDistributor < Distributor
|
7
|
+
#required attributes
|
8
|
+
attr_accessor 'http', 'https'
|
9
|
+
|
10
|
+
# Instantiates a group export distributor.
|
11
|
+
#
|
12
|
+
# @param [boolean] http serve the contents over http
|
13
|
+
# @param [boolean] https serve the contents over https
|
14
|
+
# @param [hash] params additional parameters to send in request
|
15
|
+
# @return [Runcible::Extensions::GroupExportDistributor]
|
16
|
+
def initialize(http = false, https = false, params = {})
|
17
|
+
@http = http
|
18
|
+
@https = https
|
19
|
+
# these two fields are helpful when instantiating a group export
|
20
|
+
# distributor via group creation. It saves a few pulp API calls.
|
21
|
+
@distributor_type_id = type_id
|
22
|
+
@distributor_config = {:http => http, :https => https}
|
23
|
+
super(params)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Distributor Type id
|
27
|
+
#
|
28
|
+
# @return [string]
|
29
|
+
def self.type_id
|
30
|
+
'group_export_distributor'
|
31
|
+
end
|
32
|
+
|
33
|
+
# generate the pulp config for the export distributor
|
34
|
+
#
|
35
|
+
# @return [Hash]
|
36
|
+
def config
|
37
|
+
to_ret = as_json
|
38
|
+
to_ret.delete('auto_publish')
|
39
|
+
to_ret.delete('id')
|
40
|
+
to_ret
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -31,6 +31,14 @@ module Runcible
|
|
31
31
|
call(:get, path(id))
|
32
32
|
end
|
33
33
|
|
34
|
+
# Retrieves a Repository Group's distributors
|
35
|
+
#
|
36
|
+
# @param [String] id the ID of the Repository group
|
37
|
+
# @return [RestClient::Response]
|
38
|
+
def retrieve_distributors(id)
|
39
|
+
call(:get, path(id) + 'distributors/')
|
40
|
+
end
|
41
|
+
|
34
42
|
# Retrieves all Repository Group
|
35
43
|
#
|
36
44
|
# @return [RestClient::Response]
|
@@ -63,6 +71,17 @@ module Runcible
|
|
63
71
|
def unassociate(id, criteria)
|
64
72
|
call(:post, path(id) + 'actions/unassociate/', :payload => {:required => criteria})
|
65
73
|
end
|
74
|
+
|
75
|
+
# Publishes a repository group using the specified distributor
|
76
|
+
#
|
77
|
+
# @param [String] id the id of the repository
|
78
|
+
# @param [String] distributor_id the id of the distributor
|
79
|
+
# @param [Hash] optional optional params
|
80
|
+
# @return [RestClient::Response]
|
81
|
+
def publish(id, distributor_id, optional = {})
|
82
|
+
call(:post, "#{path(id)}actions/publish/",
|
83
|
+
:payload => {:required => {:id => distributor_id}, :optional => optional})
|
84
|
+
end
|
66
85
|
end
|
67
86
|
end
|
68
87
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Runcible
|
2
|
+
module Resources
|
3
|
+
# @see https://pulp-dev-guide.readthedocs.org/en/latest/rest-api/dispatch/index.html
|
4
|
+
class TaskGroup < Runcible::Base
|
5
|
+
# Generates the API path for Tasks
|
6
|
+
#
|
7
|
+
# @param [String] id the id of the task
|
8
|
+
# @return [String] the task path, may contain the id if passed
|
9
|
+
def self.path(id = nil)
|
10
|
+
(id.nil?) ? 'task_groups/' : "task_groups/#{id}/"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.summary_path(id)
|
14
|
+
"task_groups/#{id}/state_summary/"
|
15
|
+
end
|
16
|
+
|
17
|
+
# summary for the status of a task
|
18
|
+
#
|
19
|
+
# @param [String] id the id of the task
|
20
|
+
# @return [RestClient::Response]
|
21
|
+
def summary(id)
|
22
|
+
call(:get, self.class.summary_path(id))
|
23
|
+
end
|
24
|
+
|
25
|
+
# checks if all tasks in the summary report have completed
|
26
|
+
# @param [Hash] the summary report obtained from summary(id) call
|
27
|
+
# @return true if tasks in the summary report have completed
|
28
|
+
def completed?(summary_report)
|
29
|
+
sum = 0
|
30
|
+
["finished", "canceled", "skipped", "suspended", "error"].each do |state|
|
31
|
+
sum += summary_report[state] if summary_report[state]
|
32
|
+
end
|
33
|
+
sum == summary_report["total"]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/runcible/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runcible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric D Helms, Justin Sherrill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- lib/runcible/extensions/distribution.rb
|
134
134
|
- lib/runcible/extensions/docker_image.rb
|
135
135
|
- lib/runcible/extensions/docker_manifest.rb
|
136
|
+
- lib/runcible/extensions/docker_tag.rb
|
136
137
|
- lib/runcible/extensions/errata.rb
|
137
138
|
- lib/runcible/extensions/ostree_branch.rb
|
138
139
|
- lib/runcible/extensions/package_category.rb
|
@@ -148,6 +149,7 @@ files:
|
|
148
149
|
- lib/runcible/models/docker_distributor.rb
|
149
150
|
- lib/runcible/models/docker_importer.rb
|
150
151
|
- lib/runcible/models/export_distributor.rb
|
152
|
+
- lib/runcible/models/group_export_distributor.rb
|
151
153
|
- lib/runcible/models/importer.rb
|
152
154
|
- lib/runcible/models/iso_distributor.rb
|
153
155
|
- lib/runcible/models/iso_importer.rb
|
@@ -171,6 +173,7 @@ files:
|
|
171
173
|
- lib/runcible/resources/repository_schedule.rb
|
172
174
|
- lib/runcible/resources/role.rb
|
173
175
|
- lib/runcible/resources/task.rb
|
176
|
+
- lib/runcible/resources/task_group.rb
|
174
177
|
- lib/runcible/resources/unit.rb
|
175
178
|
- lib/runcible/resources/user.rb
|
176
179
|
- lib/runcible/version.rb
|
@@ -193,8 +196,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
196
|
version: '0'
|
194
197
|
requirements: []
|
195
198
|
rubyforge_project:
|
196
|
-
rubygems_version: 2.4.
|
199
|
+
rubygems_version: 2.4.6
|
197
200
|
signing_key:
|
198
201
|
specification_version: 4
|
199
202
|
summary: ''
|
200
203
|
test_files: []
|
204
|
+
has_rdoc:
|