hammer_cli_katello 1.0.1 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hammer_cli_katello/content_import.rb +16 -1
  3. data/lib/hammer_cli_katello/content_view_version.rb +0 -273
  4. data/lib/hammer_cli_katello/docker.rb +13 -0
  5. data/lib/hammer_cli_katello/docker_manifest.rb +53 -0
  6. data/lib/hammer_cli_katello/docker_tag.rb +40 -0
  7. data/lib/hammer_cli_katello/foreman_search_options_creators.rb +12 -0
  8. data/lib/hammer_cli_katello/host_collection_erratum.rb +10 -0
  9. data/lib/hammer_cli_katello/host_collection_package.rb +30 -0
  10. data/lib/hammer_cli_katello/host_collection_package_group.rb +30 -0
  11. data/lib/hammer_cli_katello/host_errata.rb +8 -0
  12. data/lib/hammer_cli_katello/host_package.rb +32 -0
  13. data/lib/hammer_cli_katello/host_package_group.rb +16 -0
  14. data/lib/hammer_cli_katello/id_resolver.rb +3 -1
  15. data/lib/hammer_cli_katello/organization.rb +10 -0
  16. data/lib/hammer_cli_katello/ping.rb +13 -5
  17. data/lib/hammer_cli_katello/repository.rb +21 -0
  18. data/lib/hammer_cli_katello/simple_content_access.rb +2 -0
  19. data/lib/hammer_cli_katello/version.rb +1 -1
  20. data/lib/hammer_cli_katello.rb +5 -1
  21. data/locale/hammer-cli-katello.pot +0 -25
  22. metadata +7 -419
  23. data/lib/hammer_cli_katello/cv_import_export_helper.rb +0 -187
  24. data/test/data/2.5/foreman_api.json +0 -1
  25. data/test/data/3.0/foreman_api.json +0 -1
  26. data/test/data/3.10/foreman_api.json +0 -1
  27. data/test/data/3.11/foreman_api.json +0 -1
  28. data/test/data/3.12/foreman_api.json +0 -1
  29. data/test/data/3.13/foreman_api.json +0 -1
  30. data/test/data/3.14/foreman_api.json +0 -1
  31. data/test/data/3.15/foreman_api.json +0 -1
  32. data/test/data/3.16/foreman_api.json +0 -1
  33. data/test/data/3.17/foreman_api.json +0 -1
  34. data/test/data/3.18/foreman_api.json +0 -1
  35. data/test/data/3.19/foreman_api.json +0 -1
  36. data/test/data/3.2/foreman_api.json +0 -1
  37. data/test/data/3.4/foreman_api.json +0 -1
  38. data/test/data/3.5/foreman_api.json +0 -1
  39. data/test/data/3.6/foreman_api.json +0 -1
  40. data/test/data/3.7/foreman_api.json +0 -1
  41. data/test/data/3.8/foreman_api.json +0 -1
  42. data/test/data/3.9/foreman_api.json +0 -1
  43. data/test/data/4.0/foreman_api.json +0 -1
  44. data/test/data/Readme.md +0 -5
  45. data/test/functional/activation_key/add_host_collection_test.rb +0 -62
  46. data/test/functional/activation_key/content_override_test.rb +0 -92
  47. data/test/functional/activation_key/create_test.rb +0 -33
  48. data/test/functional/activation_key/data/activation_key.json +0 -17
  49. data/test/functional/activation_key/info_test.rb +0 -29
  50. data/test/functional/activation_key/list_test.rb +0 -68
  51. data/test/functional/activation_key/product_content_test.rb +0 -23
  52. data/test/functional/activation_key/remove_host_collection_test.rb +0 -62
  53. data/test/functional/activation_key/subscriptions_test.rb +0 -71
  54. data/test/functional/activation_key/update_test.rb +0 -26
  55. data/test/functional/apipie_helper_test.rb +0 -31
  56. data/test/functional/capsule/capsule_helpers.rb +0 -13
  57. data/test/functional/capsule/content/add_lifecycle_environment_test.rb +0 -40
  58. data/test/functional/capsule/content/cancel_synchronization_test.rb +0 -42
  59. data/test/functional/capsule/content/capsule_content_helpers.rb +0 -24
  60. data/test/functional/capsule/content/data/library_env.json +0 -47
  61. data/test/functional/capsule/content/data/sync_status.json +0 -6
  62. data/test/functional/capsule/content/data/sync_tasks.json +0 -62
  63. data/test/functional/capsule/content/info_test.rb +0 -61
  64. data/test/functional/capsule/content/lifecycle_environments_test.rb +0 -19
  65. data/test/functional/capsule/content/remove_lifecycle_environment_test.rb +0 -40
  66. data/test/functional/capsule/content/synchronization_status_test.rb +0 -107
  67. data/test/functional/capsule/info_test.rb +0 -25
  68. data/test/functional/capsule/list_test.rb +0 -24
  69. data/test/functional/content_credentials/create_test.rb +0 -32
  70. data/test/functional/content_credentials/data/test_cert.json +0 -43
  71. data/test/functional/content_credentials/info_test.rb +0 -50
  72. data/test/functional/content_credentials/list_test.rb +0 -66
  73. data/test/functional/content_export/complete/library_test.rb +0 -155
  74. data/test/functional/content_export/complete/version_test.rb +0 -217
  75. data/test/functional/content_export/content_export_helpers.rb +0 -26
  76. data/test/functional/content_export/generate_metadata_test.rb +0 -64
  77. data/test/functional/content_export/incremental/library_test.rb +0 -172
  78. data/test/functional/content_export/incremental/version_test.rb +0 -268
  79. data/test/functional/content_export/list_test.rb +0 -64
  80. data/test/functional/content_import/library_test.rb +0 -85
  81. data/test/functional/content_import/metadata.json +0 -1
  82. data/test/functional/content_import/version_test.rb +0 -85
  83. data/test/functional/content_view/add_content_view_version_test.rb +0 -88
  84. data/test/functional/content_view/add_repository_test.rb +0 -21
  85. data/test/functional/content_view/component/add_test.rb +0 -177
  86. data/test/functional/content_view/component/list_test.rb +0 -55
  87. data/test/functional/content_view/component/remove_test.rb +0 -107
  88. data/test/functional/content_view/component/update_test.rb +0 -134
  89. data/test/functional/content_view/content_view_helpers.rb +0 -20
  90. data/test/functional/content_view/copy_test.rb +0 -53
  91. data/test/functional/content_view/create_test.rb +0 -34
  92. data/test/functional/content_view/delete_test.rb +0 -62
  93. data/test/functional/content_view/filter/create_test.rb +0 -57
  94. data/test/functional/content_view/filter/delete_test.rb +0 -90
  95. data/test/functional/content_view/filter/info_test.rb +0 -89
  96. data/test/functional/content_view/filter/list_test.rb +0 -98
  97. data/test/functional/content_view/filter/update_test.rb +0 -91
  98. data/test/functional/content_view/list_test.rb +0 -68
  99. data/test/functional/content_view/publish_test.rb +0 -24
  100. data/test/functional/content_view/purge_test.rb +0 -97
  101. data/test/functional/content_view/remove_content_view_version_test.rb +0 -88
  102. data/test/functional/content_view/remove_test.rb +0 -79
  103. data/test/functional/content_view/update_test.rb +0 -53
  104. data/test/functional/content_view/version/cv_import_export_helper_test.rb +0 -20
  105. data/test/functional/content_view/version/default_export_test.rb +0 -40
  106. data/test/functional/content_view/version/export_test.rb +0 -148
  107. data/test/functional/content_view/version/import_test.rb +0 -346
  108. data/test/functional/content_view/version/incremental_update_test.rb +0 -108
  109. data/test/functional/content_view/version/list_test.rb +0 -44
  110. data/test/functional/content_view/version/promote_test.rb +0 -34
  111. data/test/functional/content_view/version/republish_repositories_test.rb +0 -34
  112. data/test/functional/content_view/version/update_test.rb +0 -48
  113. data/test/functional/erratum/erratum_helpers.rb +0 -91
  114. data/test/functional/erratum/info_test.rb +0 -29
  115. data/test/functional/erratum/list_test.rb +0 -108
  116. data/test/functional/file/file_helpers.rb +0 -13
  117. data/test/functional/file/info_test.rb +0 -162
  118. data/test/functional/file/list_test.rb +0 -112
  119. data/test/functional/filter_rule/create_test.rb +0 -99
  120. data/test/functional/filter_rule/delete_test.rb +0 -104
  121. data/test/functional/filter_rule/filter_rule_helpers.rb +0 -12
  122. data/test/functional/filter_rule/info_test.rb +0 -104
  123. data/test/functional/filter_rule/list_test.rb +0 -91
  124. data/test/functional/filter_rule/update_test.rb +0 -104
  125. data/test/functional/host/errata/apply_test.rb +0 -45
  126. data/test/functional/host/errata/info_test.rb +0 -27
  127. data/test/functional/host/errata/list_test.rb +0 -49
  128. data/test/functional/host/errata/recalculate_test.rb +0 -40
  129. data/test/functional/host/extensions/create_test.rb +0 -95
  130. data/test/functional/host/extensions/data/host.json +0 -320
  131. data/test/functional/host/extensions/data/host_list.json +0 -117
  132. data/test/functional/host/extensions/info_test.rb +0 -35
  133. data/test/functional/host/extensions/list_test.rb +0 -21
  134. data/test/functional/host/extensions/update_test.rb +0 -70
  135. data/test/functional/host/host_helpers.rb +0 -8
  136. data/test/functional/host/subscription/attach_test.rb +0 -54
  137. data/test/functional/host/subscription/auto_attach_test.rb +0 -35
  138. data/test/functional/host/subscription/content_override_test.rb +0 -96
  139. data/test/functional/host/subscription/product_content_test.rb +0 -27
  140. data/test/functional/host/subscription/register_test.rb +0 -53
  141. data/test/functional/host/subscription/remove_test.rb +0 -52
  142. data/test/functional/host/subscription/unregister_test.rb +0 -37
  143. data/test/functional/host/traces/list_test.rb +0 -37
  144. data/test/functional/host/traces/resolve_test.rb +0 -31
  145. data/test/functional/host_collection/add_host_test.rb +0 -90
  146. data/test/functional/host_collection/content_api_expectations.rb +0 -35
  147. data/test/functional/host_collection/content_install_test.rb +0 -62
  148. data/test/functional/host_collection/content_remove_test.rb +0 -37
  149. data/test/functional/host_collection/content_update_test.rb +0 -37
  150. data/test/functional/host_collection/copy_test.rb +0 -64
  151. data/test/functional/host_collection/create_test.rb +0 -43
  152. data/test/functional/host_collection/delete_test.rb +0 -57
  153. data/test/functional/host_collection/hosts_test.rb +0 -39
  154. data/test/functional/host_collection/info_test.rb +0 -57
  155. data/test/functional/host_collection/list_test.rb +0 -63
  156. data/test/functional/host_collection/remove_host_test.rb +0 -90
  157. data/test/functional/host_collection/update_test.rb +0 -57
  158. data/test/functional/hostgroup/create_test.rb +0 -112
  159. data/test/functional/hostgroup/data/hostgroup.json +0 -50
  160. data/test/functional/hostgroup/info_test.rb +0 -33
  161. data/test/functional/hostgroup/update_test.rb +0 -120
  162. data/test/functional/lifecycle_environment/create_test.rb +0 -14
  163. data/test/functional/lifecycle_environment/lifecycle_environment_helpers.rb +0 -18
  164. data/test/functional/lifecycle_environment/list_test.rb +0 -38
  165. data/test/functional/lifecycle_environment/update_test.rb +0 -14
  166. data/test/functional/local_helper_test.rb +0 -30
  167. data/test/functional/module_stream/info_test.rb +0 -58
  168. data/test/functional/module_stream/list_test.rb +0 -53
  169. data/test/functional/organization/delete_test.rb +0 -26
  170. data/test/functional/organization/organization_helpers.rb +0 -10
  171. data/test/functional/package/list_test.rb +0 -158
  172. data/test/functional/package_group/list_test.rb +0 -38
  173. data/test/functional/ping_test.rb +0 -20
  174. data/test/functional/product/create_test.rb +0 -54
  175. data/test/functional/product/delete_test.rb +0 -41
  176. data/test/functional/product/info_test.rb +0 -33
  177. data/test/functional/product/list_test.rb +0 -58
  178. data/test/functional/product/product_helpers.rb +0 -24
  179. data/test/functional/product/remove_sync_plan_test.rb +0 -35
  180. data/test/functional/product/set_sync_plan_test.rb +0 -49
  181. data/test/functional/product/update_proxy.rb +0 -48
  182. data/test/functional/product/update_test.rb +0 -46
  183. data/test/functional/repository/create_test.rb +0 -21
  184. data/test/functional/repository/delete_test.rb +0 -95
  185. data/test/functional/repository/export_test.rb +0 -121
  186. data/test/functional/repository/info_test.rb +0 -156
  187. data/test/functional/repository/list_test.rb +0 -68
  188. data/test/functional/repository/remove_content_test.rb +0 -108
  189. data/test/functional/repository/repository_helpers.rb +0 -18
  190. data/test/functional/repository/synchronize_test.rb +0 -57
  191. data/test/functional/repository/update_test.rb +0 -149
  192. data/test/functional/repository/upload_test.rb +0 -345
  193. data/test/functional/repository_set/available_repositories_test.rb +0 -18
  194. data/test/functional/repository_set/disable_test.rb +0 -42
  195. data/test/functional/repository_set/enable_test.rb +0 -42
  196. data/test/functional/repository_set/info_test.rb +0 -17
  197. data/test/functional/repository_set/list_test.rb +0 -18
  198. data/test/functional/repository_set/repository_set_helpers.rb +0 -20
  199. data/test/functional/search_helpers.rb +0 -17
  200. data/test/functional/simple_content_access/disable_test.rb +0 -48
  201. data/test/functional/simple_content_access/enable_test.rb +0 -46
  202. data/test/functional/srpm/list_test.rb +0 -92
  203. data/test/functional/subscription/list_test.rb +0 -86
  204. data/test/functional/sync_plan/create_test.rb +0 -60
  205. data/test/functional/sync_plan/delete_test.rb +0 -46
  206. data/test/functional/sync_plan/info_test.rb +0 -37
  207. data/test/functional/sync_plan/list_test.rb +0 -31
  208. data/test/functional/sync_plan/sync_plan_helpers.rb +0 -8
  209. data/test/functional/sync_plan/update_test.rb +0 -44
  210. data/test/functional/test_helper.rb +0 -24
  211. data/test/task_helper.rb +0 -7
  212. data/test/test_helper.rb +0 -38
  213. data/test/unit/id_name_options_validator_test.rb +0 -96
  214. data/test/unit/id_resolver_test.rb +0 -58
  215. data/test/unit/messages_test.rb +0 -7
  216. data/test/unit/search_options_creators_test.rb +0 -145
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 186183bd2337627828ad27578924b491161632034de3f51b2896a02312b68519
4
- data.tar.gz: 903b7f9c68fdfcd7538739a1f98aa896e18924806f69d37576a85f935315f7e1
3
+ metadata.gz: 2d5fafd24b632ade65c6e11166ef3e01c7da7cd29c68fd5930a074c0abee1d18
4
+ data.tar.gz: fb8a68f817c2bb3f6bb693b7b5ed2b9b5bb482c9fe7590afc3a6420a4c7dafac
5
5
  SHA512:
