hammer_cli_katello 1.5.0 → 1.6.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.
Files changed (222) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hammer_cli_katello/acs.rb +82 -0
  3. data/lib/hammer_cli_katello/activation_key.rb +8 -2
  4. data/lib/hammer_cli_katello/content_export.rb +39 -0
  5. data/lib/hammer_cli_katello/content_export_helper.rb +64 -6
  6. data/lib/hammer_cli_katello/host_subscription.rb +32 -0
  7. data/lib/hammer_cli_katello/organization.rb +4 -0
  8. data/lib/hammer_cli_katello/repository.rb +1 -1
  9. data/lib/hammer_cli_katello/simple_content_access.rb +10 -0
  10. data/lib/hammer_cli_katello/version.rb +1 -1
  11. data/lib/hammer_cli_katello.rb +5 -0
  12. data/test/data/2.5/foreman_api.json +1 -0
  13. data/test/data/3.0/foreman_api.json +1 -0
  14. data/test/data/3.10/foreman_api.json +1 -0
  15. data/test/data/3.11/foreman_api.json +1 -0
  16. data/test/data/3.12/foreman_api.json +1 -0
  17. data/test/data/3.13/foreman_api.json +1 -0
  18. data/test/data/3.14/foreman_api.json +1 -0
  19. data/test/data/3.15/foreman_api.json +1 -0
  20. data/test/data/3.16/foreman_api.json +1 -0
  21. data/test/data/3.17/foreman_api.json +1 -0
  22. data/test/data/3.18/foreman_api.json +1 -0
  23. data/test/data/3.19/foreman_api.json +1 -0
  24. data/test/data/3.2/foreman_api.json +1 -0
  25. data/test/data/3.4/foreman_api.json +1 -0
  26. data/test/data/3.5/foreman_api.json +1 -0
  27. data/test/data/3.6/foreman_api.json +1 -0
  28. data/test/data/3.7/foreman_api.json +1 -0
  29. data/test/data/3.8/foreman_api.json +1 -0
  30. data/test/data/3.9/foreman_api.json +1 -0
  31. data/test/data/4.0/foreman_api.json +1 -0
  32. data/test/data/4.1/foreman_api.json +1 -0
  33. data/test/data/4.3/foreman_api.json +1 -0
  34. data/test/data/4.4/foreman_api.json +1 -0
  35. data/test/data/4.5/foreman_api.json +1 -0
  36. data/test/data/4.6/foreman_api.json +1 -0
  37. data/test/data/Readme.md +5 -0
  38. data/test/functional/acs/create_test.rb +27 -0
  39. data/test/functional/acs/delete_test.rb +13 -0
  40. data/test/functional/acs/info_test.rb +94 -0
  41. data/test/functional/acs/list_test.rb +62 -0
  42. data/test/functional/acs/update_test.rb +23 -0
  43. data/test/functional/activation_key/add_host_collection_test.rb +62 -0
  44. data/test/functional/activation_key/content_override_test.rb +92 -0
  45. data/test/functional/activation_key/create_test.rb +33 -0
  46. data/test/functional/activation_key/data/activation_key.json +17 -0
  47. data/test/functional/activation_key/info_test.rb +29 -0
  48. data/test/functional/activation_key/list_test.rb +68 -0
  49. data/test/functional/activation_key/product_content_test.rb +23 -0
  50. data/test/functional/activation_key/remove_host_collection_test.rb +62 -0
  51. data/test/functional/activation_key/subscriptions_test.rb +74 -0
  52. data/test/functional/activation_key/update_test.rb +26 -0
  53. data/test/functional/apipie_helper_test.rb +31 -0
  54. data/test/functional/capsule/capsule_helpers.rb +13 -0
  55. data/test/functional/capsule/content/add_lifecycle_environment_test.rb +40 -0
  56. data/test/functional/capsule/content/cancel_synchronization_test.rb +42 -0
  57. data/test/functional/capsule/content/capsule_content_helpers.rb +24 -0
  58. data/test/functional/capsule/content/data/library_env.json +47 -0
  59. data/test/functional/capsule/content/data/sync_status.json +6 -0
  60. data/test/functional/capsule/content/data/sync_tasks.json +62 -0
  61. data/test/functional/capsule/content/info_test.rb +61 -0
  62. data/test/functional/capsule/content/lifecycle_environments_test.rb +19 -0
  63. data/test/functional/capsule/content/remove_lifecycle_environment_test.rb +40 -0
  64. data/test/functional/capsule/content/synchronization_status_test.rb +107 -0
  65. data/test/functional/capsule/info_test.rb +25 -0
  66. data/test/functional/capsule/list_test.rb +24 -0
  67. data/test/functional/content_credentials/create_test.rb +32 -0
  68. data/test/functional/content_credentials/data/test_cert.json +43 -0
  69. data/test/functional/content_credentials/info_test.rb +50 -0
  70. data/test/functional/content_credentials/list_test.rb +66 -0
  71. data/test/functional/content_export/complete/library_test.rb +155 -0
  72. data/test/functional/content_export/complete/repository_test.rb +226 -0
  73. data/test/functional/content_export/complete/version_test.rb +297 -0
  74. data/test/functional/content_export/content_export_helpers.rb +33 -0
  75. data/test/functional/content_export/generate_listing_test.rb +62 -0
  76. data/test/functional/content_export/generate_metadata_test.rb +64 -0
  77. data/test/functional/content_export/incremental/library_test.rb +172 -0
  78. data/test/functional/content_export/incremental/repository_test.rb +212 -0
  79. data/test/functional/content_export/incremental/version_test.rb +268 -0
  80. data/test/functional/content_export/list_test.rb +64 -0
  81. data/test/functional/content_import/library_test.rb +85 -0
  82. data/test/functional/content_import/list_test.rb +65 -0
  83. data/test/functional/content_import/metadata.json +1 -0
  84. data/test/functional/content_import/version_test.rb +85 -0
  85. data/test/functional/content_units/info_test.rb +29 -0
  86. data/test/functional/content_units/list_test.rb +106 -0
  87. data/test/functional/content_view/add_content_view_version_test.rb +88 -0
  88. data/test/functional/content_view/add_repository_test.rb +21 -0
  89. data/test/functional/content_view/component/add_test.rb +177 -0
  90. data/test/functional/content_view/component/list_test.rb +55 -0
  91. data/test/functional/content_view/component/remove_test.rb +107 -0
  92. data/test/functional/content_view/component/update_test.rb +134 -0
  93. data/test/functional/content_view/content_view_helpers.rb +20 -0
  94. data/test/functional/content_view/copy_test.rb +53 -0
  95. data/test/functional/content_view/create_test.rb +34 -0
  96. data/test/functional/content_view/delete_test.rb +62 -0
  97. data/test/functional/content_view/filter/create_test.rb +57 -0
  98. data/test/functional/content_view/filter/delete_test.rb +90 -0
  99. data/test/functional/content_view/filter/info_test.rb +89 -0
  100. data/test/functional/content_view/filter/list_test.rb +98 -0
  101. data/test/functional/content_view/filter/update_test.rb +91 -0
  102. data/test/functional/content_view/list_test.rb +68 -0
  103. data/test/functional/content_view/publish_test.rb +24 -0
  104. data/test/functional/content_view/purge_test.rb +97 -0
  105. data/test/functional/content_view/remove_content_view_version_test.rb +88 -0
  106. data/test/functional/content_view/remove_test.rb +79 -0
  107. data/test/functional/content_view/update_test.rb +53 -0
  108. data/test/functional/content_view/version/incremental_update_test.rb +108 -0
  109. data/test/functional/content_view/version/list_test.rb +44 -0
  110. data/test/functional/content_view/version/promote_test.rb +75 -0
  111. data/test/functional/content_view/version/republish_repositories_test.rb +34 -0
  112. data/test/functional/content_view/version/update_test.rb +48 -0
  113. data/test/functional/erratum/erratum_helpers.rb +91 -0
  114. data/test/functional/erratum/info_test.rb +29 -0
  115. data/test/functional/erratum/list_test.rb +108 -0
  116. data/test/functional/file/file_helpers.rb +13 -0
  117. data/test/functional/file/info_test.rb +162 -0
  118. data/test/functional/file/list_test.rb +112 -0
  119. data/test/functional/filter_rule/create_test.rb +99 -0
  120. data/test/functional/filter_rule/delete_test.rb +104 -0
  121. data/test/functional/filter_rule/filter_rule_helpers.rb +12 -0
  122. data/test/functional/filter_rule/info_test.rb +104 -0
  123. data/test/functional/filter_rule/list_test.rb +91 -0
  124. data/test/functional/filter_rule/update_test.rb +104 -0
  125. data/test/functional/host/errata/apply_test.rb +45 -0
  126. data/test/functional/host/errata/info_test.rb +27 -0
  127. data/test/functional/host/errata/list_test.rb +49 -0
  128. data/test/functional/host/errata/recalculate_test.rb +26 -0
  129. data/test/functional/host/extensions/create_test.rb +95 -0
  130. data/test/functional/host/extensions/data/host.json +320 -0
  131. data/test/functional/host/extensions/data/host_list.json +117 -0
  132. data/test/functional/host/extensions/info_test.rb +35 -0
  133. data/test/functional/host/extensions/list_test.rb +21 -0
  134. data/test/functional/host/extensions/update_test.rb +70 -0
  135. data/test/functional/host/host_helpers.rb +8 -0
  136. data/test/functional/host/subscription/attach_test.rb +54 -0
  137. data/test/functional/host/subscription/auto_attach_test.rb +35 -0
  138. data/test/functional/host/subscription/content_override_test.rb +96 -0
  139. data/test/functional/host/subscription/enabled_repositories_test.rb +39 -0
  140. data/test/functional/host/subscription/product_content_test.rb +27 -0
  141. data/test/functional/host/subscription/register_test.rb +53 -0
  142. data/test/functional/host/subscription/remove_test.rb +52 -0
  143. data/test/functional/host/subscription/unregister_test.rb +37 -0
  144. data/test/functional/host/traces/list_test.rb +37 -0
  145. data/test/functional/host/traces/resolve_test.rb +31 -0
  146. data/test/functional/host_collection/add_host_test.rb +90 -0
  147. data/test/functional/host_collection/content_api_expectations.rb +35 -0
  148. data/test/functional/host_collection/content_install_test.rb +62 -0
  149. data/test/functional/host_collection/content_remove_test.rb +37 -0
  150. data/test/functional/host_collection/content_update_test.rb +37 -0
  151. data/test/functional/host_collection/copy_test.rb +64 -0
  152. data/test/functional/host_collection/create_test.rb +54 -0
  153. data/test/functional/host_collection/delete_test.rb +57 -0
  154. data/test/functional/host_collection/hosts_test.rb +39 -0
  155. data/test/functional/host_collection/info_test.rb +57 -0
  156. data/test/functional/host_collection/list_test.rb +63 -0
  157. data/test/functional/host_collection/remove_host_test.rb +90 -0
  158. data/test/functional/host_collection/update_test.rb +57 -0
  159. data/test/functional/hostgroup/create_test.rb +112 -0
  160. data/test/functional/hostgroup/data/hostgroup.json +50 -0
  161. data/test/functional/hostgroup/info_test.rb +33 -0
  162. data/test/functional/hostgroup/update_test.rb +120 -0
  163. data/test/functional/lifecycle_environment/create_test.rb +14 -0
  164. data/test/functional/lifecycle_environment/lifecycle_environment_helpers.rb +18 -0
  165. data/test/functional/lifecycle_environment/list_test.rb +38 -0
  166. data/test/functional/lifecycle_environment/update_test.rb +14 -0
  167. data/test/functional/local_helper_test.rb +30 -0
  168. data/test/functional/module_stream/info_test.rb +58 -0
  169. data/test/functional/module_stream/list_test.rb +53 -0
  170. data/test/functional/organization/cdn_configuration_test.rb +45 -0
  171. data/test/functional/organization/delete_test.rb +26 -0
  172. data/test/functional/organization/info_test.rb +45 -0
  173. data/test/functional/organization/organization_helpers.rb +10 -0
  174. data/test/functional/package/list_test.rb +160 -0
  175. data/test/functional/package_group/list_test.rb +38 -0
  176. data/test/functional/ping_test.rb +61 -0
  177. data/test/functional/product/create_test.rb +54 -0
  178. data/test/functional/product/delete_test.rb +41 -0
  179. data/test/functional/product/info_test.rb +33 -0
  180. data/test/functional/product/list_test.rb +58 -0
  181. data/test/functional/product/product_helpers.rb +24 -0
  182. data/test/functional/product/remove_sync_plan_test.rb +35 -0
  183. data/test/functional/product/set_sync_plan_test.rb +49 -0
  184. data/test/functional/product/update_proxy.rb +48 -0
  185. data/test/functional/product/update_test.rb +46 -0
  186. data/test/functional/repository/create_test.rb +21 -0
  187. data/test/functional/repository/delete_test.rb +95 -0
  188. data/test/functional/repository/info_test.rb +156 -0
  189. data/test/functional/repository/list_test.rb +68 -0
  190. data/test/functional/repository/reclaim_space_test.rb +105 -0
  191. data/test/functional/repository/remove_content_test.rb +108 -0
  192. data/test/functional/repository/repository_helpers.rb +18 -0
  193. data/test/functional/repository/republish_test.rb +37 -0
  194. data/test/functional/repository/synchronize_test.rb +57 -0
  195. data/test/functional/repository/update_test.rb +150 -0
  196. data/test/functional/repository/upload_test.rb +368 -0
  197. data/test/functional/repository_set/available_repositories_test.rb +18 -0
  198. data/test/functional/repository_set/disable_test.rb +48 -0
  199. data/test/functional/repository_set/enable_test.rb +42 -0
  200. data/test/functional/repository_set/info_test.rb +17 -0
  201. data/test/functional/repository_set/list_test.rb +18 -0
  202. data/test/functional/repository_set/repository_set_helpers.rb +20 -0
  203. data/test/functional/search_helpers.rb +17 -0
  204. data/test/functional/simple_content_access/disable_test.rb +48 -0
  205. data/test/functional/simple_content_access/enable_test.rb +46 -0
  206. data/test/functional/simple_content_access/status_test.rb +29 -0
  207. data/test/functional/srpm/list_test.rb +92 -0
  208. data/test/functional/subscription/list_test.rb +86 -0
  209. data/test/functional/sync_plan/create_test.rb +60 -0
  210. data/test/functional/sync_plan/delete_test.rb +46 -0
  211. data/test/functional/sync_plan/info_test.rb +37 -0
  212. data/test/functional/sync_plan/list_test.rb +31 -0
  213. data/test/functional/sync_plan/sync_plan_helpers.rb +8 -0
  214. data/test/functional/sync_plan/update_test.rb +44 -0
  215. data/test/functional/test_helper.rb +24 -0
  216. data/test/task_helper.rb +7 -0
  217. data/test/test_helper.rb +38 -0
  218. data/test/unit/id_name_options_validator_test.rb +96 -0
  219. data/test/unit/id_resolver_test.rb +58 -0
  220. data/test/unit/messages_test.rb +7 -0
  221. data/test/unit/search_options_creators_test.rb +145 -0
  222. metadata +425 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9402037812c97c98165fb0993f82063bafe1494644ce0e23f2302926e39eab9
