hammer_cli_katello 1.4.1 → 1.5.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 (208) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hammer_cli_katello/content_export_complete.rb +8 -0
  3. data/lib/hammer_cli_katello/content_export_helper.rb +55 -3
  4. data/lib/hammer_cli_katello/content_export_incremental.rb +8 -0
  5. data/lib/hammer_cli_katello/content_import.rb +9 -0
  6. data/lib/hammer_cli_katello/host_collection.rb +2 -0
  7. data/lib/hammer_cli_katello/id_resolver.rb +3 -2
  8. data/lib/hammer_cli_katello/organization.rb +11 -0
  9. data/lib/hammer_cli_katello/repository.rb +39 -2
  10. data/lib/hammer_cli_katello/version.rb +1 -1
  11. metadata +4 -398
  12. data/test/data/2.5/foreman_api.json +0 -1
  13. data/test/data/3.0/foreman_api.json +0 -1
  14. data/test/data/3.10/foreman_api.json +0 -1
  15. data/test/data/3.11/foreman_api.json +0 -1
  16. data/test/data/3.12/foreman_api.json +0 -1
  17. data/test/data/3.13/foreman_api.json +0 -1
  18. data/test/data/3.14/foreman_api.json +0 -1
  19. data/test/data/3.15/foreman_api.json +0 -1
  20. data/test/data/3.16/foreman_api.json +0 -1
  21. data/test/data/3.17/foreman_api.json +0 -1
  22. data/test/data/3.18/foreman_api.json +0 -1
  23. data/test/data/3.19/foreman_api.json +0 -1
  24. data/test/data/3.2/foreman_api.json +0 -1
  25. data/test/data/3.4/foreman_api.json +0 -1
  26. data/test/data/3.5/foreman_api.json +0 -1
  27. data/test/data/3.6/foreman_api.json +0 -1
  28. data/test/data/3.7/foreman_api.json +0 -1
  29. data/test/data/3.8/foreman_api.json +0 -1
  30. data/test/data/3.9/foreman_api.json +0 -1
  31. data/test/data/4.0/foreman_api.json +0 -1
  32. data/test/data/4.1/foreman_api.json +0 -1
  33. data/test/data/4.3/foreman_api.json +0 -1
  34. data/test/data/4.4/foreman_api.json +0 -1
  35. data/test/data/Readme.md +0 -5
  36. data/test/functional/activation_key/add_host_collection_test.rb +0 -62
  37. data/test/functional/activation_key/content_override_test.rb +0 -92
  38. data/test/functional/activation_key/create_test.rb +0 -33
  39. data/test/functional/activation_key/data/activation_key.json +0 -17
  40. data/test/functional/activation_key/info_test.rb +0 -29
  41. data/test/functional/activation_key/list_test.rb +0 -68
  42. data/test/functional/activation_key/product_content_test.rb +0 -23
  43. data/test/functional/activation_key/remove_host_collection_test.rb +0 -62
  44. data/test/functional/activation_key/subscriptions_test.rb +0 -74
  45. data/test/functional/activation_key/update_test.rb +0 -26
  46. data/test/functional/apipie_helper_test.rb +0 -31
  47. data/test/functional/capsule/capsule_helpers.rb +0 -13
  48. data/test/functional/capsule/content/add_lifecycle_environment_test.rb +0 -40
  49. data/test/functional/capsule/content/cancel_synchronization_test.rb +0 -42
  50. data/test/functional/capsule/content/capsule_content_helpers.rb +0 -24
  51. data/test/functional/capsule/content/data/library_env.json +0 -47
  52. data/test/functional/capsule/content/data/sync_status.json +0 -6
  53. data/test/functional/capsule/content/data/sync_tasks.json +0 -62
  54. data/test/functional/capsule/content/info_test.rb +0 -61
  55. data/test/functional/capsule/content/lifecycle_environments_test.rb +0 -19
  56. data/test/functional/capsule/content/remove_lifecycle_environment_test.rb +0 -40
  57. data/test/functional/capsule/content/synchronization_status_test.rb +0 -107
  58. data/test/functional/capsule/info_test.rb +0 -25
  59. data/test/functional/capsule/list_test.rb +0 -24
  60. data/test/functional/content_credentials/create_test.rb +0 -32
  61. data/test/functional/content_credentials/data/test_cert.json +0 -43
  62. data/test/functional/content_credentials/info_test.rb +0 -50
  63. data/test/functional/content_credentials/list_test.rb +0 -66
  64. data/test/functional/content_export/complete/library_test.rb +0 -155
  65. data/test/functional/content_export/complete/version_test.rb +0 -252
  66. data/test/functional/content_export/content_export_helpers.rb +0 -26
  67. data/test/functional/content_export/generate_metadata_test.rb +0 -64
  68. data/test/functional/content_export/incremental/library_test.rb +0 -172
  69. data/test/functional/content_export/incremental/version_test.rb +0 -268
  70. data/test/functional/content_export/list_test.rb +0 -64
  71. data/test/functional/content_import/library_test.rb +0 -85
  72. data/test/functional/content_import/list_test.rb +0 -65
  73. data/test/functional/content_import/metadata.json +0 -1
  74. data/test/functional/content_import/version_test.rb +0 -85
  75. data/test/functional/content_units/info_test.rb +0 -29
  76. data/test/functional/content_units/list_test.rb +0 -106
  77. data/test/functional/content_view/add_content_view_version_test.rb +0 -88
  78. data/test/functional/content_view/add_repository_test.rb +0 -21
  79. data/test/functional/content_view/component/add_test.rb +0 -177
  80. data/test/functional/content_view/component/list_test.rb +0 -55
  81. data/test/functional/content_view/component/remove_test.rb +0 -107
  82. data/test/functional/content_view/component/update_test.rb +0 -134
  83. data/test/functional/content_view/content_view_helpers.rb +0 -20
  84. data/test/functional/content_view/copy_test.rb +0 -53
  85. data/test/functional/content_view/create_test.rb +0 -34
  86. data/test/functional/content_view/delete_test.rb +0 -62
  87. data/test/functional/content_view/filter/create_test.rb +0 -57
  88. data/test/functional/content_view/filter/delete_test.rb +0 -90
  89. data/test/functional/content_view/filter/info_test.rb +0 -89
  90. data/test/functional/content_view/filter/list_test.rb +0 -98
  91. data/test/functional/content_view/filter/update_test.rb +0 -91
  92. data/test/functional/content_view/list_test.rb +0 -68
  93. data/test/functional/content_view/publish_test.rb +0 -24
  94. data/test/functional/content_view/purge_test.rb +0 -97
  95. data/test/functional/content_view/remove_content_view_version_test.rb +0 -88
  96. data/test/functional/content_view/remove_test.rb +0 -79
  97. data/test/functional/content_view/update_test.rb +0 -53
  98. data/test/functional/content_view/version/incremental_update_test.rb +0 -108
  99. data/test/functional/content_view/version/list_test.rb +0 -44
  100. data/test/functional/content_view/version/promote_test.rb +0 -75
  101. data/test/functional/content_view/version/republish_repositories_test.rb +0 -34
  102. data/test/functional/content_view/version/update_test.rb +0 -48
  103. data/test/functional/erratum/erratum_helpers.rb +0 -91
  104. data/test/functional/erratum/info_test.rb +0 -29
  105. data/test/functional/erratum/list_test.rb +0 -108
  106. data/test/functional/file/file_helpers.rb +0 -13
  107. data/test/functional/file/info_test.rb +0 -162
  108. data/test/functional/file/list_test.rb +0 -112
  109. data/test/functional/filter_rule/create_test.rb +0 -99
  110. data/test/functional/filter_rule/delete_test.rb +0 -104
  111. data/test/functional/filter_rule/filter_rule_helpers.rb +0 -12
  112. data/test/functional/filter_rule/info_test.rb +0 -104
  113. data/test/functional/filter_rule/list_test.rb +0 -91
  114. data/test/functional/filter_rule/update_test.rb +0 -104
  115. data/test/functional/host/errata/apply_test.rb +0 -45
  116. data/test/functional/host/errata/info_test.rb +0 -27
  117. data/test/functional/host/errata/list_test.rb +0 -49
  118. data/test/functional/host/errata/recalculate_test.rb +0 -26
  119. data/test/functional/host/extensions/create_test.rb +0 -95
  120. data/test/functional/host/extensions/data/host.json +0 -320
  121. data/test/functional/host/extensions/data/host_list.json +0 -117
  122. data/test/functional/host/extensions/info_test.rb +0 -35
  123. data/test/functional/host/extensions/list_test.rb +0 -21
  124. data/test/functional/host/extensions/update_test.rb +0 -70
  125. data/test/functional/host/host_helpers.rb +0 -8
  126. data/test/functional/host/subscription/attach_test.rb +0 -54
  127. data/test/functional/host/subscription/auto_attach_test.rb +0 -35
  128. data/test/functional/host/subscription/content_override_test.rb +0 -96
  129. data/test/functional/host/subscription/product_content_test.rb +0 -27
  130. data/test/functional/host/subscription/register_test.rb +0 -53
  131. data/test/functional/host/subscription/remove_test.rb +0 -52
  132. data/test/functional/host/subscription/unregister_test.rb +0 -37
  133. data/test/functional/host/traces/list_test.rb +0 -37
  134. data/test/functional/host/traces/resolve_test.rb +0 -31
  135. data/test/functional/host_collection/add_host_test.rb +0 -90
  136. data/test/functional/host_collection/content_api_expectations.rb +0 -35
  137. data/test/functional/host_collection/content_install_test.rb +0 -62
  138. data/test/functional/host_collection/content_remove_test.rb +0 -37
  139. data/test/functional/host_collection/content_update_test.rb +0 -37
  140. data/test/functional/host_collection/copy_test.rb +0 -64
  141. data/test/functional/host_collection/create_test.rb +0 -54
  142. data/test/functional/host_collection/delete_test.rb +0 -57
  143. data/test/functional/host_collection/hosts_test.rb +0 -39
  144. data/test/functional/host_collection/info_test.rb +0 -57
  145. data/test/functional/host_collection/list_test.rb +0 -63
  146. data/test/functional/host_collection/remove_host_test.rb +0 -90
  147. data/test/functional/host_collection/update_test.rb +0 -57
  148. data/test/functional/hostgroup/create_test.rb +0 -112
  149. data/test/functional/hostgroup/data/hostgroup.json +0 -50
  150. data/test/functional/hostgroup/info_test.rb +0 -33
  151. data/test/functional/hostgroup/update_test.rb +0 -120
  152. data/test/functional/lifecycle_environment/create_test.rb +0 -14
  153. data/test/functional/lifecycle_environment/lifecycle_environment_helpers.rb +0 -18
  154. data/test/functional/lifecycle_environment/list_test.rb +0 -38
  155. data/test/functional/lifecycle_environment/update_test.rb +0 -14
  156. data/test/functional/local_helper_test.rb +0 -30
  157. data/test/functional/module_stream/info_test.rb +0 -58
  158. data/test/functional/module_stream/list_test.rb +0 -53
  159. data/test/functional/organization/cdn_configuration_test.rb +0 -45
  160. data/test/functional/organization/delete_test.rb +0 -26
  161. data/test/functional/organization/info_test.rb +0 -39
  162. data/test/functional/organization/organization_helpers.rb +0 -10
  163. data/test/functional/package/list_test.rb +0 -160
  164. data/test/functional/package_group/list_test.rb +0 -38
  165. data/test/functional/ping_test.rb +0 -61
  166. data/test/functional/product/create_test.rb +0 -54
  167. data/test/functional/product/delete_test.rb +0 -41
  168. data/test/functional/product/info_test.rb +0 -33
  169. data/test/functional/product/list_test.rb +0 -58
  170. data/test/functional/product/product_helpers.rb +0 -24
  171. data/test/functional/product/remove_sync_plan_test.rb +0 -35
  172. data/test/functional/product/set_sync_plan_test.rb +0 -49
  173. data/test/functional/product/update_proxy.rb +0 -48
  174. data/test/functional/product/update_test.rb +0 -46
  175. data/test/functional/repository/create_test.rb +0 -21
  176. data/test/functional/repository/delete_test.rb +0 -95
  177. data/test/functional/repository/info_test.rb +0 -162
  178. data/test/functional/repository/list_test.rb +0 -68
  179. data/test/functional/repository/reclaim_space_test.rb +0 -105
  180. data/test/functional/repository/remove_content_test.rb +0 -108
  181. data/test/functional/repository/repository_helpers.rb +0 -18
  182. data/test/functional/repository/synchronize_test.rb +0 -57
  183. data/test/functional/repository/update_test.rb +0 -149
  184. data/test/functional/repository/upload_test.rb +0 -368
  185. data/test/functional/repository_set/available_repositories_test.rb +0 -18
  186. data/test/functional/repository_set/disable_test.rb +0 -42
  187. data/test/functional/repository_set/enable_test.rb +0 -42
  188. data/test/functional/repository_set/info_test.rb +0 -17
  189. data/test/functional/repository_set/list_test.rb +0 -18
  190. data/test/functional/repository_set/repository_set_helpers.rb +0 -20
  191. data/test/functional/search_helpers.rb +0 -17
  192. data/test/functional/simple_content_access/disable_test.rb +0 -48
  193. data/test/functional/simple_content_access/enable_test.rb +0 -46
  194. data/test/functional/srpm/list_test.rb +0 -92
  195. data/test/functional/subscription/list_test.rb +0 -86
  196. data/test/functional/sync_plan/create_test.rb +0 -60
  197. data/test/functional/sync_plan/delete_test.rb +0 -46
  198. data/test/functional/sync_plan/info_test.rb +0 -37
  199. data/test/functional/sync_plan/list_test.rb +0 -31
  200. data/test/functional/sync_plan/sync_plan_helpers.rb +0 -8
  201. data/test/functional/sync_plan/update_test.rb +0 -44
  202. data/test/functional/test_helper.rb +0 -24
  203. data/test/task_helper.rb +0 -7
  204. data/test/test_helper.rb +0 -38
  205. data/test/unit/id_name_options_validator_test.rb +0 -96
  206. data/test/unit/id_resolver_test.rb +0 -58
  207. data/test/unit/messages_test.rb +0 -7
  208. 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: d1ff46aa39c3547dea6343f671d10d5ae603ecee1d4e2c416ddea5b1884de3e0