6
- metadata.gz: ae67f54e90820899048b453b5c6592d0e7ac36ee562d798c74c82365c82de577c158640259eeb222cfb9e5f8ab5e880fd1ce36dcba56eed3f67dadaf2430eef7
7
- data.tar.gz: aae484692b57eb9405e01b2b2f6e01b8254e7903b53fdbe919e829366e0f28ab46e5184e61111fa637655d029cd000197639a1e5919cc5bc59c041ad93108eb0
6
+ metadata.gz: eaafa419371c904704b7ee5b9c776e829d35ad6560d55cc7fa118c5a076dda9617321e2838a1608dfd14067c8a6ea1aecd91d61e4cd2d0e1b5a04841322f8dd1
7
+ data.tar.gz: 31ac0a523c9d27c1e84de086dfc79e2868d05a235065b513a4797539f485a988f96c2cbc829192fcb0733f0f3241e9460311ebc1cb50eb84b7b1019cb339ceb5
@@ -13,7 +13,7 @@ module HammerCLIKatello
13
13
  :required => false
14
14
 
15
15
  base.build_options do |o|
16
- o.expand(:all).including(:content_views, :organizations).except(:metadata)
16
+ o.expand(:all).including(:organizations).except(:metadata)
17
17
  end
18
18
 
19
19
  base.validate_options do