4
- data.tar.gz: 30ee3c5a4cecaa4822d3a2ec94630f8f26d22b5d643868fa76bd6d07286c10a9
3
+ metadata.gz: bfa4a96e3ec666332357da5f6741af1fb78360f60e3016060d8e0ba7a41a38c9
4
+ data.tar.gz: 2d6fafe5ea4d85dd1551f9274a57cc6e2c65e3155bbabd844a0f12d964c3e7d3
5
5
  SHA512:
6
- metadata.gz: 38efbc45b82eec60cfd40df5ae30051484aa0e2f1e8eb6877128ed6cef14d8bb801da8cea3704e2a3689b329ca86a89776a0a196226115cf313bd952214bd968
7
- data.tar.gz: 4935236c67fac3f628e434492efcdf70341100d24c491aeb68dfc3aba5ddd5dbee93306d7c23a632e2c389bc0b055f1df59d8efddd28a27d4d44d93e14ce7602
6
+ metadata.gz: e3c4c16ed1e4c64d5126810fef1c723490758c1019e820e7cde65f7b6caa663ada32072aa39dcac2964199c5a2a72b2c36f31e4d85dfc64f8b2c9d203154896b
7
+ data.tar.gz: eeefc161d8fb26803fae890ef79d94c74f1e6ca94d4f0780ba839018890fce56bc5405a932cbeee7edbaa5817bec3de0762d39bc0577ee6e647de673c7c6e5fe
@@ -0,0 +1,82 @@
1
+ module HammerCLIKatello
2
+ class AcsCommand < HammerCLIKatello::Command
3
+ resource :alternate_content_sources
4
+
5
+ class ListCommand < HammerCLIKatello::ListCommand
6
+ output do
7
+ field :id, _('ID')
8
+ field :name, _('Name')
9
+ field :alternate_content_source_type, _('Type')
10
+ end
11
+
12
+ build_options
13
+ end
14
+
15
+ class CreateCommand < HammerCLIKatello::CreateCommand
16
+ success_message _('Alternate Content Source created.')
17
+ failure_message _('Could not create the Alternate Content Source.')
18
+
19
+ build_options
20
+ end
21
+
22
+ class InfoCommand < HammerCLIKatello::InfoCommand
23
+ output do
24
+ field :id, _('ID')
25
+ field :name, _('Name')
26
+ field :label, _('Label')
27
+ field :description, _('Description'), Fields::Field, :hide_blank => true
28
+ field :base_url, _('Base URL')
29
+ field :content_type, _('Content type')
30
+ field :alternate_content_source_type, _('Alternate content source type')
31
+ field :upstream_username, _('Upstream username'), Fields::Field, :hide_blank => true
32
+
33
+ collection :subpaths, _('Subpaths') do
34
+ field nil, _('')
35
+ end
36
+
37
+ collection :products, _('Products') do
38
+ field :id, _('Id')
39
+ field :organization_id, _('Organization ID')
40
+ field :name, _('Name')
41
+ field :label, _('Label')
42
+ end
43
+
44
+ collection :smart_proxies, _('Smart proxies') do
45
+ field :id, _('Id')
46
+ field :name, _('Name')
47
+ field :url, _('URL')
48
+ field :download_policy, _('Download policy')
49
+ end
50
+ end
51
+
52
+ build_options
53
+ end
54
+
55
+ class UpdateCommand < HammerCLIKatello::UpdateCommand
56
+ success_message _('Alternate Content Source updated.')
57
+ failure_message _('Could not update the Alternate Content Source.')
58
+
59
+ build_options
60
+ end
61
+
62
+ class DeleteCommand < HammerCLIKatello::DeleteCommand
63
+ success_message _('Alternate Content Source deleted.')
64
+ failure_message _('Could not delete the Alternate Content Source.')
65
+
66
+ build_options
67
+ end
68
+
69
+ class RefreshCommand < HammerCLIKatello::SingleResourceCommand
70
+ include HammerCLIForemanTasks::Async
71
+
72
+ action :refresh
73
+ command_name 'refresh'
74
+
75
+ success_message _("Alternate content source is being refreshed in task %{id}.")
76
+ failure_message _('Could not refresh the alternate content source')
77
+
78
+ build_options
79
+ end
80
+ autoload_subcommands
81
+ end
82
+ end
@@ -54,10 +54,10 @@ module HammerCLIKatello
54
54
  output do