4
- data.tar.gz: 5c3a848bcf07dba7d725a882a8a5e667841327f08ec738c100375c910466bfef
3
+ metadata.gz: f9402037812c97c98165fb0993f82063bafe1494644ce0e23f2302926e39eab9
4
+ data.tar.gz: 30ee3c5a4cecaa4822d3a2ec94630f8f26d22b5d643868fa76bd6d07286c10a9
5
5
  SHA512:
6
- metadata.gz: 2fe7eddfe5ec1ebb616afeadd16c57ccba45100997b00dd69912284c27fc94467d22bc2d0023685237e7c744f3eb257a2c8d92d31a5589eb520a3f2e5fb2c484
7
- data.tar.gz: 615ed4f84b86117d9b78543c1d8b5a09b9e21240d4f2fa9d5c2899c5a0d229e4ea1da2d008b03095473c90f9ea5cb43a024d122168a0b29a3578affd0d62b040
6
+ metadata.gz: 38efbc45b82eec60cfd40df5ae30051484aa0e2f1e8eb6877128ed6cef14d8bb801da8cea3704e2a3689b329ca86a89776a0a196226115cf313bd952214bd968
7
+ data.tar.gz: 4935236c67fac3f628e434492efcdf70341100d24c491aeb68dfc3aba5ddd5dbee93306d7c23a632e2c389bc0b055f1df59d8efddd28a27d4d44d93e14ce7602
@@ -20,6 +20,14 @@ module HammerCLIKatello
20
20
  include ContentExportHelper