@@ -58,6 +58,21 @@ module HammerCLIKatello
58
58
  include ContentImportCommon
59
59
  end
60
60
 
61
+ class ListCommand < HammerCLIKatello::ListCommand
62
+ desc "View content view import histories"
63
+ output do
64
+ field :id, _('ID')
65
+ field :path, _('Path')
66
+ field :type, _('Type')
67
+ field :content_view_version, _('Content View Version')
68
+ field :content_view_version_id, _('Content View Version ID')
69
+ field :created_at, _('Created at')
70
+ field :updated_at, _('Updated at'), Fields::Field, :hide_blank => true
71
+ end
72
+
73
+ build_options
74
+ end
75
+
61
76
  autoload_subcommands
62
77
  end
63
78
  end
@@ -271,279 +271,6 @@ module HammerCLIKatello
271
271
  end
272
272
  end
273
273
 
274
- class ExportDefaultCommand < HammerCLIForeman::Command
275
- include HammerCLIKatello::LocalHelper
276
- include HammerCLIKatello::ApipieHelper
277
- include HammerCLIKatello::CVImportExportHelper
278
-
279
- PUBLISHED_REPOS_DIR = "/var/lib/pulp/published/yum/https/repos/".freeze
280
-
281
- desc _('Export the library default content view')
282
-
283
- command_name "export-default"
284
-
285
- option '--export-dir', 'EXPORT_DIR', _("Directory to put content view version export into.")
286
-
287
- validate_options do
288
- option(:option_export_dir).required
289
- end
290
-
291
- build_options
292
-
293
- def execute
294
- validate_pulp3_not_enabled(fail_msg_export)
295
- export_dir = options['option_export_dir']
296
-
297
- Dir.mkdir(export_dir) unless Dir.exist?(export_dir)
298
- result = Kernel.system("rsync -aL #{PUBLISHED_REPOS_DIR} #{export_dir}")
299
- if result == true
300
- output.print_message _("Default content view export is available at #{export_dir}")
301
- HammerCLI::EX_OK
302
- else
303
- output.print_error _("Could not export the default content view at #{export_dir}")
304
- HammerCLI::EX_CANTCREAT
305
- end
306
- end
307
- end
308
-
309
- class LegacyExportCommand < HammerCLIKatello::SingleResourceCommand
310
- include HammerCLIForemanTasks::Async
311
- include LifecycleEnvironmentNameMapping
312
- include HammerCLIKatello::CVImportExportHelper
313
- desc _('Export a content view (legacy method)')
314
-
315
- action :export
316
- command_name "export-legacy"
317
-
318
- success_message _("Content view is being exported in task %{id}.")
319
- failure_message _("Could not export the content view")
320
- build_options do |o|
321
- o.expand(:all).including(:environments, :content_views, :organizations)
322
- end
323
-
324
- extend_with(HammerCLIKatello::CommandExtensions::LifecycleEnvironment.new)
325
-
326
- def request_params
327
- validate_pulp3_not_enabled(fail_msg_export)
328
- super
329
- end
330
- end
331
-
332
- class ExportCommand < HammerCLIForeman::Command
333
- include HammerCLIKatello::LocalHelper
334
- include HammerCLIKatello::ApipieHelper
335
- include HammerCLIKatello::CVImportExportHelper
336
-
337
- PUBLISHED_REPOS_DIR = "/var/lib/pulp/published/yum/https/repos/".freeze
338
-
339
- desc _('Export a content view version')
340
-
341
- command_name "export"
342
-
343
- success_message _("Content view export is available in %{directory}.")
344
- failure_message _("Could not export the content view")
345
-
346
- option "--id", "ID", _("Content View Version numeric identifier")
347
- option '--export-dir', 'EXPORT_DIR', _("Directory to put content view version export into.")
348
-
349
- validate_options do
350
- option(:option_export_dir).required
351
- option(:option_id).required
352
- end
353
-
354
- build_options
355
-
356
- def execute
357
- cvv = show(:content_view_versions, 'id' => options['option_id'])
358
- cv = show(:content_views, 'id' => cvv['content_view_id'])
359
-
360
- validate_pulp3_not_enabled(fail_msg_export)
361
-
362
- composite = cv["composite"]
363
-
364
- export_json_options = { :cvv => cvv }
365
-
366
- if composite
367
- components = cv['components']
368
- export_json_options[:component_cvvs] = components.collect do |component|
369
- component['name']
370
- end
371
- export_json_options[:repositories] = []
372
- else
373
- repositories = fetch_exportable_cvv_repositories(cvv)
374
- collect_packages(repositories)
375
-
376
- export_json_options[:repositories] = repositories
377
- end
378
-
379
- json = export_json(export_json_options)
380
- if repositories&.any? || cv['composite']
381
- create_tar(cv, cvv, repositories, json)
382
- else
383
- msg = <<~MSG
384
- Ensure the content view version '#{cvv['name']}' has at least one repository.
385
- MSG
386
- raise _(msg)
387
- end
388
- return HammerCLI::EX_OK
389
- end
390
-
391
- def create_tar(cv, cvv, repositories, json)
392
- export_prefix = "export-#{cv['label']}-#{cvv['major']}.#{cvv['minor']}"
393
- export_file = "#{export_prefix}.json"
394
- export_repos_tar = "#{export_prefix}-repos.tar"
395
- export_tar = "#{export_prefix}.tar"
396
- export_dir = File.expand_path(options['option_export_dir'].to_s)
397
-
398
- Dir.mkdir("#{export_dir}/#{export_prefix}")
399
-
400
- if repositories&.any?
401
-
402
- Dir.chdir(PUBLISHED_REPOS_DIR) do
403
- repo_tar = "#{export_dir}/#{export_prefix}/#{export_repos_tar}"
404
- repo_dirs = []
405
-
406
- repositories.each do |repo|
407
- repo_dirs.push(repo['relative_path'])
408
- end
409
-
410
- `tar cvfh #{repo_tar} #{repo_dirs.join(" ")}`
411
- end
412
- end
413
-
414
- Dir.chdir("#{export_dir}/#{export_prefix}") do
415
- File.open(export_file, 'w') do |file|
416
- file.write(JSON.pretty_generate(json))
417
- end
418
- end
419
-
420
- Dir.chdir(export_dir) do
421
- `tar cf #{export_tar} #{export_prefix}`
422
- FileUtils.rm_rf(export_prefix)
423
- end
424
- end
425
- end
426
-
427
- class ImportCommand < HammerCLIForeman::Command
428
- include HammerCLIForemanTasks::Async
429
- include HammerCLIKatello::LocalHelper
430
- include HammerCLIKatello::ApipieHelper
431
- include HammerCLIKatello::CVImportExportHelper
432
-
433
- attr_accessor :export_tar_dir, :export_tar_file, :export_tar_prefix
434
-
435
- desc _('Import a content view version')
436
-
437
- command_name "import"
438
-
439
- success_message _("Content view imported.")
440
- failure_message _("Could not import the content view")
441
-
442
- option "--organization-id", "ORGANIZATION_ID", _("Organization numeric identifier")
443
- option(
444
- '--export-tar', 'EXPORT_TAR',
445
- _("Location of export tar on disk")
446
- )
447
-
448
- validate_options do
449
- option(:option_export_tar).required
450
- option(:option_organization_id).required
451
- end
452
-
453
- build_options
454
-
455
- # rubocop:disable Metrics/AbcSize
456
- def execute
457
- validate_pulp3_not_enabled(fail_msg_import)
458
-
459
- unless File.exist?(options['option_export_tar'])
460
- raise _("Export tar #{options['option_export_tar']} does not exist.")
461
- end
462
-
463
- import_tar_params = obtain_export_params(options['option_export_tar'])
464
- untar_export(import_tar_params)
465
-
466
- export_json = read_json(import_tar_params)
467
- cv = content_view(export_json['name'], options['option_organization_id'])
468
- major = export_json['major'].to_s
469
- minor = export_json['minor'].to_s
470
- import_checks(export_json, cv, major, minor)
471
-
472
- if export_json['composite_components']
473
- composite_version_ids = export_json['composite_components'].map do |component|
474
- find_local_component_id(component)
475
- end
476
- update(:content_views, 'id' => cv['id'], 'component_ids' => composite_version_ids)
477
- publish(cv['id'], export_json['major'], export_json['minor'])
478
- else
479
- sync_repositories(export_json['repositories'], options['option_organization_id'],
480
- import_tar_params)
481
-
482
- unless cv['default']
483
- publish(
484
- cv['id'], export_json['major'],
485
- export_json['minor'], repos_units(export_json['repositories'])
486
- )
487
- end
488
- end
489
- return HammerCLI::EX_OK
490
- end
491
- # rubocop:enable Metrics/AbcSize
492
-
493
- def sync_repositories(repositories, organization_id, options)
494
- export_tar_dir = options[:dirname]
495
- export_tar_prefix = options[:prefix]
496
-
497
- repositories.each do |repo|
498
- library_repos = index(
499
- :repositories,
500
- 'organization_id' => organization_id,
501
- 'library' => true,
502
- 'label' => repo['label']
503
- )
504
-
505
- library_repo = library_repos.select do |candidate_repo|
506
- candidate_repo['label'] == repo['label']
507
- end
508
-
509
- library_repo = library_repo.first
510
-
511
- if library_repo.nil?
512
- msg = _("Unable to sync repositories, no library repository found for %s")
513
- raise msg % repo['label']
514
- end
515
-
516
- synchronize(
517
- library_repo['id'],
518
- "file://#{export_tar_dir}/#{export_tar_prefix}/#{repo['relative_path']}"
519
- )
520
- end
521
- end
522
-
523
- def repos_units(repositories)
524
- repositories.collect do |repo|
525
- {
526
- 'label' => repo['label'],
527
- 'rpm_filenames' => repo['rpm_filenames']
528
- }
529
- end
530
- end
531
-
532
- def content_view(name, organization_id)
533
- index(:content_views, 'name' => name, 'organization_id' => organization_id).first
534
- end
535
-
536
- def synchronize(id, source_url)
537
- task_progress(call(:sync, :repositories, 'id' => id, 'source_url' => source_url))
538
- end
539
-
540
- def publish(id, major, minor, repos_units = nil)
541
- params = {'id' => id, 'major' => major, 'minor' => minor }
542
- params['repos_units'] = repos_units if repos_units
543
- task_progress(call(:publish, :content_views, params))
544
- end
545
- end
546
-
547
274
  autoload_subcommands