55
55
  field :name, _("Name")
56
56
  field :id, _("Id")
57
- field :description, _("Description")
57
+ field :description, _("Description"), Fields::Field, :hide_blank => true
58
58
  field :format_limit, _("Host Limit")
59
59
  field :auto_attach, _("Auto Attach")
60
- field :release_version, _("Release Version")
60
+ field :release_version, _("Release Version"), Fields::Field, :hide_blank => true
61
61
 
62
62
  from :environment do
63
63
  field :name, _("Lifecycle Environment")
@@ -71,6 +71,12 @@ module HammerCLIKatello
71
71
  field :name, _("Name")
72
72
  end
73
73
 
74
+ collection :content_overrides, _("Content Overrides") do
75
+ field :content_label, _("Content Label")
76
+ field :name, _("Name")
77
+ field :value, _("Value")
78
+ end
79
+
74
80
  label _("System Purpose") do
75
81
  field :service_level, _('Service Level')
76
82
  field :purpose_usage, _('Purpose Usage')
@@ -44,6 +44,45 @@ module HammerCLIKatello
44
44
  end
45
45
  end
46
46
 
47
+ class GenerateListingCommand < HammerCLIKatello::Command
48
+ desc _("Generates listing file on each directory of a syncable export. This command "\
49
+ + "only needs to be used if the export was performed asynchronously or "\
50
+ + "if the listing files were lost. "\
51
+ + "Assumes the syncable export directory is accessible on disk")
52
+
53
+ command_name 'generate-listing'
54
+
55
+ include ContentExportHelper
56
+
57
+ option "--task-id", "TASK_ID",
58
+ _("Generate listing files for a syncable export task"),
59
+ :attribute_name => :option_task_id,
60
+ :required => false
61
+
62
+ option "--id", "ID",
63
+ _("Generate listing files based on specified export history"),
64
+ :attribute_name => :option_export_id,
65
+ :required => false
66
+
67
+ def execute
68
+ export_history = if option_task_id
69
+ export_task = reload_task(option_task_id)
70
+ fetch_export_history_from_task(export_task)
71
+ else
72
+ fetch_export_history(option_export_id)
73
+ end
74
+
75
+ unless export_history
76
+ raise _("No export history was found. Verify the value given for "\
77
+ + "--task-id or --id")
78
+ end
79
+
80
+ make_listing_files(export_history)
81
+
82
+ HammerCLI::EX_OK
83
+ end
84
+ end
85
+
47
86
  class ListCommand < HammerCLIKatello::ListCommand
