hammer_cli_katello 1.4.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +5 -5
  2. data/lib/hammer_cli_katello/acs.rb +79 -0
  3. data/lib/hammer_cli_katello/activation_key.rb +8 -2
  4. data/lib/hammer_cli_katello/content_export_complete.rb +8 -0
  5. data/lib/hammer_cli_katello/content_export_helper.rb +55 -3
  6. data/lib/hammer_cli_katello/content_export_incremental.rb +8 -0
  7. data/lib/hammer_cli_katello/content_import.rb +9 -0
  8. data/lib/hammer_cli_katello/host_collection.rb +2 -0
  9. data/lib/hammer_cli_katello/id_resolver.rb +3 -2
  10. data/lib/hammer_cli_katello/organization.rb +15 -0
  11. data/lib/hammer_cli_katello/repository.rb +40 -3
  12. data/lib/hammer_cli_katello/version.rb +1 -1
  13. data/lib/hammer_cli_katello.rb +5 -0
  14. data/test/data/4.4/foreman_api.json +1 -1
  15. data/test/data/4.5/foreman_api.json +1 -0
  16. data/test/data/4.6/foreman_api.json +1 -0
  17. data/test/functional/acs/create_test.rb +27 -0
  18. data/test/functional/acs/delete_test.rb +13 -0
  19. data/test/functional/acs/info_test.rb +55 -0
  20. data/test/functional/acs/list_test.rb +62 -0
  21. data/test/functional/acs/update_test.rb +23 -0
  22. data/test/functional/content_export/complete/repository_test.rb +226 -0
  23. data/test/functional/content_export/content_export_helpers.rb +7 -0
  24. data/test/functional/content_export/incremental/repository_test.rb +212 -0
  25. data/test/functional/module_stream/info_test.rb +2 -2
  26. data/test/functional/organization/cdn_configuration_test.rb +1 -1
  27. data/test/functional/organization/info_test.rb +8 -2
  28. data/test/functional/repository/info_test.rb +4 -10
  29. data/test/functional/repository/republish_test.rb +37 -0
  30. data/test/functional/repository/update_test.rb +1 -0
  31. data/test/functional/repository_set/disable_test.rb +7 -1
  32. data/test/test_helper.rb +1 -1
  33. metadata +45 -23
@@ -34,7 +34,7 @@ describe "get repository info" do
34
34
  'download_policy' => 'immediate',
35
35
  'unprotected' => true,
36
36
  'last_sync_words' => '3 minutes',
37
- 'mirror_on_sync' => true,
37
+ 'mirroring_policy' => 'additive',
38
38
  'relative_path' => 'Default_Organization/Library/Test_Repo',
39
39
  'content_counts' => {
40
40
  'rpm' => 1,
@@ -42,10 +42,6 @@ describe "get repository info" do
42
42
  'package_group' => 0,
43
43
  'erratum' => 1,
44
44
  'module_stream' => 0
45
- },
46
- 'content_credential' => {
47
- 'id' => 1,
48
- 'name' => 'pizza'
49
45
  }
50
46
  )
51
47
  result = run_cmd(@cmd + params)
@@ -57,7 +53,7 @@ describe "get repository info" do
57
53
  ['Organization', 'Default Organization'],
58
54
  ['Red Hat Repository', 'no'],
59
55
  ['Content Type', 'yum'],
60
- ['Mirror on Sync', 'yes'],
56
+ ['Mirroring Policy', 'Additive'],
61
57
  ['Publish Via HTTP', 'yes'],
62
58
  ['Relative Path', 'Default_Organization/Library/Test_Repo'],
63
59
  ['Download Policy', 'immediate'],
@@ -66,8 +62,6 @@ describe "get repository info" do
66
62
  ['Id', '79'],
67
63
  ['Name', 'test'],
68
64
  ['GPG Key', ''],
69
- ['Id', '1'],
70
- ['Name', 'pizza'],
71
65
  ['Sync', ''],
72
66
  ['Status', 'Not Synced'],
73
67
  ['Last Sync Date', '3 minutes'],
@@ -116,7 +110,7 @@ describe "get repository info" do
116
110
  'download_policy' => 'immediate',
117
111
  'unprotected' => true,
118
112
  'last_sync_words' => '3 minutes',
119
- 'mirror_on_sync' => true,
113
+ 'mirroring_policy' => 'mirror_complete',
120
114
  'relative_path' => 'Default_Organization/Library/Test_Repo',