21
21
  end
22
22
 
23
+ class RepositoryCommand < HammerCLIKatello::SingleResourceCommand
24
+ desc _("Performs a full export of a repository")
25
+ command_name "repository"
26
+
27
+ include HammerCLIForemanTasks::Async
28
+ include ContentExportHelper
29
+ end
30
+
23
31
  autoload_subcommands
24
32
  end
25
33
  end
@@ -1,4 +1,5 @@
1
1
  require 'hammer_cli_katello/repository'
2
+
2
3
  # rubocop:disable ModuleLength
3
4
  module HammerCLIKatello
4
5
  module ContentExportHelper
@@ -40,7 +41,8 @@ module HammerCLIKatello
40
41
  end
41
42
 
42
43
  def fetch_export_history(export_history_id)
43
- index(:content_exports, :id => export_history_id).first if export_history_id
44
+ return unless export_history_id
45
+ index(:content_exports, :id => export_history_id).first
44
46
  end
45
47
 
46
48
  def fetch_export_history_from_task(task)
@@ -48,7 +50,6 @@ module HammerCLIKatello
48
50
  if %w(error warning).include?(task['result'])
49
51
  raise _("Can not fetch export history from an unfinished task")
50
52
  end
51
-
52
53
  export_history_id = task.dig('output', 'export_history_id')