548
275
  end
549
276
  end
@@ -0,0 +1,13 @@
1
+ module HammerCLIKatello
2
+ class DockerCommand < HammerCLI::AbstractCommand
3
+ require 'hammer_cli_katello/docker_manifest'
4
+ subcommand 'manifest',
5
+ HammerCLIKatello::DockerManifestCommand.desc,
6
+ HammerCLIKatello::DockerManifestCommand
7
+
8
+ require 'hammer_cli_katello/docker_tag'
9
+ subcommand 'tag',
10
+ HammerCLIKatello::DockerTagCommand.desc,
11
+ HammerCLIKatello::DockerTagCommand
12
+ end
13
+ end
@@ -0,0 +1,53 @@
1
+ module HammerCLIKatello
2
+ class DockerManifestCommand < HammerCLIForeman::Command
3
+ resource :docker_manifests
4
+ command_name 'manifest'
5
+ desc _('Manage docker manifests')
6
+
7
+ class ListCommand < HammerCLIKatello::ListCommand
8
+ include HammerCLIKatello::LifecycleEnvironmentNameMapping
9
+
10
+ output do
11
+ field :id, _("ID")
12
+ field :name, _("Name")
13
+ field :schema_version, _("Schema Version")
14
+ field :digest, _("Digest")
15
+ field :downloaded, _("Downloaded"), Fields::Boolean
16
+ field :_tags, _("Tags")
17
+ end
18
+
19
+ def extend_data(manifest)
20
+ manifest['_tags'] = manifest['tags'].map { |e| e["name"] }.join(", ")
21
+ manifest
22
+ end
23
+
24
+ build_options do |o|
25
+ o.expand.including(:products, :organizations, :content_views)
26
+ end
27
+
28
+ extend_with(HammerCLIKatello::CommandExtensions::LifecycleEnvironment.new)
29
+ end
30
+
31
+ class InfoCommand < HammerCLIKatello::InfoCommand
32
+ output do
33
+ field :id, _("ID")
34
+ field :name, _("Name")
35
+ field :schema_version, _("Schema Version")
36
+ field :digest, _("Digest")
37
+ field :downloaded, _("Downloaded"), Fields::Boolean
38
+ collection :tags, _("Tags") do
39
+ field :name, _("Name")
40
+ end
41
+ end
42
+
43
+ def extend_data(manifest)
44
+ manifest['_tags'] = manifest['tags'].map { |e| { name: e["name"] } }.join(", ")
45
+ manifest
46
+ end
47
+
48
+ build_options
49
+ end
50
+
51
+ autoload_subcommands
52
+ end
53
+ end
@@ -0,0 +1,40 @@
1
+ module HammerCLIKatello
2
+ class DockerTagCommand < HammerCLIForeman::Command
3
+ resource :docker_tags
4
+ command_name 'tag'
5
+ desc _('Manage docker tags')
6
+
7
+ class ListCommand < HammerCLIKatello::ListCommand
8
+ include HammerCLIKatello::LifecycleEnvironmentNameMapping
9
+
10
+ output do
11
+ field :id, _("ID")
12
+ field :name, _("Tag")
13
+ field :repository_id, _("Repository ID")
14
+ end
15
+
16
+ build_options do |o|
17
+ o.expand.including(:products, :organizations, :content_views)
18
+ end
19
+
20
+ extend_with(HammerCLIKatello::CommandExtensions::LifecycleEnvironment.new)
21
+ end
22
+
23
+ class InfoCommand < HammerCLIKatello::InfoCommand
24
+ output do
25
+ field :id, _("ID")
26
+ field :name, _("Tag")
27
+ field :repository_id, _("Repository ID")
28
+
29
+ from :manifest do
30
+ field :id, _("Docker Manifest ID")
31
+ field :name, _("Docker Manifest Name")
32
+ end
33
+ end
34
+
35
+ build_options
36
+ end
37
+
38
+ autoload_subcommands
39
+ end
40
+ end
@@ -48,6 +48,18 @@ module HammerCLIKatello
48
48
  create_search_options_without_katello_api(options, api.resource(:ptables), mode)