121
115
  'content_counts' => {
122
116
  'rpm' => 1,
@@ -135,7 +129,7 @@ describe "get repository info" do
135
129
  ['Organization', 'Default Organization'],
136
130
  ['Red Hat Repository', 'no'],
137
131
  ['Content Type', 'yum'],
138
- ['Mirror on Sync', 'yes'],
132
+ ['Mirroring Policy', 'Complete Mirroring'],
139
133
  ['Publish Via HTTP', 'yes'],
140
134
  ['Relative Path', 'Default_Organization/Library/Test_Repo'],
141
135
  ['Download Policy', 'immediate'],
@@ -0,0 +1,37 @@
1
+ require File.join(File.dirname(__FILE__), '../test_helper')
2
+ require File.join(File.dirname(__FILE__), './repository_helpers')
3
+ require File.join(File.dirname(__FILE__), '../product/product_helpers')
4
+
5
+ describe 'Republish a repository' do
6
+ include RepositoryHelpers
7
+ include ForemanTaskHelpers
8
+ include ProductHelpers
9
+
10
+ before do
11
+ @cmd = %w(repository republish)
12
+ end
13
+
14
+ let(:repo_id) { 1 }
15
+ let(:sync_response) do
16
+ {
17
+ 'id' => repo_id.to_s,
18
+ 'label' => 'Actions::Katello::Repository::MetadataGenerate',
19
+ 'state' => 'planned'
20
+ }
21
+ end
22
+
23
+ it "republishes a repository" do
24
+ params = ["--id=#{repo_id}", "--force=true"]
25
+
26
+ ex = api_expects(:repositories, :republish, 'Repository republished.') do |par|
27
+ par['id'] == repo_id && par['force'] == true
28
+ end
29
+
30
+ ex.returns(sync_response)
31
+
32
+ expect_foreman_task('3')
33
+
34
+ result = run_cmd(@cmd + params)
35
+ assert_equal(result.exit_code, 0)
36
+ end
37
+ end
@@ -27,6 +27,7 @@ module HammerCLIKatello # rubocop:disable Metrics/ModuleLength
27
27
  }
28
28
  end
29
29
  it "adds a tag to an image" do
30
+ skip "Until we https://projects.theforeman.org/issues/34817 is resolved"
30
31
  ex = api_expects(:content_uploads, :create)
31
32
  .with_params('repository_id' => repo_id, :size => 0)
32
33
 
@@ -32,9 +32,15 @@ module HammerCLIKatello
32
32
  end
33
33
 
34
34
  it 'from product options' do
35
+ repo_id = 1001
36
+ product_id = 3
37
+ api_expects(:repositories, :index, 'Find a repository')
38
+ .with_params('product_id' => product_id)
39
+ .returns(index_response([{'id' => repo_id}]))
40
+
35
41
  expect_repository_set_search('reposet1', 1, product_id: 3)
36
42
  api_expects(:repository_sets, :disable)
37
- .with_params('id' => 1)
43
+ .with_params('id' => 1, 'repository_id' => repo_id)
38
44
  assert_success run_cmd(%w(repository-set disable --name reposet1 --product-id 3))
39
45
  end
40
46
  end
data/test/test_helper.rb CHANGED
@@ -17,7 +17,7 @@ require 'minitest/spec'
17
17
  require 'mocha/minitest'
18
18
  require 'hammer_cli'
19
19
 
20
- KATELLO_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '4.4')
20
+ KATELLO_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '4.6')
21
21
 
22
22
  if HammerCLI.context[:api_connection]
23
23
  HammerCLI.context[:api_connection].create('foreman') do
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.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Price
@@ -35,62 +35,62 @@ authors:
35
35
  autorequire:
36
36
  bindir: bin
37
37
  cert_chain: []
38
- date: 2022-03-03 00:00:00.000000000 Z
38
+ date: 2022-07-06 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: hammer_cli_foreman
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: hammer_cli_foreman_tasks
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - '>='
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - '>='
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: rake
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  type: :development
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - '>='
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: thor
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ">="
86
+ - - '>='
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - '>='
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  - !ruby/object:Gem::Dependency
@@ -111,56 +111,56 @@ dependencies:
111
111
  name: minitest-spec-context
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ">="
114
+ - - '>='
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  type: :development
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - ">="
121
+ - - '>='
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: simplecov
126
126
  requirement: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - ">="
128
+ - - '>='
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  type: :development
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - ">="
135
+ - - '>='
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: mocha
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - ">="
142
+ - - '>='
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - ">="
149
+ - - '>='
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: ci_reporter
154
154
  requirement: !ruby/object:Gem::Requirement
155
155
  requirements:
156
- - - ">="
156
+ - - '>='
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  type: :development
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - ">="
163
+ - - '>='
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  - !ruby/object:Gem::Dependency
@@ -181,14 +181,14 @@ dependencies:
181
181
  name: rubocop-checkstyle_formatter
182
182
  requirement: !ruby/object:Gem::Requirement
183
183
  requirements:
184
- - - ">="
184
+ - - '>='
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  type: :development
188
188
  prerelease: false
189
189
  version_requirements: !ruby/object:Gem::Requirement
190
190
  requirements:
191
- - - ">="
191
+ - - '>='
192
192
  - !ruby/object:Gem::Version
193
193
  version: '0'
194
194
  description: Hammer-CLI-Katello is a plugin for Hammer to provide connectivity to
@@ -201,6 +201,7 @@ extra_rdoc_files: []
201
201
  files:
202
202
  - config/katello.yml
203
203
  - lib/hammer_cli_katello.rb
204
+ - lib/hammer_cli_katello/acs.rb
204
205
  - lib/hammer_cli_katello/activation_key.rb