53
54
  fetch_export_history(export_history_id)
54
55
  end
@@ -72,7 +73,16 @@ module HammerCLIKatello
72
73
  self.class.command_name.first.to_sym == :version
73
74
  end
74
75
 
76
+ def repository_command?
77
+ self.class.command_name.first.to_sym == :repository
78
+ end
79
+
75
80
  def fetch_repositories
81
+ if repository_command?
82
+ resp = show(:repositories, id: resolver.repository_id(options))
83
+ return resp["download_policy"] == "immediate" ? [] : [resp]
84
+ end
85
+
76
86
  repo_options = {
77
87
  library: true,
78
88
  content_type: 'yum',
@@ -95,6 +105,10 @@ module HammerCLIKatello
95
105
  " Update the download policy and sync affected repositories."\
96
106
  " Once synced republish the content view"\
97
107
  " and export the generated version.")
108
+ elsif repository_command?
109
+ output.print_message _("NOTE: Unable to fully export this repository because"\
110
+ " it does not have the 'immediate' download policy."\
111
+ " Update the download policy, sync the repository and export.")
98
112
  else
99
113
  output.print_message _("NOTE: Unable to fully export this organization's library because"\
100
114
  " it contains repositories without the 'immediate' download policy."\
@@ -107,7 +121,7 @@ module HammerCLIKatello
107
121
  "--download-policy='immediate'"
108
122
  output.print_message ""
109
123
  print_record(::HammerCLIKatello::Repository::ListCommand.output_definition, repos)
110
- exit(HammerCLI::EX_SOFTWARE) if option_fail_on_missing_content?
124
+ exit(HammerCLI::EX_SOFTWARE) if repository_command? || option_fail_on_missing_content?
111
125
  end
112
126
  end
113
127
 
@@ -116,6 +130,44 @@ module HammerCLIKatello
116
130
  setup_version(base)
117
131
  elsif base.command_name.first.to_sym == :library
118
132
  setup_library(base)
133
+ elsif base.command_name.first.to_sym == :repository
134
+ setup_repository(base)
135
+ end
136
+ end
137
+
138
+ def self.setup_repository(base)
139
+ base.action(:repository)
140
+ base.success_message _("Repository is being exported in task %{id}.")
141
+ base.failure_message _("Could not export the repository")
142
+
143
+ base.option "--name", "NAME", _("Filter repositories by name."),
144
+ :attribute_name => :option_name,
145
+ :required => false
146
+
147
+ base.build_options do |o|
148
+ o.expand(:all).including(:products, :organizations)
149
+ end
150
+
151
+ base.validate_options do
152
+ any(:option_id, :option_name).required
153
+ unless option(:option_id).exist?
154
+ any(
155
+ :option_product_id,
156
+ :option_product_name
157
+ ).required
158
+ unless option(:option_product_id).exist?
159
+ any(:option_organization_id, :option_organization_name, \
160
+ :option_organization_label).required
161
+ end
162
+ end
163
+ end
164
+
165
+ base.class_eval do
166
+ def request_params
167
+ super.tap do |opts|
168
+ opts["id"] = resolver.repository_id(options)
169
+ end
170
+ end
119
171
  end
120
172
  end
121
173
 
@@ -20,6 +20,14 @@ module HammerCLIKatello
20
20
  include ContentExportHelper
21
21
  end
22
22
 
23
+ class RepositoryCommand < HammerCLIKatello::SingleResourceCommand
24
+ desc _("Performs an incremental export of a repository")
25
+ command_name "repository"
26
+
27
+ include HammerCLIForemanTasks::Async
28
+ include ContentExportHelper
29
+ end
30
+
23
31
  autoload_subcommands
24
32
  end
25
33
  end
@@ -58,6 +58,15 @@ module HammerCLIKatello
58
58
  include ContentImportCommon
59
59
  end
60
60
 
61
+ class RepositoryCommand < HammerCLIKatello::SingleResourceCommand
62
+ desc _("Imports a repository")
63
+ action :repository
64
+ command_name "repository"
65
+
66
+ include HammerCLIForemanTasks::Async
67
+ include ContentImportCommon
68
+ end
69
+
61
70
  class ListCommand < HammerCLIKatello::ListCommand
62
71
  desc "View content view import histories"
63
72
  output do
@@ -143,6 +143,8 @@ module HammerCLIKatello
143
143
  success_message _("Host collection updated.")
144
144
  failure_message _("Could not update the the host collection")
145
145
 
146
+ option "--unlimited-hosts", :flag, "Set hosts max to unlimited"
147
+
146
148
  build_options { |o| o.expand(:all).including(:organizations) }
147
149
  end
148
150
 
@@ -29,8 +29,9 @@ module HammerCLIKatello
29
29
  :sync_plan => [s_name(_("Sync plan name to search by"))],
30
30
  :task => [s_name(_("Task name to search by"))],
31
31
  :content_view_version => [s("version", _("Content view version number"))],
32
- :content_export => [],
33
- :content_import => []
32
+ :content_export => [],
33
+ :content_export_incremental => [],
34
+ :content_import => []
34
35
  }.freeze