48
87
  desc "View content view export histories"
49
88
  output do
@@ -1,23 +1,23 @@
1
1
  require 'hammer_cli_katello/repository'
2
-
2
+ require 'find'
3
3
  # rubocop:disable ModuleLength
4
4
  module HammerCLIKatello
5
5
  module ContentExportHelper
6
6
  include ApipieHelper
7
-
8
7
  def execute
9
8
  warn_unexportable_repositories
10
9
  response = super
11
10
  if option_async?
12
- output.print_message _("Once the task completes the export metadata must be generated "\
13
- + "with the command:")
14
- output.print_message(" hammer content-export generate-metadata --task-id #{@task['id']}")
11
+ emit_async_info
15
12
  HammerCLI::EX_OK
16
13
  elsif response != HammerCLI::EX_OK
17
14
  response
18
15
  else
19
16
  export_history = fetch_export_history_from_task(reload_task(@task))
20
- if export_history
17
+ if syncable?
18
+ make_listing_files(export_history)
19
+ HammerCLI::EX_OK
20
+ elsif export_history
21
21
  generate_metadata_json(export_history)
22
22
  HammerCLI::EX_OK
23
23
  else
@@ -27,6 +27,22 @@ module HammerCLIKatello
27
27
  end
28
28
  end
29
29
 