205
206
  - lib/hammer_cli_katello/apipie_helper.rb
206
207
  - lib/hammer_cli_katello/associating_commands.rb
@@ -319,7 +320,14 @@ files:
319
320
  - test/data/4.1/foreman_api.json
320
321
  - test/data/4.3/foreman_api.json
321
322
  - test/data/4.4/foreman_api.json
323
+ - test/data/4.5/foreman_api.json
324
+ - test/data/4.6/foreman_api.json
322
325
  - test/data/Readme.md
326
+ - test/functional/acs/create_test.rb
327
+ - test/functional/acs/delete_test.rb
328
+ - test/functional/acs/info_test.rb
329
+ - test/functional/acs/list_test.rb
330
+ - test/functional/acs/update_test.rb
323
331
  - test/functional/activation_key/add_host_collection_test.rb
324
332
  - test/functional/activation_key/content_override_test.rb
325
333
  - test/functional/activation_key/create_test.rb
@@ -349,10 +357,12 @@ files:
349
357
  - test/functional/content_credentials/info_test.rb
350
358
  - test/functional/content_credentials/list_test.rb
351
359
  - test/functional/content_export/complete/library_test.rb
360
+ - test/functional/content_export/complete/repository_test.rb
352
361
  - test/functional/content_export/complete/version_test.rb
353
362
  - test/functional/content_export/content_export_helpers.rb
354
363
  - test/functional/content_export/generate_metadata_test.rb
355
364
  - test/functional/content_export/incremental/library_test.rb
365
+ - test/functional/content_export/incremental/repository_test.rb
356
366
  - test/functional/content_export/incremental/version_test.rb
357
367
  - test/functional/content_export/list_test.rb
358
368
  - test/functional/content_import/library_test.rb
@@ -466,6 +476,7 @@ files:
466
476
  - test/functional/repository/reclaim_space_test.rb
467
477
  - test/functional/repository/remove_content_test.rb
468
478
  - test/functional/repository/repository_helpers.rb
479
+ - test/functional/repository/republish_test.rb
469
480
  - test/functional/repository/synchronize_test.rb
470
481
  - test/functional/repository/update_test.rb
471
482
  - test/functional/repository/upload_test.rb
@@ -503,16 +514,17 @@ require_paths:
503
514
  - lib
504
515
  required_ruby_version: !ruby/object:Gem::Requirement
505
516
  requirements:
506
- - - ">="
517
+ - - '>='
507
518
  - !ruby/object:Gem::Version
508
519
  version: '0'
509
520
  required_rubygems_version: !ruby/object:Gem::Requirement
510
521
  requirements:
511
- - - ">="
522
+ - - '>='
512
523
  - !ruby/object:Gem::Version
513
524
  version: '0'
514
525
  requirements: []
515
- rubygems_version: 3.1.6
526
+ rubyforge_project:
527
+ rubygems_version: 2.0.14.1
516
528
  signing_key:
517
529
  specification_version: 4
518
530
  summary: Katello commands for Hammer
@@ -540,7 +552,14 @@ test_files:
540
552
  - test/data/4.1/foreman_api.json
541
553
  - test/data/4.3/foreman_api.json
542
554
  - test/data/4.4/foreman_api.json
555
+ - test/data/4.5/foreman_api.json
556
+ - test/data/4.6/foreman_api.json
543
557
  - test/data/Readme.md
558
+ - test/functional/acs/create_test.rb
559
+ - test/functional/acs/delete_test.rb
560
+ - test/functional/acs/info_test.rb
561
+ - test/functional/acs/list_test.rb
562
+ - test/functional/acs/update_test.rb
544
563
  - test/functional/activation_key/add_host_collection_test.rb
545
564
  - test/functional/activation_key/content_override_test.rb
546
565
  - test/functional/activation_key/create_test.rb
@@ -570,10 +589,12 @@ test_files:
570
589
  - test/functional/content_credentials/info_test.rb
571
590
  - test/functional/content_credentials/list_test.rb
572
591
  - test/functional/content_export/complete/library_test.rb
592
+ - test/functional/content_export/complete/repository_test.rb
573
593
  - test/functional/content_export/complete/version_test.rb
574
594
  - test/functional/content_export/content_export_helpers.rb
575
595
  - test/functional/content_export/generate_metadata_test.rb
576
596
  - test/functional/content_export/incremental/library_test.rb
597
+ - test/functional/content_export/incremental/repository_test.rb
577
598
  - test/functional/content_export/incremental/version_test.rb
578
599
  - test/functional/content_export/list_test.rb
579
600
  - test/functional/content_import/library_test.rb
@@ -687,6 +708,7 @@ test_files:
687
708
  - test/functional/repository/reclaim_space_test.rb
688
709
  - test/functional/repository/remove_content_test.rb
689
710
  - test/functional/repository/repository_helpers.rb
711
+ - test/functional/repository/republish_test.rb
690
712
  - test/functional/repository/synchronize_test.rb
691
713
  - test/functional/repository/update_test.rb
692
714
  - test/functional/repository/upload_test.rb