35
36
 
36
37
  DEFAULT_SEARCHABLES = [s_name(_("Name to search by"))].freeze
@@ -24,6 +24,7 @@ module HammerCLIKatello
24
24
  field :service_levels, _("Service Levels"), Fields::List
25
25
  from :cdn_configuration do
26
26
  label "CDN configuration", hide_blank: true do
27
+ field :type_label, _("Type"), Fields::Field
27
28
  field :url, _("URL"), Fields::Field, hide_blank: true
28
29
  field :upstream_organization_label, _("Upstream Organization"),
29
30
  Fields::Field, hide_blank: true
@@ -39,9 +40,19 @@ module HammerCLIKatello
39
40
  else
40
41
  _("Disabled")
41
42
  end
43
+ setup_cdn_type(data)
42
44
  data
43
45
  end
44
46
 
47
+ def setup_cdn_type(data)
48
+ types = {
49
+ 'export_sync' => _("Export Sync"),
50
+ 'network_sync' => _("Network Sync"),
51
+ 'redhat_cdn' => _("Red Hat CDN")
52
+ }
53
+ data["cdn_configuration"].merge!("type_label" => types[data["cdn_configuration"]["type"]])
54
+ end
55
+
45
56
  build_options
46
57
  end
47
58
 
@@ -56,7 +56,7 @@ module HammerCLIKatello
56
56
  field :_redhat_repo, _("Red Hat Repository")