30
+ def emit_async_info
31
+ if syncable?
32
+ output.print_message _("Once the task completes the listing files may be generated "\
33
+ + "with the command:")
34
+ output.print_message(" hammer content-export generate-listing --task-id #{@task['id']}")
35
+ else
36
+ output.print_message _("Once the task completes the export metadata must be generated "\
37
+ + "with the command:")
38
+ output.print_message(" hammer content-export generate-metadata --task-id #{@task['id']}")
39
+ end
40
+ end
41
+
42
+ def syncable?
43
+ options.key?("option_format") && option_format == 'syncable'
44
+ end
45
+
30
46
  def send_request
31
47
  @task = super
32
48
  end
@@ -54,6 +70,48 @@ module HammerCLIKatello
54
70
  fetch_export_history(export_history_id)
55
71
  end
56
72
 
73
+ def check_export_history_syncable!(export_history)
74
+ unless export_history["metadata"]["format"] == "syncable"
75
+ raise _("Cannot generate listing files for this export since "\
76
+ + "it is not syncable. It was not generated with --format=syncable.")
77
+ end
78
+
79
+ raise _("Export History does not have the path specified."\
80
+ + " The task may have errored out.") unless export_history["path"]
81
+ end
82
+
83
+ def make_listing_files(export_history)
84
+ check_export_history_syncable!(export_history)
85
+ output.print_message _("Generated #{export_history['path']}")
86
+
87
+ return unless Dir.exist?("#{export_history['path']}/content")
88
+
89
+ begin
90
+ # export history path may look like
91
+ # "/var/lib/pulp/exports/export-12803/apple/3.0//2022-06-30T17-23-06-00-00"
92
+ # Generate listing files for all sub directories of
93
+ # /var/lib/pulp/exports/export-12803/apple/3.0/$date/$org/Library/
94
+ ignorables = Dir.glob("#{export_history['path']}/content/**/repodata").map do |path|
95
+ File.dirname(path)
96
+ end
97
+
98
+ paths = Find.find("#{export_history['path']}/content").select do |path|
99
+ File.directory?(path) &&
100
+ ignorables.none? { |ignorable| path.start_with?(ignorable) }
101
+ end
102
+
103
+ paths.each do |dir|
104
+ directories = Dir.chdir(dir) { Dir['*'] }
105
+ File.write("#{dir}/listing", directories.join("\n"))
106
+ end
107
+ rescue SystemCallError
108
+ output.print_message _("Unable to access/write listing files"\
109
+ + " to '#{export_history['path']}'." \
110
+ + " To generate listing files run the command below as a root user ")
111
+ output.print_message(" hammer content-export generate-listing --id #{export_history['id']}")
112
+ end
113
+ end
114
+
57
115
  def generate_metadata_json(export_history)