49
49
  end
50
50
 
51
+ def create_puppet_ca_proxies_search_options(options, mode = nil)
52
+ create_search_options_without_katello_api(options, api.resource(:puppet_ca_proxies), mode)
53
+ end
54
+
55
+ def create_puppet_proxies_search_options(options, mode = nil)
56
+ create_search_options_without_katello_api(options, api.resource(:puppet_proxies), mode)
57
+ end
58
+
59
+ def create_puppetclasses_search_options(options, mode = nil)
60
+ create_search_options_without_katello_api(options, api.resource(:puppetclasses), mode)
61
+ end
62
+
51
63
  def create_subnets_search_options(options, mode = nil)
52
64
  create_search_options_without_katello_api(options, api.resource(:subnets), mode)
53
65
  end
@@ -15,6 +15,16 @@ module HammerCLIKatello
15
15
  :format => HammerCLI::Options::Normalizers::List.new,
16
16
  :attribute_name => :content)
17
17
 
18
+ def execute
19
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
20
+ "in a future release."
21
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
22
+ "katello_errata_install`. Specify the host collection with the --search-query " \
23
+ "parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
24
+ "`--search-query \"host_collection_id=6\"`."
25
+ super
26
+ end
27
+
18
28
  def content_type
19
29
  'errata'
