hammer_cli_katello 0.16.1 → 0.17.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 +5 -5
- data/lib/hammer_cli_katello/activation_key.rb +3 -3
- data/lib/hammer_cli_katello/content_view.rb +14 -11
- data/lib/hammer_cli_katello/content_view_name_resolvable.rb +6 -3
- data/lib/hammer_cli_katello/content_view_purge.rb +7 -4
- data/lib/hammer_cli_katello/content_view_version.rb +11 -10
- data/lib/hammer_cli_katello/erratum.rb +5 -15
- data/lib/hammer_cli_katello/erratum_info_command.rb +26 -0
- data/lib/hammer_cli_katello/file.rb +2 -2
- data/lib/hammer_cli_katello/filter.rb +1 -1
- data/lib/hammer_cli_katello/foreman_search_options_creators.rb +4 -0
- data/lib/hammer_cli_katello/host_collection.rb +1 -1
- data/lib/hammer_cli_katello/host_errata.rb +3 -18
- data/lib/hammer_cli_katello/hostgroup_extensions.rb +1 -1
- data/lib/hammer_cli_katello/id_name_options_validator.rb +1 -1
- data/lib/hammer_cli_katello/lifecycle_environment.rb +1 -1
- data/lib/hammer_cli_katello/lifecycle_environment_name_resolvable.rb +6 -3
- data/lib/hammer_cli_katello/ostree_branch.rb +1 -0
- data/lib/hammer_cli_katello/package.rb +1 -1
- data/lib/hammer_cli_katello/puppet_environment_name_resolvable.rb +6 -3
- data/lib/hammer_cli_katello/repository.rb +7 -6
- data/lib/hammer_cli_katello/repository_scoped_to_product.rb +1 -1
- data/lib/hammer_cli_katello/repository_set.rb +32 -0
- data/lib/hammer_cli_katello/search_options_creators.rb +7 -0
- data/lib/hammer_cli_katello/version.rb +1 -1
- data/test/data/3.11/foreman_api.json +1 -0
- data/test/functional/content_view/version/export_test.rb +44 -0
- data/test/functional/erratum/erratum_helpers.rb +91 -0
- data/test/functional/erratum/info_test.rb +29 -0
- data/test/functional/host/errata/info_test.rb +27 -0
- data/test/functional/repository_set/available_repositories_test.rb +18 -0
- data/test/functional/repository_set/disable_test.rb +42 -0
- data/test/functional/repository_set/enable_test.rb +42 -0
- data/test/functional/repository_set/info_test.rb +17 -0
- data/test/functional/repository_set/list_test.rb +18 -0
- data/test/functional/repository_set/repository_set_helpers.rb +20 -0
- data/test/functional/test_helper.rb +13 -0
- data/test/test_helper.rb +1 -1
- data/test/unit/id_name_options_validator_test.rb +1 -1
- data/test/unit/search_options_creators_test.rb +6 -0
- metadata +26 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 91526da6c7ebab95a7aba39558d81c0a47fbe074
|
4
|
+
data.tar.gz: 6c44980914fdd9a4e8d308863f65aeaac002f09a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b530c2a5f82758bd0e074f9988d7973be4134a9f832877c2afc4c336f73a6e5a172778d9bfeeb6bb53370787d896a2f08578048fe818a71a9f9e68657e1e595
|
7
|
+
data.tar.gz: c9b15e7566318c658abefb3a372405571fe2f0875666f1d9bdec6596159d95021baf62e704ca2af33c96ebfbdaf61e9b5d9716d65c2c6d3859903d3d745d429f
|
@@ -90,7 +90,7 @@ module HammerCLIKatello
|
|
90
90
|
|
91
91
|
option "--unlimited-hosts", :flag, "Set hosts max to unlimited"
|
92
92
|
|
93
|
-
validate_options do
|
93
|
+
validate_options :before, 'IdResolution' do
|
94
94
|
all(:option_unlimited_hosts, :option_max_hosts).rejected
|
95
95
|
end
|
96
96
|
|
@@ -165,7 +165,7 @@ module HammerCLIKatello
|
|
165
165
|
option '--name', "ACTIVATION_KEY_NAME", _("Activation key name to search by"),
|
166
166
|
attribute_name: :option_activation_key_name
|
167
167
|
|
168
|
-
validate_options do
|
168
|
+
validate_options :before, 'IdResolution' do
|
169
169
|
any(:option_activation_key_id, :option_activation_key_name).required
|
170
170
|
end
|
171
171
|
|
@@ -238,7 +238,7 @@ module HammerCLIKatello
|
|
238
238
|
option "--name", "NAME", _("Name of activation key"),
|
239
239
|
:attribute_name => :option_activation_key_name
|
240
240
|
|
241
|
-
validate_options do
|
241
|
+
validate_options :before, 'IdResolution' do
|
242
242
|
any(:option_activation_key_id, :option_activation_key_name).required
|
243
243
|
end
|
244
244
|
|
@@ -109,7 +109,7 @@ module HammerCLIKatello
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
validate_options do
|
112
|
+
validate_options :before, 'IdResolution' do
|
113
113
|
product_options = [:option_product_id, :option_product_name]
|
114
114
|
if option(:option_repository_ids).exist?
|
115
115
|
any(*product_options).rejected
|
@@ -138,7 +138,7 @@ module HammerCLIKatello
|
|
138
138
|
option "--new-name", "NEW_NAME", _("New content view name"),
|
139
139
|
:attribute_name => :option_new_name
|
140
140
|
|
141
|
-
validate_options do
|
141
|
+
validate_options :before, 'IdResolution' do
|
142
142
|
organization_options = [:option_organization_id, :option_organization_name, \
|
143
143
|
:option_organization_label]
|
144
144
|
|
@@ -165,7 +165,7 @@ module HammerCLIKatello
|
|
165
165
|
success_message _("Content view updated.")
|
166
166
|
failure_message _("Could not update the content view")
|
167
167
|
|
168
|
-
validate_options do
|
168
|
+
validate_options :before, 'IdResolution' do
|
169
169
|
organization_options = [:option_organization_id, :option_organization_name, \
|
170
170
|
:option_organization_label]
|
171
171
|
|
@@ -187,7 +187,7 @@ module HammerCLIKatello
|
|
187
187
|
success_message _("Content view is being deleted with task %{id}.")
|
188
188
|
failure_message _("Could not delete the content view")
|
189
189
|
|
190
|
-
validate_options do
|
190
|
+
validate_options :before, 'IdResolution' do
|
191
191
|
organization_options = [:option_organization_id, :option_organization_name, \
|
192
192
|
:option_organization_label]
|
193
193
|
|
@@ -227,7 +227,7 @@ module HammerCLIKatello
|
|
227
227
|
build_options
|
228
228
|
end
|
229
229
|
|
230
|
-
class CVEnvParamsSource
|
230
|
+
class CVEnvParamsSource < HammerCLI::Options::Sources::Base
|
231
231
|
def initialize(command)
|
232
232
|
@command = command
|
233
233
|
end
|
@@ -257,8 +257,11 @@ module HammerCLIKatello
|
|
257
257
|
|
258
258
|
def option_sources
|
259
259
|
sources = super
|
260
|
-
|
261
|
-
|
260
|
+
sources.find_by_name('IdResolution').insert_relative(
|
261
|
+
:after,
|
262
|
+
'IdParams',
|
263
|
+
CVEnvParamsSource.new(self)
|
264
|
+
)
|
262
265
|
sources
|
263
266
|
end
|
264
267
|
|
@@ -282,7 +285,7 @@ module HammerCLIKatello
|
|
282
285
|
command_name 'add-version'
|
283
286
|
desc _('Add a content view version to a composite view')
|
284
287
|
|
285
|
-
validate_options do
|
288
|
+
validate_options :before, 'IdResolution' do
|
286
289
|
if option(:option_content_view_version_version).exist?
|
287
290
|
any(:option_content_view_id, :option_content_view_name).required
|
288
291
|
end
|
@@ -292,7 +295,7 @@ module HammerCLIKatello
|
|
292
295
|
plural ? "components" : "component"
|
293
296
|
end
|
294
297
|
|
295
|
-
validate_options do
|
298
|
+
validate_options :before, 'IdResolution' do
|
296
299
|
organization_options = [:option_organization_id, :option_organization_name, \
|
297
300
|
:option_organization_label]
|
298
301
|
|
@@ -317,7 +320,7 @@ module HammerCLIKatello
|
|
317
320
|
command_name 'remove-version'
|
318
321
|
desc _('Remove a content view version from a composite view')
|
319
322
|
|
320
|
-
validate_options do
|
323
|
+
validate_options :before, 'IdResolution' do
|
321
324
|
if option(:option_content_view_version_version).exist?
|
322
325
|
any(:option_content_view_id, :option_content_view_name).required
|
323
326
|
end
|
@@ -327,7 +330,7 @@ module HammerCLIKatello
|
|
327
330
|
plural ? "components" : "component"
|
328
331
|
end
|
329
332
|
|
330
|
-
validate_options do
|
333
|
+
validate_options :before, 'IdResolution' do
|
331
334
|
organization_options = [:option_organization_id, :option_organization_name, \
|
332
335
|
:option_organization_label]
|
333
336
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module HammerCLIKatello
|
2
2
|
module ContentViewNameResolvable
|
3
|
-
class ContentViewParamSource
|
3
|
+
class ContentViewParamSource < HammerCLI::Options::Sources::Base
|
4
4
|
def initialize(command)
|
5
5
|
@command = command
|
6
6
|
end
|
@@ -16,8 +16,11 @@ module HammerCLIKatello
|
|
16
16
|
|
17
17
|
def option_sources
|
18
18
|
sources = super
|
19
|
-
|
20
|
-
|
19
|
+
sources.find_by_name('IdResolution').insert_relative(
|
20
|
+
:after,
|
21
|
+
'IdParams',
|
22
|
+
ContentViewParamSource.new(self)
|
23
|
+
)
|
21
24
|
sources
|
22
25
|
end
|
23
26
|
end
|
@@ -12,7 +12,7 @@ module HammerCLIKatello
|
|
12
12
|
option "--count", "COUNT", _("count of unused versions to keep"),
|
13
13
|
default: 3, format: HammerCLI::Options::Normalizers::Number.new
|
14
14
|
|
15
|
-
validate_options do
|
15
|
+
validate_options :before, 'IdResolution' do
|
16
16
|
organization_options = [:option_organization_id, :option_organization_name, \
|
17
17
|
:option_organization_label]
|
18
18
|
|
@@ -25,7 +25,7 @@ module HammerCLIKatello
|
|
25
25
|
|
26
26
|
build_options
|
27
27
|
|
28
|
-
class ContentViewIdParamSource
|
28
|
+
class ContentViewIdParamSource < HammerCLI::Options::Sources::Base
|
29
29
|
def initialize(command)
|
30
30
|
@command = command
|
31
31
|
end
|
@@ -40,8 +40,11 @@ module HammerCLIKatello
|
|
40
40
|
|
41
41
|
def option_sources
|
42
42
|
sources = super
|
43
|
-
|
44
|
-
|
43
|
+
sources.find_by_name('IdResolution').insert_relative(
|
44
|
+
:after,
|
45
|
+
'IdParams',
|
46
|
+
ContentViewIdParamSource.new(self)
|
47
|
+
)
|
45
48
|
sources
|
46
49
|
end
|
47
50
|
|
@@ -185,7 +185,7 @@ module HammerCLIKatello
|
|
185
185
|
:format => HammerCLI::Options::Normalizers::List.new
|
186
186
|
)
|
187
187
|
|
188
|
-
validate_options do
|
188
|
+
validate_options :before, 'IdResolution' do
|
189
189
|
organization_options = [:option_organization_id, :option_organization_name]
|
190
190
|
|
191
191
|
if option(:option_lifecycle_environment_ids).exist?
|
@@ -320,12 +320,13 @@ module HammerCLIKatello
|
|
320
320
|
export_file = "#{export_prefix}.json"
|
321
321
|
export_repos_tar = "#{export_prefix}-repos.tar"
|
322
322
|
export_tar = "#{export_prefix}.tar"
|
323
|
+
export_dir = File.expand_path(options['option_export_dir'].to_s)
|
323
324
|
|
324
|
-
Dir.mkdir("#{
|
325
|
+
Dir.mkdir("#{export_dir}/#{export_prefix}")
|
325
326
|
|
326
327
|
if repositories
|
327
328
|
Dir.chdir(PUBLISHED_REPOS_DIR) do
|
328
|
-
repo_tar = "#{
|
329
|
+
repo_tar = "#{export_dir}/#{export_prefix}/#{export_repos_tar}"
|
329
330
|
repo_dirs = []
|
330
331
|
|
331
332
|
repositories.each do |repo|
|
@@ -336,29 +337,29 @@ module HammerCLIKatello
|
|
336
337
|
end
|
337
338
|
end
|
338
339
|
|
339
|
-
Dir.chdir("#{
|
340
|
+
Dir.chdir("#{export_dir}/#{export_prefix}") do
|
340
341
|
File.open(export_file, 'w') do |file|
|
341
342
|
file.write(JSON.pretty_generate(json))
|
342
343
|
end
|
343
344
|
end
|
344
345
|
|
345
|
-
Dir.chdir(
|
346
|
+
Dir.chdir(export_dir) do
|
346
347
|
`tar cf #{export_tar} #{export_prefix}`
|
347
348
|
FileUtils.rm_rf(export_prefix)
|
348
349
|
end
|
349
350
|
end
|
350
351
|
|
351
352
|
def check_repo_download_policy(repositories)
|
352
|
-
|
353
|
-
show(:repositories, 'id' => repo['library_instance_id'])['download_policy']
|
353
|
+
non_immediate = repositories.select do |repo|
|
354
|
+
show(:repositories, 'id' => repo['library_instance_id'])['download_policy'] != 'immediate'
|
354
355
|
end
|
355
|
-
return true if
|
356
|
+
return true if non_immediate.empty?
|
356
357
|
|
357
|
-
|
358
|
+
non_immediate_names = repositories.collect { |repo| repo['name'] }
|
358
359
|
msg = <<~MSG
|
359
360
|
All exported repositories must be set to an immediate download policy and re-synced.
|
360
361
|
The following repositories need action:
|
361
|
-
#{
|
362
|
+
#{non_immediate_names.join(', ')}
|
362
363
|
MSG
|
363
364
|
raise _(msg)
|
364
365
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'hammer_cli_katello/erratum_info_command'
|
2
|
+
|
1
3
|
module HammerCLIKatello
|
2
4
|
class ErratumCommand < HammerCLIKatello::Command
|
3
5
|
resource :errata
|
@@ -14,7 +16,7 @@ module HammerCLIKatello
|
|
14
16
|
field :title, _("Title")
|
15
17
|
end
|
16
18
|
|
17
|
-
validate_options do
|
19
|
+
validate_options :before, 'IdResolution' do
|
18
20
|
organization_options = [:option_organization_id, :option_organization_name, \
|
19
21
|
:option_organization_label]
|
20
22
|
|
@@ -28,20 +30,8 @@ module HammerCLIKatello
|
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
31
|
-
class InfoCommand < HammerCLIKatello::
|
32
|
-
|
33
|
-
field :id, _("ID")
|
34
|
-
field :errata_id, _("Errata ID")
|
35
|
-
field :title, _("Title")
|
36
|
-
field :type, _("Type")
|
37
|
-
field :severity, _("Severity")
|
38
|
-
field :issued, _("Issued")
|
39
|
-
field :updated, _("Updated")
|
40
|
-
field :description, _("Description")
|
41
|
-
field :summary, _("Summary")
|
42
|
-
field :solution, _("Solution")
|
43
|
-
end
|
44
|
-
|
33
|
+
class InfoCommand < HammerCLIKatello::ErratumInfoCommand
|
34
|
+
resource :errata
|
45
35
|
build_options
|
46
36
|
end
|
47
37
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module HammerCLIKatello
|
2
|
+
class ErratumInfoCommand < HammerCLIKatello::InfoCommand
|
3
|
+
command_name "info"
|
4
|
+
|
5
|
+
output do
|
6
|
+
field :title, _("Title")
|
7
|
+
field :version, _("Version")
|
8
|
+
field :description, _("Description")
|
9
|
+
field :status, _("Status")
|
10
|
+
field :id, _("ID")
|
11
|
+
field :errata_id, _("Errata ID")
|
12
|
+
field :reboot_suggested, _("Reboot Suggested")
|
13
|
+
field :updated, _("Updated")
|
14
|
+
field :issued, _("Issued")
|
15
|
+
field :release, _("Release")
|
16
|
+
field :solution, _("Solution")
|
17
|
+
field :packages, _("Packages"), Fields::List, :hide_blank => true
|
18
|
+
|
19
|
+
collection :module_streams, _("Module Streams"), :hide_blank => true do
|
20
|
+
field :name, _("Name")
|
21
|
+
field :stream, _("Stream")
|
22
|
+
field :packages, _("Packages"), Fields::List
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -13,7 +13,7 @@ module HammerCLIKatello
|
|
13
13
|
field :path, _("Path")
|
14
14
|
end
|
15
15
|
|
16
|
-
validate_options do
|
16
|
+
validate_options :before, 'IdResolution' do
|
17
17
|
organization_options = [:option_organization_id, :option_organization_name,
|
18
18
|
:option_organization_label]
|
19
19
|
if any(:option_product_name, :option_content_view_name).exist?
|
@@ -35,7 +35,7 @@ module HammerCLIKatello
|
|
35
35
|
field :checksum, _("Checksum")
|
36
36
|
end
|
37
37
|
|
38
|
-
validate_options do
|
38
|
+
validate_options :before, 'IdResolution' do
|
39
39
|
organization_options = [:option_organization_id, :option_organization_name,
|
40
40
|
:option_organization_label]
|
41
41
|
product_options = [:option_product_id, :option_product_name]
|
@@ -64,7 +64,7 @@ module HammerCLIKatello
|
|
64
64
|
success_message _("Filter created.")
|
65
65
|
failure_message _("Could not create the filter")
|
66
66
|
|
67
|
-
validate_options do
|
67
|
+
validate_options :before, 'IdResolution' do
|
68
68
|
organization_options = [:option_organization_id, :option_organization_name, \
|
69
69
|
:option_organization_label]
|
70
70
|
product_options = [:option_product_id, :option_product_name]
|
@@ -76,6 +76,10 @@ module HammerCLIKatello
|
|
76
76
|
create_search_options_without_katello_api(options, api.resource(:compute_resources), mode)
|
77
77
|
end
|
78
78
|
|
79
|
+
def create_compute_profiles_search_options(options, mode = nil)
|
80
|
+
create_search_options_without_katello_api(options, api.resource(:compute_profiles), mode)
|
81
|
+
end
|
82
|
+
|
79
83
|
def create_images_search_options(options, mode = nil)
|
80
84
|
create_search_options_without_katello_api(options, api.resource(:images), mode)
|
81
85
|
end
|
@@ -73,7 +73,7 @@ module HammerCLIKatello
|
|
73
73
|
option "--name", "HOST_COLLECTION_NAME", _("Host Collection Name"),
|
74
74
|
:attribute_name => :option_host_collection_name
|
75
75
|
|
76
|
-
validate_options do
|
76
|
+
validate_options :before, 'IdResolution' do
|
77
77
|
host_collection_options = [:option_host_collection_id, :option_host_collection_name]
|
78
78
|
any(*host_collection_options).required
|
79
79
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'hammer_cli_katello/erratum_info_command'
|
2
|
+
|
1
3
|
module HammerCLIKatello
|
2
4
|
class HostErrata < HammerCLIKatello::Command
|
3
5
|
desc "Manage errata on your hosts"
|
@@ -27,25 +29,8 @@ module HammerCLIKatello
|
|
27
29
|
build_options
|
28
30
|
end
|
29
31
|
|
30
|
-
class InfoCommand < HammerCLIKatello::
|
32
|
+
class InfoCommand < HammerCLIKatello::ErratumInfoCommand
|
31
33
|
resource :host_errata, :show
|
32
|
-
command_name "info"
|
33
|
-
|
34
|
-
output do
|
35
|
-
field :title, _("Title")
|
36
|
-
field :version, _("Version")
|
37
|
-
field :description, _("Description")
|
38
|
-
field :status, _("Status")
|
39
|
-
field :id, _("ID")
|
40
|
-
field :errata_id, _("Errata ID")
|
41
|
-
field :reboot_suggested, _("Reboot Suggested")
|
42
|
-
field :updated, _("Updated")
|
43
|
-
field :issued, _("Issued")
|
44
|
-
field :release, _("Release")
|
45
|
-
field :solution, _("Solution")
|
46
|
-
field :packages, _("Packages"), Fields::List
|
47
|
-
end
|
48
|
-
|
49
34
|
build_options
|
50
35
|
end
|
51
36
|
|
@@ -13,7 +13,7 @@ module HammerCLIKatello
|
|
13
13
|
base.option '--query-organization-label', 'ORGANIZATION_LABEL',
|
14
14
|
_('Organization label to search by'), attribute_name: :option_organization_label
|
15
15
|
|
16
|
-
base.validate_options do
|
16
|
+
base.validate_options :before, 'IdResolution' do
|
17
17
|
organization_options = [
|
18
18
|
:option_organization_id, :option_organization_name, :option_organization_label
|
19
19
|
]
|
@@ -18,7 +18,7 @@ module HammerCLIKatello
|
|
18
18
|
child_options = IdNameOptionsValidator.build_child_options(record_name)
|
19
19
|
parent_options = IdNameOptionsValidator.build_parent_options(parent)
|
20
20
|
|
21
|
-
validate_options do
|
21
|
+
validate_options :before, 'IdResolution' do
|
22
22
|
any(*child_options).required if required
|
23
23
|
|
24
24
|
if (name_option = child_options.detect { |opt| opt.end_with?('_name') }) &&
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module HammerCLIKatello
|
2
2
|
module LifecycleEnvironmentNameResolvable
|
3
|
-
class LifecycleEnvironmentParamSource
|
3
|
+
class LifecycleEnvironmentParamSource < HammerCLI::Options::Sources::Base
|
4
4
|
def initialize(command)
|
5
5
|
@command = command
|
6
6
|
end
|
@@ -16,8 +16,11 @@ module HammerCLIKatello
|
|
16
16
|
|
17
17
|
def option_sources
|
18
18
|
sources = super
|
19
|
-
|
20
|
-
|
19
|
+
sources.find_by_name('IdResolution').insert_relative(
|
20
|
+
:after,
|
21
|
+
'IdParams',
|
22
|
+
LifecycleEnvironmentParamSource.new(self)
|
23
|
+
)
|
21
24
|
sources
|
22
25
|
end
|
23
26
|
end
|