58
116
  metadata_json = export_history["metadata"].to_json
59
117
  begin
@@ -102,6 +102,38 @@ module HammerCLIKatello
102
102
  setup
103
103
  end
104
104
 
105
+ class EnabledRepositoriesCommand < HammerCLIKatello::ListCommand
106
+ resource :host_subscriptions, :enabled_repositories
107
+ command_name 'enabled-repositories'
108
+
109
+ output do
110
+ field :id, _('ID')
111
+ field :name, _('Name')
112
+ field :label, _('Label')
113
+ field :content_type, _('Content type')
114
+ field :checksum, _("Checksum")
115
+
116
+ from :content_view do
117
+ field :id, _('Content View id')
118
+ field :name, _("Content View name")
119
+ end
120
+
121
+ from :content_view_version do
122
+ field :name, _("Content View version")
123
+ end
124
+
125
+ from :kt_environment do
126
+ field :name, _("Environment name")
127
+ end
128
+
129
+ from :product do
130
+ field :name, _("Product name")
131
+ end
132
+ end
133
+
134
+ build_options
135
+ end
136
+
105
137
  class ContentOverrideCommand < ::HammerCLIKatello::ContentOverrideBase::ContentOverrideCommand
106
138
  resource :host_subscriptions, :content_override
107
139
  setup