20
30
  end
@@ -23,6 +23,16 @@ module HammerCLIKatello
23
23
  desc _("Install packages on content hosts contained within a host collection")
24
24
  success_message _("Successfully scheduled installation of package(s).")
25
25
  failure_message _("Could not schedule installation of package(s)")
26
+
27
+ def execute
28
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
29
+ "in a future release."
30
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
31
+ "katello_package_install`. Specify the host collection with the --search-query " \
32
+ "parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
33
+ "`--search-query \"host_collection_id=6\"`."
34
+ super
35
+ end
26
36
  end
27
37
 
28
38
  class UpdateCommand < HammerCLIKatello::HostCollection::UpdateContentBaseCommand
@@ -30,6 +40,16 @@ module HammerCLIKatello
30
40
  desc _("Update packages on content hosts contained within a host collection")
31
41
  success_message _("Successfully scheduled update of package(s).")
32
42
  failure_message _("Could not schedule update of package(s)")
43
+
44
+ def execute
45
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
46
+ "in a future release."
47
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
48
+ "katello_package_update`. Specify the host collection with the --search-query " \
49
+ "parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
50
+ "`--search-query \"host_collection_id=6\"`."
51
+ super
52
+ end
33
53
  end
34
54
 
35
55
  class RemoveCommand < HammerCLIKatello::HostCollection::RemoveContentBaseCommand
