hammer_cli_katello 0.16.1 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require_relative './repository_set_helpers'
|
3
|
+
require 'hammer_cli_katello/repository_set'
|
4
|
+
|
5
|
+
module HammerCLIKatello
|
6
|
+
describe RepositorySetCommand::EnableCommand do
|
7
|
+
include RepositorySetHelpers
|
8
|
+
|
9
|
+
it 'allows minimal options' do
|
10
|
+
api_expects(:repository_sets, :enable)
|
11
|
+
.with_params('id' => 1)
|
12
|
+
assert_success run_cmd(%w(repository-set enable --id 1))
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'requires repository set options' do
|
16
|
+
api_expects_no_call
|
17
|
+
assert_failure run_cmd(%w(repository-set enable)), /id.*name.*required/
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'resolves repository set ID' do
|
21
|
+
it 'by requiring organization or product options' do
|
22
|
+
api_expects_no_call
|
23
|
+
assert_failure run_cmd(%w(repository-set enable --name reposet1)),
|
24
|
+
/organization.*product.*required/
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'from organization options' do
|
28
|
+
expect_repository_set_search('reposet1', 1, organization_id: 2)
|
29
|
+
api_expects(:repository_sets, :enable)
|
30
|
+
.with_params('id' => 1)
|
31
|
+
assert_success run_cmd(%w(repository-set enable --name reposet1 --organization-id 2))
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'from product options' do
|
35
|
+
expect_repository_set_search('reposet1', 1, product_id: 3)
|
36
|
+
api_expects(:repository_sets, :enable)
|
37
|
+
.with_params('id' => 1)
|
38
|
+
assert_success run_cmd(%w(repository-set enable --name reposet1 --product-id 3))
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require 'hammer_cli_katello/repository_set'
|
3
|
+
|
4
|
+
module HammerCLIKatello
|
5
|
+
describe RepositorySetCommand::InfoCommand do
|
6
|
+
it 'allows minimal options' do
|
7
|
+
api_expects(:repository_sets, :show)
|
8
|
+
.with_params('id' => 1)
|
9
|
+
assert_success run_cmd(%w(repository-set info --id 1))
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'requires repository set options' do
|
13
|
+
api_expects_no_call
|
14
|
+
assert_failure run_cmd(%w(repository-set info)), /id.*name.*required/
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require 'hammer_cli_katello/repository_set'
|
3
|
+
|
4
|
+
module HammerCLIKatello
|
5
|
+
describe RepositorySetCommand::ListCommand do
|
6
|
+
it 'allows minimal options' do
|
7
|
+
api_expects(:repository_sets, :index)
|
8
|
+
.with_params('organization_id' => 1)
|
9
|
+
.returns(index_response([]))
|
10
|
+
assert_success run_cmd(%w(repository-set list --organization-id 1))
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'requires organization options' do
|
14
|
+
api_expects_no_call
|
15
|
+
assert_failure run_cmd(%w(repository-set list)), /organization.*required/
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative '../search_helpers'
|
2
|
+
|
3
|
+
module RepositorySetHelpers
|
4
|
+
include SearchHelpers
|
5
|
+
|
6
|
+
def expect_repository_set_search(name, id, organization_id: nil, product_id: nil)
|
7
|
+
params = {'name' => name}
|
8
|
+
params.merge(organization_id: organization_id) if organization_id.nil?
|
9
|
+
params.merge(product_id: product_id) if product_id.nil?
|
10
|
+
expect_generic_repository_sets_search(
|
11
|
+
params: params,
|
12
|
+
returns: {'id' => id})
|
13
|
+
end
|
14
|
+
|
15
|
+
def expect_generic_repository_sets_search(params: {}, returns: [])
|
16
|
+
api_expects(:repository_sets, :index, 'Find repository sets')
|
17
|
+
.with_params(params)
|
18
|
+
.returns(index_response(returns))
|
19
|
+
end
|
20
|
+
end
|
@@ -9,3 +9,16 @@ include HammerCLI::Testing::OutputMatchers
|
|
9
9
|
include HammerCLI::Testing::CommandAssertions
|
10
10
|
include HammerCLI::Testing::DataHelpers
|
11
11
|
include HammerCLIForeman::Testing::APIExpectations
|
12
|
+
|
13
|
+
def assert_success(command_run_result)
|
14
|
+
assert command_run_result.exit_code.zero?,
|
15
|
+
"Nonzero exit code (#{command_run_result.exit_code}): #{command_run_result.err}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def assert_failure(command_run_result, msg = nil)
|
19
|
+
assert !command_run_result.exit_code.zero?, "Success exit code (0) when expecting failure"
|
20
|
+
if msg
|
21
|
+
assert command_run_result.err[msg],
|
22
|
+
"Actual:\n#{command_run_result.err}\nExpected:\n#{msg.inspect}"
|
23
|
+
end
|
24
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -17,7 +17,7 @@ require 'minitest/spec'
|
|
17
17
|
require 'mocha/setup'
|
18
18
|
require 'hammer_cli'
|
19
19
|
|
20
|
-
KATELLO_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '3.
|
20
|
+
KATELLO_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '3.11')
|
21
21
|
|
22
22
|
if HammerCLI.context[:api_connection]
|
23
23
|
HammerCLI.context[:api_connection].create('foreman') do
|
@@ -6,7 +6,7 @@ module HammerCLIKatello
|
|
6
6
|
before(:each) do
|
7
7
|
@cmd = Object.new
|
8
8
|
@cmd.extend(IdNameOptionsValidator)
|
9
|
-
@cmd.class.send(:define_method, :validate_options) do
|
9
|
+
@cmd.class.send(:define_method, :validate_options) do |*_args, &block|
|
10
10
|
block.call
|
11
11
|
end
|
12
12
|
end
|
@@ -110,6 +110,12 @@ describe HammerCLIKatello::SearchOptionsCreators do
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
describe '#create_compute_profiles_search_options(options, mode = nil)' do
|
114
|
+
it 'does not use the katello api' do
|
115
|
+
search_options_creators.create_compute_profiles_search_options(:anything)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
113
119
|
describe '#create_search_options_with_katello_api(options, resource)' do
|
114
120
|
it 'does not use the katello api' do
|
115
121
|
search_options_creators.create_organizations_search_options(:anything)
|
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.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Price
|
@@ -34,7 +34,7 @@ authors:
|
|
34
34
|
autorequire:
|
35
35
|
bindir: bin
|
36
36
|
cert_chain: []
|
37
|
-
date: 2019-
|
37
|
+
date: 2019-01-22 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: hammer_cli_foreman
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - "~>"
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
45
|
+
version: 0.16.0
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
50
|
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 0.
|
52
|
+
version: 0.16.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: hammer_cli_foreman_tasks
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -243,6 +243,7 @@ files:
|
|
243
243
|
- lib/hammer_cli_katello/content_view_version.rb
|
244
244
|
- lib/hammer_cli_katello/cv_import_export_helper.rb
|
245
245
|
- lib/hammer_cli_katello/erratum.rb
|
246
|
+
- lib/hammer_cli_katello/erratum_info_command.rb
|
246
247
|
- lib/hammer_cli_katello/exception_handler.rb
|
247
248
|
- lib/hammer_cli_katello/file.rb
|
248
249
|
- lib/hammer_cli_katello/filter.rb
|
@@ -310,6 +311,7 @@ files:
|
|
310
311
|
- test/data/2.5/foreman_api.json
|
311
312
|
- test/data/3.0/foreman_api.json
|
312
313
|
- test/data/3.10/foreman_api.json
|
314
|
+
- test/data/3.11/foreman_api.json
|
313
315
|
- test/data/3.2/foreman_api.json
|
314
316
|
- test/data/3.4/foreman_api.json
|
315
317
|
- test/data/3.5/foreman_api.json
|
@@ -369,6 +371,8 @@ files:
|
|
369
371
|
- test/functional/content_view/version/list_test.rb
|
370
372
|
- test/functional/content_view/version/promote_test.rb
|
371
373
|
- test/functional/content_view/version/republish_repositories_test.rb
|
374
|
+
- test/functional/erratum/erratum_helpers.rb
|
375
|
+
- test/functional/erratum/info_test.rb
|
372
376
|
- test/functional/erratum/list_test.rb
|
373
377
|
- test/functional/file/file_helpers.rb
|
374
378
|
- test/functional/file/info_test.rb
|
@@ -380,6 +384,7 @@ files:
|
|
380
384
|
- test/functional/filter_rule/list_test.rb
|
381
385
|
- test/functional/filter_rule/update_test.rb
|
382
386
|
- test/functional/host/errata/apply_test.rb
|
387
|
+
- test/functional/host/errata/info_test.rb
|
383
388
|
- test/functional/host/errata/recalculate_test.rb
|
384
389
|
- test/functional/host/extensions/create_test.rb
|
385
390
|
- test/functional/host/extensions/data/host.json
|
@@ -440,6 +445,12 @@ files:
|
|
440
445
|
- test/functional/repository/synchronize_test.rb
|
441
446
|
- test/functional/repository/update_test.rb
|
442
447
|
- test/functional/repository/upload_test.rb
|
448
|
+
- test/functional/repository_set/available_repositories_test.rb
|
449
|
+
- test/functional/repository_set/disable_test.rb
|
450
|
+
- test/functional/repository_set/enable_test.rb
|
451
|
+
- test/functional/repository_set/info_test.rb
|
452
|
+
- test/functional/repository_set/list_test.rb
|
453
|
+
- test/functional/repository_set/repository_set_helpers.rb
|
443
454
|
- test/functional/search_helpers.rb
|
444
455
|
- test/functional/subscription/list_test.rb
|
445
456
|
- test/functional/sync_plan/create_test.rb
|
@@ -475,7 +486,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
475
486
|
version: '0'
|
476
487
|
requirements: []
|
477
488
|
rubyforge_project:
|
478
|
-
rubygems_version: 2.
|
489
|
+
rubygems_version: 2.6.14
|
479
490
|
signing_key:
|
480
491
|
specification_version: 4
|
481
492
|
summary: Katello commands for Hammer
|
@@ -483,6 +494,7 @@ test_files:
|
|
483
494
|
- test/data/2.5/foreman_api.json
|
484
495
|
- test/data/3.0/foreman_api.json
|
485
496
|
- test/data/3.10/foreman_api.json
|
497
|
+
- test/data/3.11/foreman_api.json
|
486
498
|
- test/data/3.2/foreman_api.json
|
487
499
|
- test/data/3.4/foreman_api.json
|
488
500
|
- test/data/3.5/foreman_api.json
|
@@ -542,6 +554,8 @@ test_files:
|
|
542
554
|
- test/functional/content_view/version/list_test.rb
|
543
555
|
- test/functional/content_view/version/promote_test.rb
|
544
556
|
- test/functional/content_view/version/republish_repositories_test.rb
|
557
|
+
- test/functional/erratum/erratum_helpers.rb
|
558
|
+
- test/functional/erratum/info_test.rb
|
545
559
|
- test/functional/erratum/list_test.rb
|
546
560
|
- test/functional/file/file_helpers.rb
|
547
561
|
- test/functional/file/info_test.rb
|
@@ -553,6 +567,7 @@ test_files:
|
|
553
567
|
- test/functional/filter_rule/list_test.rb
|
554
568
|
- test/functional/filter_rule/update_test.rb
|
555
569
|
- test/functional/host/errata/apply_test.rb
|
570
|
+
- test/functional/host/errata/info_test.rb
|
556
571
|
- test/functional/host/errata/recalculate_test.rb
|
557
572
|
- test/functional/host/extensions/create_test.rb
|
558
573
|
- test/functional/host/extensions/data/host.json
|
@@ -613,6 +628,12 @@ test_files:
|
|
613
628
|
- test/functional/repository/synchronize_test.rb
|
614
629
|
- test/functional/repository/update_test.rb
|
615
630
|
- test/functional/repository/upload_test.rb
|
631
|
+
- test/functional/repository_set/available_repositories_test.rb
|
632
|
+
- test/functional/repository_set/disable_test.rb
|
633
|
+
- test/functional/repository_set/enable_test.rb
|
634
|
+
- test/functional/repository_set/info_test.rb
|
635
|
+
- test/functional/repository_set/list_test.rb
|
636
|
+
- test/functional/repository_set/repository_set_helpers.rb
|
616
637
|
- test/functional/search_helpers.rb
|
617
638
|
- test/functional/subscription/list_test.rb
|
618
639
|
- test/functional/sync_plan/create_test.rb
|