@@ -28,6 +28,10 @@ module HammerCLIKatello
28
28
  field :url, _("URL"), Fields::Field, hide_blank: true
29
29
  field :upstream_organization_label, _("Upstream Organization"),
30
30
  Fields::Field, hide_blank: true
31
+ field :upstream_lifecycle_environment_label,
32
+ _("Upstream Lifecycle Environment"), Fields::Field, hide_blank: true
33
+ field :upstream_content_view_label, _("Upstream Content View"),
34
+ Fields::Field, hide_blank: true
31
35
  field :username, _("Username"), Fields::Field, hide_blank: true
32
36
  field :ssl_ca_credential_id, _("SSL CA Credential ID"), Fields::Field, hide_blank: true
33
37
  end
@@ -86,7 +86,7 @@ module HammerCLIKatello
86
86
  end
87
87
 
88
88
  label _("GPG Key") do
89
- from :content_credential do
89
+ from :gpg_key do
90
90
  field :id, _("Id"), Fields::Field, :hide_blank => true
91
91
  field :name, _("Name"), Fields::Field, :hide_blank => true
92
92
  end
@@ -13,6 +13,16 @@ module HammerCLIKatello
13
13
  end
14
14
  end
15
15
 
16
+ class StatusCommand < HammerCLIKatello::ListCommand
17
+ resource :simple_content_access, :status
18
+ command_name "status"
19
+ output do
20
+ field :simple_content_access, _('Simple Content Access'), Fields::Boolean
21
+ end
22
+
23
+ build_options
24
+ end
25
+
16
26
  class EnableCommand < HammerCLIKatello::SingleResourceCommand
17
27
  include EligibleCheck
18
28
  include HammerCLIForemanTasks::Async
@@ -1,5 +1,5 @@
1
1
  module HammerCLIKatello
2
2
  def self.version
3
- @version ||= Gem::Version.new('1.5.0')
3
+ @version ||= Gem::Version.new('1.6.0')
4
4
  end
5
5
  end
@@ -43,6 +43,11 @@ module HammerCLIKatello
43
43
  'hammer_cli_katello/organization'
44
44
  )
45
45
 
46
+ HammerCLI::MainCommand.lazy_subcommand!("alternate-content-source", _("Manipulate alternate content sources"), # rubocop:disable LineLength
47
+ 'HammerCLIKatello::AcsCommand',
48
+ 'hammer_cli_katello/acs'
49
+ )
50
+
46
51
  HammerCLI::MainCommand.lazy_subcommand("content-credentials",
47
52
  _("Manipulate content credentials on the server"),
48
53
  'HammerCLIKatello::ContentCredentialCommand',