@@ -37,6 +57,16 @@ module HammerCLIKatello
37
57
  desc _("Remove packages on content hosts contained within a host collection")
38
58
  success_message _("Successfully scheduled removal of package(s).")
39
59
  failure_message _("Could not schedule removal of package(s)")
60
+
61
+ def execute
62
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
63
+ "in a future release."
64
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
65
+ "katello_package_remove`. Specify the host collection with the --search-query " \
66
+ "parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
67
+ "`--search-query \"host_collection_id=6\"`."
68
+ super
69
+ end
40
70
  end
41
71
 
42
72
  autoload_subcommands
@@ -23,6 +23,16 @@ module HammerCLIKatello
23
23
  desc _("Install package-groups on content hosts contained within a host collection")
24
24
  success_message _("Successfully scheduled installation of package-group(s).")
25
25
  failure_message _("Could not schedule installation of package-group(s)")
26
+
27
+ def execute
28
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
29
+ "in a future release."
30
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
31
+ "katello_group_install`. Specify the host collection with the --search-query " \
32
+ "parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
33
+ "`--search-query \"host_collection_id=6\"`."
34
+ super
35
+ end
26
36
  end
27
37
 
28
38
  class UpdateCommand < HammerCLIKatello::HostCollection::UpdateContentBaseCommand