57
57
  field :content_type, _("Content Type")
58
58
  field :checksum_type, _("Checksum Type"), Fields::Field, :hide_blank => true
59
- field :_mirror_on_sync, _("Mirror on Sync")
59
+ field :_mirroring_policy, _("Mirroring Policy"), Fields::Field, :hide_blank => true
60
60
  field :url, _("Url")
61
61
  field :_publish_via_http, _("Publish Via HTTP")
62
62
  field :full_path, _("Published At")
@@ -126,6 +126,7 @@ module HammerCLIKatello
126
126
 
127
127
  setup_sync_state(data)
128
128
  setup_booleans(data)
129
+ setup_mirroring_policy(data)
129
130
  setup_content_counts(data) if data["content_counts"]
130
131
  data
131
132
  end
@@ -133,7 +134,16 @@ module HammerCLIKatello
133
134
  def setup_booleans(data)
134
135
  data["_redhat_repo"] = data.dig("product", "redhat") ? _("yes") : _("no")
135
136
  data["_publish_via_http"] = data["unprotected"] ? _("yes") : _("no")
136
- data["_mirror_on_sync"] = data["mirror_on_sync"] ? _("yes") : _("no")
137
+ end
138
+
139
+ def setup_mirroring_policy(data)
140
+ policies = {
141
+ 'additive' => _("Additive"),
142
+ 'mirror_content_only' => _("Content Only"),
143
+ 'mirror_complete' => _("Complete Mirroring")
144
+ }
145
+ mirroring_policy = data["mirroring_policy"]
146
+ data["_mirroring_policy"] = policies[mirroring_policy]
137
147
  end
