hammer_cli_katello 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hammer_cli_katello/host_collection.rb +6 -0
- data/lib/hammer_cli_katello/host_errata.rb +1 -1
- data/lib/hammer_cli_katello/repository.rb +0 -27
- data/lib/hammer_cli_katello/version.rb +1 -1
- data/test/functional/host_collection/create_test.rb +11 -0
- metadata +6 -8
- data/test/functional/repository/export_test.rb +0 -121
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ec840ea7e9516ce7268b7d2ddce6bebce2a4b4a71ac4963c475fc472a6e5dab
|
4
|
+
data.tar.gz: 2388188ed12e64cc36d20192ccd1d70c2e53547efef35a5f40b02d1a190fcb77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 190ede71c0bb873d5ded32b884de84137da2a367d987f055505fcfde3995a3419fd1e5c919630569b18266bba2efd5c5a496b471803de659f63dd547299c67e1
|
7
|
+
data.tar.gz: 3f96f683fb9a0ab6f0f92c6451aa528dd6929c6a16172dd1a4dfbfc63c7dcb6f1d7b2b0f49dc1fff72f039a08aaa5374d31d122a7222e053d985c78755f44e97
|
@@ -50,6 +50,12 @@ module HammerCLIKatello
|
|
50
50
|
success_message _("Host collection created.")
|
51
51
|
failure_message _("Could not create the host collection")
|
52
52
|
|
53
|
+
option "--unlimited-hosts", :flag, "Set hosts max to unlimited"
|
54
|
+
|
55
|
+
validate_options :before, 'IdResolution' do
|
56
|
+
all(:option_unlimited_hosts, :option_max_hosts).rejected
|
57
|
+
end
|
58
|
+
|
53
59
|
build_options
|
54
60
|
end
|
55
61
|
|
@@ -11,7 +11,7 @@ module HammerCLIKatello
|
|
11
11
|
success_message _("Errata is being applied with task %{id}.")
|
12
12
|
failure_message _("Could not apply errata")
|
13
13
|
|
14
|
-
build_options
|
14
|
+
build_options(without: ['ids'])
|
15
15
|
|
16
16
|
def execute
|
17
17
|
warn "This command uses katello agent and will be removed in favor of remote execution " \
|
@@ -541,33 +541,6 @@ module HammerCLIKatello
|
|
541
541
|
end
|
542
542
|
end
|
543
543
|
|
544
|
-
class ExportCommand < HammerCLIKatello::SingleResourceCommand
|
545
|
-
include HammerCLIForemanTasks::Async
|
546
|
-
include OrganizationOptions
|
547
|
-
extend RepositoryScopedToProduct
|
548
|
-
|
549
|
-
validate_repo_name_requires_product_options
|
550
|
-
action :export
|
551
|
-
command_name "export"
|
552
|
-
desc _("Export content from a repository to the configured directory")
|
553
|
-
|
554
|
-
success_message _("Repository is being exported in task %{id}.")
|
555
|
-
failure_message _("Could not export the repository")
|
556
|
-
|
557
|
-
validate_options :before, 'IdResolution' do
|
558
|
-
organization_options = [:option_organization_id, :option_organization_name, \
|
559
|
-
:option_organization_label]
|
560
|
-
|
561
|
-
if option(:option_product_name).exist?
|
562
|
-
any(*organization_options).required
|
563
|
-
end
|
564
|
-
end
|
565
|
-
|
566
|
-
build_options do |o|
|
567
|
-
o.expand.including(:products)
|
568
|
-
end
|
569
|
-
end
|
570
|
-
|
571
544
|
autoload_subcommands
|
572
545
|
end
|
573
546
|
end
|
@@ -29,6 +29,17 @@ module HammerCLIKatello
|
|
29
29
|
run_cmd(%w(host-collection create --name hc1 --organization org1))
|
30
30
|
end
|
31
31
|
|
32
|
+
it 'allows unlimited-hosts flag with no arguments' do
|
33
|
+
api_expects(:organizations, :index) { |par| par[:search] == "name = \"org1\"" }
|
34
|
+
.returns(index_response([{'id' => 1}]))
|
35
|
+
|
36
|
+
api_expects(:host_collections, :create) do |par|
|
37
|
+
par['unlimited_hosts'] == true
|
38
|
+
end
|
39
|
+
|
40
|
+
run_cmd(%w(host-collection create --name hc1 --organization org1 --unlimited-hosts))
|
41
|
+
end
|
42
|
+
|
32
43
|
it 'allows organization label' do
|
33
44
|
api_expects(:organizations, :index) { |par| par[:search] == "label = \"org1\"" }
|
34
45
|
.returns(index_response([{'id' => 1}]))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hammer_cli_katello
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Price
|
@@ -32,10 +32,10 @@ authors:
|
|
32
32
|
- Tom McKay
|
33
33
|
- Walden Raines
|
34
34
|
- Zach Huntington-Meath
|
35
|
-
autorequire:
|
35
|
+
autorequire:
|
36
36
|
bindir: bin
|
37
37
|
cert_chain: []
|
38
|
-
date: 2021-
|
38
|
+
date: 2021-08-12 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: hammer_cli_foreman
|
@@ -456,7 +456,6 @@ files:
|
|
456
456
|
- test/functional/product/update_test.rb
|
457
457
|
- test/functional/repository/create_test.rb
|
458
458
|
- test/functional/repository/delete_test.rb
|
459
|
-
- test/functional/repository/export_test.rb
|
460
459
|
- test/functional/repository/info_test.rb
|
461
460
|
- test/functional/repository/list_test.rb
|
462
461
|
- test/functional/repository/remove_content_test.rb
|
@@ -492,7 +491,7 @@ homepage: https://github.com/Katello/hammer-cli-katello
|
|
492
491
|
licenses:
|
493
492
|
- GPL-3.0
|
494
493
|
metadata: {}
|
495
|
-
post_install_message:
|
494
|
+
post_install_message:
|
496
495
|
rdoc_options: []
|
497
496
|
require_paths:
|
498
497
|
- lib
|
@@ -507,8 +506,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
507
506
|
- !ruby/object:Gem::Version
|
508
507
|
version: '0'
|
509
508
|
requirements: []
|
510
|
-
rubygems_version: 3.1.
|
511
|
-
signing_key:
|
509
|
+
rubygems_version: 3.1.6
|
510
|
+
signing_key:
|
512
511
|
specification_version: 4
|
513
512
|
summary: Katello commands for Hammer
|
514
513
|
test_files:
|
@@ -672,7 +671,6 @@ test_files:
|
|
672
671
|
- test/functional/product/update_test.rb
|
673
672
|
- test/functional/repository/create_test.rb
|
674
673
|
- test/functional/repository/delete_test.rb
|
675
|
-
- test/functional/repository/export_test.rb
|
676
674
|
- test/functional/repository/info_test.rb
|
677
675
|
- test/functional/repository/list_test.rb
|
678
676
|
- test/functional/repository/remove_content_test.rb
|
@@ -1,121 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
require_relative '../organization/organization_helpers'
|
3
|
-
require 'hammer_cli_katello/repository'
|
4
|
-
|
5
|
-
module HammerCLIKatello
|
6
|
-
describe Repository::ExportCommand do
|
7
|
-
include ForemanTaskHelpers
|
8
|
-
include OrganizationHelpers
|
9
|
-
|
10
|
-
it 'allows minimal options' do
|
11
|
-
ex = api_expects(:repositories, :export) do |p|
|
12
|
-
p['id'] == 1
|
13
|
-
end
|
14
|
-
ex.returns(id: '2')
|
15
|
-
|
16
|
-
expect_foreman_task('2')
|
17
|
-
|
18
|
-
run_cmd(%w(repository export --id 1))
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'resolves repository ID' do
|
22
|
-
it 'by requiring product' do
|
23
|
-
api_expects_no_call
|
24
|
-
result = run_cmd(%w(repository export --name repo1))
|
25
|
-
assert(result.err[/--product, --product-id is required/], 'Incorrect error message')
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'by product ID' do
|
29
|
-
ex = api_expects(:repositories, :index) do |p|
|
30
|
-
p['name'] == 'repo1' && p['product_id'] == 3
|
31
|
-
end
|
32
|
-
ex.returns(index_response([{'id' => 1}]))
|
33
|
-
|
34
|
-
ex = api_expects(:repositories, :export) do |p|
|
35
|
-
p['id'] == 1
|
36
|
-
end
|
37
|
-
ex.returns(id: '2')
|
38
|
-
|
39
|
-
expect_foreman_task('2')
|
40
|
-
|
41
|
-
run_cmd(%w(repository export --name repo1 --product-id 3))
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe 'resolves product ID' do
|
46
|
-
it 'by requiring organization options' do
|
47
|
-
api_expects_no_call
|
48
|
-
result = run_cmd(%w(repository export --name repo1 --product prod1))
|
49
|
-
assert(result.err[/--organization-id, --organization, --organization-label is required/],
|
50
|
-
"Organization option requirements must be validated")
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'by organization ID' do
|
54
|
-
ex = api_expects(:products, :index) do |p|
|
55
|
-
p['name'] == 'prod3' && p['organization_id'] == '5'
|
56
|
-
end
|
57
|
-
ex.returns(index_response([{'id' => 3}]))
|
58
|
-
|
59
|
-
ex = api_expects(:repositories, :index) do |p|
|
60
|
-
p['name'] == 'repo1' && p['product_id'] == 3
|
61
|
-
end
|
62
|
-
ex.returns(index_response([{'id' => 1}]))
|
63
|
-
|
64
|
-
ex = api_expects(:repositories, :export) do |p|
|
65
|
-
p['id'] == 1
|
66
|
-
end
|
67
|
-
ex.returns(id: '2')
|
68
|
-
|
69
|
-
expect_foreman_task('2')
|
70
|
-
|
71
|
-
run_cmd(%w(repository export --name repo1 --product prod3 --organization-id 5))
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'by organization name' do
|
75
|
-
expect_organization_search('org5', 5)
|
76
|
-
|
77
|
-
ex = api_expects(:products, :index) do |p|
|
78
|
-
p['name'] == 'prod3' && p['organization_id'] == 5
|
79
|
-
end
|
80
|
-
ex.returns(index_response([{'id' => 3}]))
|
81
|
-
|
82
|
-
ex = api_expects(:repositories, :index) do |p|
|
83
|
-
p['name'] == 'repo1' && p['product_id'] == 3
|
84
|
-
end
|
85
|
-
ex.returns(index_response([{'id' => 1}]))
|
86
|
-
|
87
|
-
ex = api_expects(:repositories, :export) do |p|
|
88
|
-
p['id'] == 1
|
89
|
-
end
|
90
|
-
ex.returns(id: '2')
|
91
|
-
|
92
|
-
expect_foreman_task('2')
|
93
|
-
|
94
|
-
run_cmd(%w(repository export --name repo1 --product prod3 --organization org5))
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'by organization label' do
|
98
|
-
expect_organization_search('org5', 5, field: 'label')
|
99
|
-
|
100
|
-
ex = api_expects(:products, :index) do |p|
|
101
|
-
p['name'] == 'prod3' && p['organization_id'] == 5
|
102
|
-
end
|
103
|
-
ex.returns(index_response([{'id' => 3}]))
|
104
|
-
|
105
|
-
ex = api_expects(:repositories, :index) do |p|
|
106
|
-
p['name'] == 'repo1' && p['product_id'] == 3
|
107
|
-
end
|
108
|
-
ex.returns(index_response([{'id' => 1}]))
|
109
|
-
|
110
|
-
ex = api_expects(:repositories, :export) do |p|
|
111
|
-
p['id'] == 1
|
112
|
-
end
|
113
|
-
ex.returns(id: '2')
|
114
|
-
|
115
|
-
expect_foreman_task('2')
|
116
|
-
|
117
|
-
run_cmd(%w(repository export --name repo1 --product prod3 --organization-label org5))
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|