@@ -30,6 +40,16 @@ module HammerCLIKatello
30
40
  desc _("Update package-groups on content hosts contained within a host collection")
31
41
  success_message _("Successfully scheduled update of package-groups(s).")
32
42
  failure_message _("Could not schedule update of package-group(s)")
43
+
44
+ def execute
45
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
46
+ "in a future release."
47
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
48
+ "katello_group_update`. Specify the host collection with the --search-query " \
49
+ "parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
50
+ "`--search-query \"host_collection_id=6\"`."
51
+ super
52
+ end
33
53
  end
34
54
 
35
55
  class RemoveCommand < HammerCLIKatello::HostCollection::RemoveContentBaseCommand
@@ -37,6 +57,16 @@ module HammerCLIKatello
37
57
  desc _("Remove package-groups on content hosts contained within a host collection")
38
58
  success_message _("Successfully scheduled removal of package-groups(s).")
39
59
  failure_message _("Could not schedule removal of package-group(s)")
60
+
61
+ def execute
62
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
63
+ "in a future release."
64
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
65
+ "katello_group_remove`. Specify the host collection with the --search-query " \
66
+ "parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
67
+ "`--search-query \"host_collection_id=6\"`."
68
+ super
69
+ end
40
70
  end
41
71
 
42
72
  autoload_subcommands
@@ -12,6 +12,14 @@ module HammerCLIKatello
12
12
  failure_message _("Could not apply errata")
13
13
 
14
14
  build_options
15
+
16
+ def execute
17
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
18
+ "in a future release."
19
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
20
+ "katello_errata_install`."
21
+ super
22
+ end
15
23
  end
16
24
 
17
25
  class ListCommand < HammerCLIKatello::ListCommand
@@ -24,6 +24,14 @@ module HammerCLIKatello
24
24
  end
25
25
 
26
26
  build_options :without => [:groups]
27
+
28
+ def execute
29
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
30
+ "in a future release."
31
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
32
+ "katello_package_install`."
33
+ super
34
+ end
27
35
  end
28
36
 
29
37
  class UpgradeCommand < HammerCLIKatello::SingleResourceCommand
@@ -34,6 +42,14 @@ module HammerCLIKatello
34
42
  failure_message "Could not upgrade packages"
35
43
 
36
44
  build_options
45
+
46
+ def execute
47
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
48
+ "in a future release."
49
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
50
+ "katello_package_update`."
51
+ super
52
+ end
37
53
  end
38
54
 
39
55
  class UpgradeAllCommand < HammerCLIKatello::SingleResourceCommand
@@ -44,6 +60,14 @@ module HammerCLIKatello
44
60
  failure_message "Could not upgrade all packages"
45
61
 
46
62
  build_options
63
+
64
+ def execute
65
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
66
+ "in a future release."
67
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
68
+ "katello_package_update`."
69
+ super
70
+ end
47
71
  end
48
72
 
49
73
  class RemoveCommand < HammerCLIKatello::SingleResourceCommand
@@ -58,6 +82,14 @@ module HammerCLIKatello
58
82
  end
59
83
 
60
84
  build_options :without => [:groups]
85
+
86
+ def execute
87
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
88
+ "in a future release."
89
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
90
+ "katello_package_remove`."
91
+ super
92
+ end
61
93
  end
62
94
 
63
95
  autoload_subcommands
@@ -14,6 +14,14 @@ module HammerCLIKatello
14
14
  end
15
15
 
16
16
  build_options :without => [:packages]
17
+
18
+ def execute
19
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
20
+ "in a future release."
21
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
22
+ "katello_group_install`."
23
+ super
24
+ end
17
25
  end
18
26
 
19
27
  class RemoveCommand < HammerCLIKatello::SingleResourceCommand
@@ -28,6 +36,14 @@ module HammerCLIKatello
28
36
  end
29
37
 
30
38
  build_options :without => [:packages]
39
+
40
+ def execute
41
+ warn "This command uses katello agent and will be removed in favor of remote execution " \
42
+ "in a future release."
43
+ warn "The remote execution equivalent is `hammer job-invocation create --feature " \
44
+ "katello_group_remove`."
45
+ super
46
+ end
31
47
  end
32
48
 
33
49
  autoload_subcommands