138
148
 
139
149
  def setup_sync_state(data)
@@ -557,6 +567,33 @@ module HammerCLIKatello
557
567
  end
558
568
  end
559
569
 
570
+ class RepublishCommand < HammerCLIKatello::SingleResourceCommand
571
+ extend RepositoryScopedToProduct
572
+ include HammerCLIForemanTasks::Async
573
+ include OrganizationOptions
574
+
575
+ validate_repo_name_requires_product_options
576
+ action :republish
577
+ command_name "republish"
578
+ desc _("Forces a republish of the specified repository.")
579
+
580
+ success_message _("Repository republished.")
581
+ failure_message _("Could not republish the repository.")
582
+
583
+ validate_options :before, 'IdResolution' do
584
+ organization_options = [:option_organization_id, :option_organization_name, \
585
+ :option_organization_label]
586
+
587
+ if option(:option_product_name).exist?
588
+ any(*organization_options).required
589
+ end
590
+ end
591
+
592
+ build_options do |o|
593
+ o.expand.including(:products)
594
+ end
595
+ end
596
+
560
597
  class ReclaimSpaceCommand < HammerCLIKatello::SingleResourceCommand
561
598
  extend RepositoryScopedToProduct
562
599
  include HammerCLIForemanTasks::Async
@@ -1,5 +1,5 @@
1
1
  module HammerCLIKatello
2
2
  def self.version
3
- @version ||= Gem::Version.new('1.4.1')
3
+ @version ||= Gem::Version.new('1.5.0')
4
4
  end
5
5
  end