hammer_cli_katello 0.11.5.1 → 0.12.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/hammer_cli_katello.rb +5 -0
- data/lib/hammer_cli_katello/content_view.rb +22 -8
- data/lib/hammer_cli_katello/file.rb +72 -0
- data/lib/hammer_cli_katello/foreman_search_options_creators.rb +34 -34
- data/lib/hammer_cli_katello/host_collection.rb +18 -0
- data/lib/hammer_cli_katello/host_content_source_options.rb +25 -0
- data/lib/hammer_cli_katello/host_extensions.rb +34 -3
- data/lib/hammer_cli_katello/host_kickstart_repository_options.rb +49 -0
- data/lib/hammer_cli_katello/hostgroup_extensions.rb +25 -3
- data/lib/hammer_cli_katello/id_resolver.rb +15 -9
- data/lib/hammer_cli_katello/repository.rb +47 -1
- data/lib/hammer_cli_katello/search_options_creators.rb +23 -16
- data/lib/hammer_cli_katello/sync_plan.rb +5 -0
- data/lib/hammer_cli_katello/version.rb +1 -1
- data/test/functional/capsule/content/add_lifecycle_environment_test.rb +3 -3
- data/test/functional/capsule/content/cancel_synchronization_test.rb +3 -3
- data/test/functional/capsule/content/info_test.rb +3 -3
- data/test/functional/capsule/content/lifecycle_environments_test.rb +1 -1
- data/test/functional/capsule/content/remove_lifecycle_environment_test.rb +3 -3
- data/test/functional/capsule/content/synchronization_status_test.rb +3 -3
- data/test/functional/content_view/content_view_helpers.rb +4 -0
- data/test/functional/content_view/create_test.rb +2 -2
- data/test/functional/content_view/filter/delete_test.rb +1 -4
- data/test/functional/content_view/filter/info_test.rb +1 -4
- data/test/functional/content_view/filter/list_test.rb +1 -1
- data/test/functional/content_view/filter/update_test.rb +1 -4
- data/test/functional/erratum/list_test.rb +1 -1
- data/test/functional/file/file_helpers.rb +13 -0
- data/test/functional/file/info_test.rb +162 -0
- data/test/functional/file/list_test.rb +112 -0
- data/test/functional/filter_rule/info_test.rb +1 -1
- data/test/functional/filter_rule/update_test.rb +1 -1
- data/test/functional/host/extensions/create_test.rb +95 -0
- data/test/functional/host/extensions/data/host.json +4 -0
- data/test/functional/host/extensions/info_test.rb +5 -3
- data/test/functional/host/extensions/update_test.rb +69 -0
- data/test/functional/host_collection/add_host_test.rb +36 -3
- data/test/functional/host_collection/copy_test.rb +4 -4
- data/test/functional/host_collection/delete_test.rb +3 -3
- data/test/functional/host_collection/hosts_test.rb +1 -2
- data/test/functional/host_collection/info_test.rb +3 -3
- data/test/functional/host_collection/remove_host_test.rb +36 -3
- data/test/functional/host_collection/update_test.rb +3 -3
- data/test/functional/hostgroup/create_test.rb +46 -1
- data/test/functional/hostgroup/data/hostgroup.json +48 -46
- data/test/functional/hostgroup/info_test.rb +5 -3
- data/test/functional/hostgroup/update_test.rb +48 -1
- data/test/functional/lifecycle_environment/create_test.rb +1 -1
- data/test/functional/package/list_test.rb +1 -1
- data/test/functional/product/product_helpers.rb +6 -4
- data/test/functional/repository/upload_test.rb +32 -14
- data/test/functional/sync_plan/info_test.rb +37 -0
- data/test/functional/sync_plan/list_test.rb +31 -0
- metadata +21 -18
@@ -1,6 +1,5 @@
|
|
1
1
|
require_relative '../test_helper'
|
2
2
|
require 'hammer_cli_foreman/hostgroup'
|
3
|
-
|
4
3
|
module HammerCLIForeman
|
5
4
|
describe Hostgroup do
|
6
5
|
# These tests are only for the extensions Katello adds to the hostgroup command
|
@@ -13,6 +12,24 @@ module HammerCLIForeman
|
|
13
12
|
run_cmd(%w(hostgroup update --id 1 --content-source-id 1))
|
14
13
|
end
|
15
14
|
|
15
|
+
it 'allows content source name' do
|
16
|
+
content_source_name = "life_of_cs"
|
17
|
+
content_source_id = 111
|
18
|
+
hg_id = 441
|
19
|
+
|
20
|
+
api_expects(:smart_proxies, :index).
|
21
|
+
with_params(:search => "name = \"#{content_source_name}\"").
|
22
|
+
returns(index_response([{'id' => content_source_id}]))
|
23
|
+
|
24
|
+
api_expects(:hostgroups, :update).
|
25
|
+
with_params('id' => hg_id.to_s,
|
26
|
+
'hostgroup' => {'content_source_id' => content_source_id
|
27
|
+
})
|
28
|
+
|
29
|
+
cmd = "hostgroup update --id #{hg_id} --content-source #{content_source_name}"
|
30
|
+
run_cmd(cmd.split)
|
31
|
+
end
|
32
|
+
|
16
33
|
it 'allows content view id' do
|
17
34
|
api_expects(:hostgroups, :update) do |p|
|
18
35
|
p['id'] == '1' && p['hostgroup']['content_view_id'] == 1
|
@@ -68,6 +85,36 @@ module HammerCLIForeman
|
|
68
85
|
result = run_cmd(%w(hostgroup update --id 1 --lifecycle-environment le1))
|
69
86
|
assert_match(/--query-organization/, result.err)
|
70
87
|
end
|
88
|
+
|
89
|
+
it 'allows kickstart repository name' do
|
90
|
+
env_id = 100
|
91
|
+
cv_id = 200
|
92
|
+
repo_name = "life_of_kickstart"
|
93
|
+
repo_id = 111
|
94
|
+
hg_name = "mercury"
|
95
|
+
hg_id = 108
|
96
|
+
|
97
|
+
api_expects(:hostgroups, :index).
|
98
|
+
with_params(:search => "name = \"#{hg_name}\"").
|
99
|
+
returns(index_response([{'id' => hg_id}]))
|
100
|
+
|
101
|
+
api_expects(:repositories, :index).
|
102
|
+
with_params('name' => repo_name,
|
103
|
+
'environment_id' => env_id,
|
104
|
+
'content_view_id' => cv_id).
|
105
|
+
returns(index_response([{'id' => repo_id}]))
|
106
|
+
|
107
|
+
api_expects(:hostgroups, :update).
|
108
|
+
with_params('id' => hg_id,
|
109
|
+
'hostgroup' => {'lifecycle_environment_id' => env_id,
|
110
|
+
'content_view_id' => cv_id,
|
111
|
+
'kickstart_repository_id' => repo_id
|
112
|
+
})
|
113
|
+
|
114
|
+
cmd = "hostgroup update --name #{hg_name} --lifecycle-environment-id #{env_id}"\
|
115
|
+
" --content-view-id #{cv_id} --kickstart-repository #{repo_name}"
|
116
|
+
run_cmd(cmd.split)
|
117
|
+
end
|
71
118
|
end
|
72
119
|
end
|
73
120
|
end
|
@@ -5,7 +5,7 @@ module HammerCLIKatello
|
|
5
5
|
describe LifecycleEnvironmentCommand::CreateCommand do
|
6
6
|
it 'allows minimal options' do
|
7
7
|
api_expects(:lifecycle_environments, :create) do |p|
|
8
|
-
p['name'] == 'le1' && p['prior_id'] ==
|
8
|
+
p['name'] == 'le1' && p['prior_id'] == 3 && p['organization_id'] == 1
|
9
9
|
end
|
10
10
|
|
11
11
|
run_cmd(%w(lifecycle-environment create --name le1 --prior-id 3 --organization-id 1))
|
@@ -83,7 +83,7 @@ module HammerCLIKatello
|
|
83
83
|
.returns(index_response([{'id' => 2}, {'id' => 3}]))
|
84
84
|
|
85
85
|
r = run_cmd(%w(package list --product-id 1))
|
86
|
-
assert(r.err.include?("
|
86
|
+
assert(r.err.include?("Found more than one repository"), "Invalid error message: #{r.err}")
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'requires organization options to resolve ID by name' do
|
@@ -1,9 +1,11 @@
|
|
1
1
|
module ProductHelpers
|
2
|
+
def expect_generic_product_search(params = {}, returns = {})
|
3
|
+
api_expects(:products, :index, 'Find the Product')
|
4
|
+
.with_params(params).returns(index_response([returns]))
|
5
|
+
end
|
6
|
+
|
2
7
|
def expect_product_search(org_id, name, id)
|
3
|
-
|
4
|
-
par['name'] == name && par['organization_id'] == org_id
|
5
|
-
end
|
6
|
-
ex.returns(index_response([{'id' => id}]))
|
8
|
+
expect_generic_product_search({'name' => name, 'organization_id' => org_id}, 'id' => id)
|
7
9
|
end
|
8
10
|
|
9
11
|
def expect_product_show(options = {})
|
@@ -149,13 +149,7 @@ describe 'upload repository' do
|
|
149
149
|
ex.returns(upload_response)
|
150
150
|
|
151
151
|
ex = api_expects(:repositories, :import_uploads, 'Take in an upload') do |par|
|
152
|
-
|
153
|
-
:id => '1234',
|
154
|
-
:name => 'test1.rpm',
|
155
|
-
:size => 0,
|
156
|
-
:checksum => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
157
|
-
}
|
158
|
-
par[:id] == repo_id && par[:uploads] == [upload] && par[:sync_capsule] == false &&
|
152
|
+
par[:id] == repo_id && par[:uploads].one? && par[:sync_capsule] == false &&
|
159
153
|
par[:publish_repository] == false
|
160
154
|
end
|
161
155
|
|
@@ -176,13 +170,7 @@ describe 'upload repository' do
|
|
176
170
|
ex.returns(upload_response)
|
177
171
|
|
178
172
|
ex = api_expects(:repositories, :import_uploads, 'Take in an upload') do |par|
|
179
|
-
|
180
|
-
:id => '1234',
|
181
|
-
:name => 'test2.rpm',
|
182
|
-
:size => 0,
|
183
|
-
:checksum => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
184
|
-
}
|
185
|
-
par[:id] == repo_id && par[:uploads] == [upload] && par[:sync_capsule] == true &&
|
173
|
+
par[:id] == repo_id && par[:uploads].one? && par[:sync_capsule] == true &&
|
186
174
|
par[:publish_repository] == true
|
187
175
|
end
|
188
176
|
|
@@ -208,4 +196,34 @@ describe 'upload repository' do
|
|
208
196
|
assert_equal "Could not find any files matching PATH\n", result.err
|
209
197
|
assert_equal HammerCLI::EX_NOINPUT, result.exit_code
|
210
198
|
end
|
199
|
+
|
200
|
+
describe 'requires' do
|
201
|
+
it 'repository options' do
|
202
|
+
api_expects_no_call
|
203
|
+
error = run_cmd(@cmd + %W(--path #{path})).err
|
204
|
+
assert error.include?('--id, --name is required'), "Actual result: #{error}"
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'product options when repository name is specified' do
|
208
|
+
api_expects_no_call
|
209
|
+
error = run_cmd(@cmd + %W(--name repo1 --path #{path})).err
|
210
|
+
assert(error.include?('--product, --product-id is required'), "Actual result: #{error}")
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'organization options when product name is specified' do
|
214
|
+
api_expects_no_call
|
215
|
+
error = run_cmd(@cmd + %W(--name repo1 --product product2 --path #{path})).err
|
216
|
+
assert(error.include?('--organization-id, --organization, --organization-label is required'),
|
217
|
+
"Actual result: #{error}")
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
describe 'disallows' do
|
222
|
+
it 'product options when repository ID is specified' do
|
223
|
+
api_expects_no_call
|
224
|
+
error = run_cmd(@cmd + %W(--id 1 --product product2 --path #{path})).err
|
225
|
+
assert(error.include?('Cannot specify both product options and repository ID'),
|
226
|
+
"Actual result: #{error}")
|
227
|
+
end
|
228
|
+
end
|
211
229
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require 'hammer_cli_katello/sync_plan'
|
3
|
+
require_relative 'sync_plan_helpers'
|
4
|
+
require_relative '../organization/organization_helpers'
|
5
|
+
module HammerCLIKatello
|
6
|
+
describe SyncPlan::InfoCommand do
|
7
|
+
include OrganizationHelpers
|
8
|
+
include SyncPlanHelpers
|
9
|
+
|
10
|
+
it 'allows ID' do
|
11
|
+
api_expects(:sync_plans, :show).with_params('id' => 1)
|
12
|
+
|
13
|
+
run_cmd(%w(sync-plan info --id 1))
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'allows organization id and sync plan name' do
|
17
|
+
org_id = 1
|
18
|
+
name = "SyncPlan1"
|
19
|
+
id = 100
|
20
|
+
expect_sync_plan_search(org_id, name, id)
|
21
|
+
api_expects(:sync_plans, :show).with_params('id' => id)
|
22
|
+
run_cmd("sync-plan info --organization-id #{org_id} --name #{name}".split)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'allows organization name and sync plan name' do
|
26
|
+
org_id = 1
|
27
|
+
org_label = "org"
|
28
|
+
name = "SyncPlan1"
|
29
|
+
id = 100
|
30
|
+
|
31
|
+
expect_organization_search(org_label, org_id, field: 'label')
|
32
|
+
expect_sync_plan_search(org_id, name, id)
|
33
|
+
api_expects(:sync_plans, :show).with_params('id' => id)
|
34
|
+
run_cmd("sync-plan info --organization-label #{org_label} --name #{name}".split)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require 'hammer_cli_katello/sync_plan'
|
3
|
+
require_relative 'sync_plan_helpers'
|
4
|
+
require_relative '../organization/organization_helpers'
|
5
|
+
|
6
|
+
module HammerCLIKatello
|
7
|
+
describe SyncPlan::ListCommand do
|
8
|
+
include SyncPlanHelpers
|
9
|
+
include OrganizationHelpers
|
10
|
+
|
11
|
+
it 'allows minimal options' do
|
12
|
+
expect_sync_plan_search(1, nil, nil)
|
13
|
+
|
14
|
+
run_cmd(%w(sync-plan list --organization-id 1))
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'allows org name' do
|
18
|
+
expect_organization_search('org1', 1)
|
19
|
+
expect_sync_plan_search(1, nil, nil)
|
20
|
+
|
21
|
+
run_cmd(%w(sync-plan list --organization org1))
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'allows org label' do
|
25
|
+
expect_organization_search('org1', 1, field: 'label')
|
26
|
+
expect_sync_plan_search(1, nil, nil)
|
27
|
+
|
28
|
+
run_cmd(%w(sync-plan list --organization-label org1))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
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: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Price
|
@@ -34,36 +34,22 @@ authors:
|
|
34
34
|
autorequire:
|
35
35
|
bindir: bin
|
36
36
|
cert_chain: []
|
37
|
-
date: 2018-02-
|
37
|
+
date: 2018-02-02 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
|
-
- !ruby/object:Gem::Dependency
|
40
|
-
name: hammer_cli
|
41
|
-
requirement: !ruby/object:Gem::Requirement
|
42
|
-
requirements:
|
43
|
-
- - "~>"
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 0.11.0
|
46
|
-
type: :runtime
|
47
|
-
prerelease: false
|
48
|
-
version_requirements: !ruby/object:Gem::Requirement
|
49
|
-
requirements:
|
50
|
-
- - "~>"
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: 0.11.0
|
53
39
|
- !ruby/object:Gem::Dependency
|
54
40
|
name: hammer_cli_foreman
|
55
41
|
requirement: !ruby/object:Gem::Requirement
|
56
42
|
requirements:
|
57
43
|
- - "~>"
|
58
44
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.
|
45
|
+
version: '0.10'
|
60
46
|
type: :runtime
|
61
47
|
prerelease: false
|
62
48
|
version_requirements: !ruby/object:Gem::Requirement
|
63
49
|
requirements:
|
64
50
|
- - "~>"
|
65
51
|
- !ruby/object:Gem::Version
|
66
|
-
version: 0.
|
52
|
+
version: '0.10'
|
67
53
|
- !ruby/object:Gem::Dependency
|
68
54
|
name: hammer_cli_foreman_tasks
|
69
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,6 +242,7 @@ files:
|
|
256
242
|
- lib/hammer_cli_katello/content_view_version.rb
|
257
243
|
- lib/hammer_cli_katello/erratum.rb
|
258
244
|
- lib/hammer_cli_katello/exception_handler.rb
|
245
|
+
- lib/hammer_cli_katello/file.rb
|
259
246
|
- lib/hammer_cli_katello/filter.rb
|
260
247
|
- lib/hammer_cli_katello/filter_rule.rb
|
261
248
|
- lib/hammer_cli_katello/foreman_search_options_creators.rb
|
@@ -265,8 +252,10 @@ files:
|
|
265
252
|
- lib/hammer_cli_katello/host_collection_erratum.rb
|
266
253
|
- lib/hammer_cli_katello/host_collection_package.rb
|
267
254
|
- lib/hammer_cli_katello/host_collection_package_group.rb
|
255
|
+
- lib/hammer_cli_katello/host_content_source_options.rb
|
268
256
|
- lib/hammer_cli_katello/host_errata.rb
|
269
257
|
- lib/hammer_cli_katello/host_extensions.rb
|
258
|
+
- lib/hammer_cli_katello/host_kickstart_repository_options.rb
|
270
259
|
- lib/hammer_cli_katello/host_package.rb
|
271
260
|
- lib/hammer_cli_katello/host_package_group.rb
|
272
261
|
- lib/hammer_cli_katello/host_subscription.rb
|
@@ -368,6 +357,9 @@ files:
|
|
368
357
|
- test/functional/content_view/version/promote_test.rb
|
369
358
|
- test/functional/content_view/version/republish_repositories_test.rb
|
370
359
|
- test/functional/erratum/list_test.rb
|
360
|
+
- test/functional/file/file_helpers.rb
|
361
|
+
- test/functional/file/info_test.rb
|
362
|
+
- test/functional/file/list_test.rb
|
371
363
|
- test/functional/filter_rule/create_test.rb
|
372
364
|
- test/functional/filter_rule/delete_test.rb
|
373
365
|
- test/functional/filter_rule/filter_rule_helpers.rb
|
@@ -375,10 +367,12 @@ files:
|
|
375
367
|
- test/functional/filter_rule/list_test.rb
|
376
368
|
- test/functional/filter_rule/update_test.rb
|
377
369
|
- test/functional/host/errata/apply_test.rb
|
370
|
+
- test/functional/host/extensions/create_test.rb
|
378
371
|
- test/functional/host/extensions/data/host.json
|
379
372
|
- test/functional/host/extensions/data/host_list.json
|
380
373
|
- test/functional/host/extensions/info_test.rb
|
381
374
|
- test/functional/host/extensions/list_test.rb
|
375
|
+
- test/functional/host/extensions/update_test.rb
|
382
376
|
- test/functional/host/host_helpers.rb
|
383
377
|
- test/functional/host/subscription/attach_test.rb
|
384
378
|
- test/functional/host/subscription/auto_attach_test.rb
|
@@ -431,6 +425,8 @@ files:
|
|
431
425
|
- test/functional/repository/upload_test.rb
|
432
426
|
- test/functional/search_helpers.rb
|
433
427
|
- test/functional/subscription/list_test.rb
|
428
|
+
- test/functional/sync_plan/info_test.rb
|
429
|
+
- test/functional/sync_plan/list_test.rb
|
434
430
|
- test/functional/sync_plan/sync_plan_helpers.rb
|
435
431
|
- test/functional/test_helper.rb
|
436
432
|
- test/task_helper.rb
|
@@ -519,6 +515,9 @@ test_files:
|
|
519
515
|
- test/functional/content_view/version/promote_test.rb
|
520
516
|
- test/functional/content_view/version/republish_repositories_test.rb
|
521
517
|
- test/functional/erratum/list_test.rb
|
518
|
+
- test/functional/file/file_helpers.rb
|
519
|
+
- test/functional/file/info_test.rb
|
520
|
+
- test/functional/file/list_test.rb
|
522
521
|
- test/functional/filter_rule/create_test.rb
|
523
522
|
- test/functional/filter_rule/delete_test.rb
|
524
523
|
- test/functional/filter_rule/filter_rule_helpers.rb
|
@@ -526,10 +525,12 @@ test_files:
|
|
526
525
|
- test/functional/filter_rule/list_test.rb
|
527
526
|
- test/functional/filter_rule/update_test.rb
|
528
527
|
- test/functional/host/errata/apply_test.rb
|
528
|
+
- test/functional/host/extensions/create_test.rb
|
529
529
|
- test/functional/host/extensions/data/host.json
|
530
530
|
- test/functional/host/extensions/data/host_list.json
|
531
531
|
- test/functional/host/extensions/info_test.rb
|
532
532
|
- test/functional/host/extensions/list_test.rb
|
533
|
+
- test/functional/host/extensions/update_test.rb
|
533
534
|
- test/functional/host/host_helpers.rb
|
534
535
|
- test/functional/host/subscription/attach_test.rb
|
535
536
|
- test/functional/host/subscription/auto_attach_test.rb
|
@@ -582,6 +583,8 @@ test_files:
|
|
582
583
|
- test/functional/repository/upload_test.rb
|
583
584
|
- test/functional/search_helpers.rb
|
584
585
|
- test/functional/subscription/list_test.rb
|
586
|
+
- test/functional/sync_plan/info_test.rb
|
587
|
+
- test/functional/sync_plan/list_test.rb
|
585
588
|
- test/functional/sync_plan/sync_plan_helpers.rb
|
586
589
|
- test/functional/test_helper.rb
|
587
590
|
- test/task_helper.rb
|