hammer_cli_katello 1.1.2 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hammer_cli_katello/command_extensions/content_source.rb +32 -0
  3. data/lib/hammer_cli_katello/command_extensions/kickstart_repository.rb +50 -0
  4. data/lib/hammer_cli_katello/command_extensions/lifecycle_environment.rb +12 -0
  5. data/lib/hammer_cli_katello/command_extensions.rb +2 -0
  6. data/lib/hammer_cli_katello/commands.rb +1 -1
  7. data/lib/hammer_cli_katello/content_export_helper.rb +6 -2
  8. data/lib/hammer_cli_katello/content_units.rb +66 -0
  9. data/lib/hammer_cli_katello/content_view.rb +11 -0
  10. data/lib/hammer_cli_katello/content_view_version.rb +3 -3
  11. data/lib/hammer_cli_katello/host_collection.rb +6 -0
  12. data/lib/hammer_cli_katello/host_errata.rb +2 -3
  13. data/lib/hammer_cli_katello/host_extensions.rb +8 -6
  14. data/lib/hammer_cli_katello/hostgroup_extensions.rb +19 -12
  15. data/lib/hammer_cli_katello/id_resolver.rb +5 -2
  16. data/lib/hammer_cli_katello/option_sources/lifecycle_environment_params.rb +40 -3
  17. data/lib/hammer_cli_katello/organization.rb +28 -3
  18. data/lib/hammer_cli_katello/package.rb +2 -1
  19. data/lib/hammer_cli_katello/ping.rb +7 -0
  20. data/lib/hammer_cli_katello/repository.rb +10 -42
  21. data/lib/hammer_cli_katello/search_options_creators.rb +2 -1
  22. data/lib/hammer_cli_katello/srpm.rb +2 -0
  23. data/lib/hammer_cli_katello/version.rb +1 -1
  24. data/lib/hammer_cli_katello.rb +5 -5
  25. data/test/data/4.3/foreman_api.json +1 -0
  26. data/test/functional/activation_key/create_test.rb +1 -1
  27. data/test/functional/activation_key/subscriptions_test.rb +1 -1
  28. data/test/functional/content_units/info_test.rb +29 -0
  29. data/test/functional/content_units/list_test.rb +106 -0
  30. data/test/functional/content_view/version/promote_test.rb +41 -0
  31. data/test/functional/content_view/version/republish_repositories_test.rb +1 -1
  32. data/test/functional/host/errata/recalculate_test.rb +8 -22
  33. data/test/functional/host_collection/create_test.rb +11 -0
  34. data/test/functional/module_stream/info_test.rb +1 -1
  35. data/test/functional/organization/cdn_configuration_test.rb +42 -0
  36. data/test/functional/organization/info_test.rb +17 -0
  37. data/test/functional/package/list_test.rb +4 -2
  38. data/test/functional/ping_test.rb +3 -1
  39. data/test/functional/srpm/list_test.rb +1 -1
  40. data/test/functional/subscription/list_test.rb +2 -2
  41. data/test/test_helper.rb +1 -1
  42. metadata +14 -8
  43. data/lib/hammer_cli_katello/host_content_source_options.rb +0 -28
  44. data/lib/hammer_cli_katello/host_kickstart_repository_options.rb +0 -49
  45. data/lib/hammer_cli_katello/ostree_branch.rb +0 -34
  46. data/test/functional/repository/export_test.rb +0 -121
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8787337433eea048dbc889beeb9d09dd0264d9f22838851544f08230e4fdb01
4
- data.tar.gz: 280fbe62f124439debe0bcb7e19cf13f041857801d06eaf0ad2e162cdc53b36b
3
+ metadata.gz: 9299bc667628d32e5cdabeb70fff4b381bd71664bb999abede682076e8b1b82a
4
+ data.tar.gz: 0b6db8c43b4a4994dd78063760bf57801c14cc1cc88fb727d6fffeb36085ed47
5
5
  SHA512:
6
- metadata.gz: 611b6017e7bb314e31dcfa9138f37c9171a6e118e87b9174664bfe4f0569bc6b77b5b1e5cb2682ede8716c1f62aab4b9b046e6aad8e518a5dec83d0d2ddb4402
7
- data.tar.gz: 61acf6ec874572401e818494534a264476b4300efead8781fe64f22ddbd350b33eed22eb764558fc80e5e8e3517c4df43bd24613dc84800dc7f094a333f091f2
6
+ metadata.gz: 54ebe7f1d033e4d15a965d731947684e13fc52e74aa9838e5e4ed821ea76f724d02a0b8cf67b16198e563b2732b53ef2a75de0c20e4e69809de52b16994475d0
7
+ data.tar.gz: f53d1b937657cbcc786a868127d29a549a56bab4e76e484d141abd2aac0864b65dc76ca3b4cefb3ccd67ddca12e9f87f4318d537f6cd9f0ca3e0c9d879cea309
@@ -0,0 +1,32 @@
1
+ module HammerCLIKatello
2
+ module CommandExtensions
3
+ class ContentSource < HammerCLI::CommandExtensions
4
+ option_family associate: 'content_source' do
5
+ child '--content-source', 'CONTENT_SOURCE_NAME', _('Content Source name'),
6
+ attribute_name: :option_content_source,
7
+ referenced_resource: :smart_proxy
8
+ end
9
+
10
+ request_params do |params, cmd_obj|
11
+ begin
12
+ resource_name = cmd_obj.resource.singular_name
13
+ if cmd_obj.option_content_source && !cmd_obj.option_content_source_id
14
+ resource_hash = if resource_name == 'hostgroup'
15
+ params[resource_name]
16
+ else
17
+ params[resource_name]['content_facet_attributes']
18
+ end
19
+
20
+ proxy_options = {
21
+ HammerCLI.option_accessor_name('name') => cmd_obj.option_content_source
22
+ }
23
+ resource_hash['content_source_id'] = cmd_obj.resolver.smart_proxy_id(proxy_options)
24
+ end
25
+ rescue HammerCLIForeman::ResolverError => e
26
+ e.message.gsub!('smart_proxy', _('Content Source'))
27
+ raise e
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,50 @@
1
+ module HammerCLIKatello
2
+ module CommandExtensions
3
+ class KickstartRepository < HammerCLI::CommandExtensions
4
+ option_family associate: 'kickstart_repository' do
5
+ child '--kickstart-repository', 'REPOSITORY_NAME', _('Kickstart repository name'),
6
+ attribute_name: :option_kickstart_repository
7
+ end
8
+
9
+ request_params do |params, cmd_obj|
10
+ resource_name = cmd_obj.resource.singular_name
11
+ if cmd_obj.option_kickstart_repository && !cmd_obj.option_kickstart_repository_id
12
+ resource_hash = if resource_name == 'hostgroup'
13
+ params[resource_name]
14
+ else
15
+ params[resource_name]['content_facet_attributes']
16
+ end
17
+
18
+ resource_hash ||= {}
19
+
20
+ env_id = resource_hash['lifecycle_environment_id']
21
+ cv_id = resource_hash['content_view_id']
22
+
23
+ raise _('Please provide --lifecycle-environment-id') unless env_id
24
+
25
+ raise _('Please provide --content-view-id') unless cv_id
26
+ # rubocop:disable LineLength
27
+ resource_hash['kickstart_repository_id'] = HammerCLIKatello::CommandExtensions::KickstartRepository.fetch_repo_id(
28
+ cv_id, env_id, cmd_obj.option_kickstart_repository
29
+ )
30
+ # rubocop:enable LineLength
31
+ end
32
+ end
33
+
34
+ def self.fetch_repo_id(cv_id, env_id, repo_name)
35
+ repo_resource = HammerCLIForeman.foreman_resource(:repositories)
36
+ index_options = {
37
+ content_view_id: cv_id,
38
+ environment_id: env_id,
39
+ name: repo_name
40
+ }
41
+ repos = repo_resource.call(:index, index_options)['results']
42
+ if repos.empty?
43
+ raise _("No such repository with name %{name}, in lifecycle environment"\
44
+ " %{environment_id} and content view %{content_view_id}" % index_options)
45
+ end
46
+ repos.first['id']
47
+ end
48
+ end
49
+ end
50
+ end
@@ -13,6 +13,18 @@ module HammerCLIKatello
13
13
  attribute_name: :option_environment_id
14
14
  end
15
15
 
16
+ # Add explicitly defined options since option builder won't be
17
+ # able to create options automatically in case there is missing resource
18
+ # in API docs or if the resource name is different
19
+ # (e.g. environment instead of lifecycle_environment)
20
+ # This can happen if API docs contain a param which cannot be mapped
21
+ # via param_name to resource_name mapping
22
+ option_family associate: 'lifecycle_environment' do
23
+ child '--lifecycle-environment', 'ENVIRONMENT_NAME',
24
+ _('Lifecycle environment name to search by'),
25
+ attribute_name: :option_environment_name
26
+ end
27
+
16
28
  option_sources do |sources, command|
17
29
  sources.find_by_name('IdResolution').insert_relative(
18
30
  :after,
@@ -3,3 +3,5 @@
3
3
  require 'hammer_cli_katello/command_extensions/lifecycle_environment'
4
4
  require 'hammer_cli_katello/command_extensions/lifecycle_environments'
5
5
  require 'hammer_cli_katello/command_extensions/ping'
6
+ require 'hammer_cli_katello/command_extensions/content_source'
7
+ require 'hammer_cli_katello/command_extensions/kickstart_repository'
@@ -36,7 +36,7 @@ module HammerCLIKatello
36
36
  end
37
37
 
38
38
  def resource_name_mapping
39
- HammerCLIKatello::RESOURCE_NAME_MAPPING.dup
39
+ super.merge(HammerCLIKatello::RESOURCE_NAME_MAPPING.dup)
40
40
  end
41
41
  end
42
42
  end
@@ -162,14 +162,18 @@ module HammerCLIKatello
162
162
  :required => false
163
163
 
164
164
  base.build_options do |o|
165
- o.expand(:all).including(:content_views, :organizations, :environments)
165
+ o.expand(:all).including(:content_views, :organizations, :lifecycle_environments)
166
166
  o.without(:environment_ids, :environment_id)
167
167
  end
168
168
 
169
169
  base.validate_options do
170
170
  unless option(:option_id).exist?
171
171
  any(:option_id, :option_content_view_name, :option_content_view_id).required
172
- any(:option_version, :option_environment_id, :option_environment_name).required
172
+ any(
173
+ :option_version,
174
+ :option_lifecycle_environment_id,
175
+ :option_lifecycle_environment_name
176
+ ).required
173
177
  unless option(:option_content_view_id).exist?
174
178
  any(:option_organization_id, :option_organization_name, \
175
179
  :option_organization_label).required
@@ -0,0 +1,66 @@
1
+ module HammerCLIKatello
2
+ class ContentUnitsCommand < HammerCLIKatello::Command
3
+ resource :generic_content_units
4
+
5
+ class ListCommand < HammerCLIKatello::ListCommand
6
+ extend RepositoryScopedToProduct
7
+
8
+ validate_repo_name_requires_product_options(:option_repository_name)
9
+
10
+ output do
11
+ field :id, _("Id")
12
+ field :name, _("Name")
13
+ field :version, _("Version")
14
+ field :filename, _("Filename"), Fields::Field, hide_blank: true
15
+ end
16
+
17
+ validate_options :before, 'IdResolution' do
18
+ organization_options = [:option_organization_id, :option_organization_name,
19
+ :option_organization_label]
20
+ if any(:option_product_name, :option_content_view_name).exist?
21
+ any(*organization_options).required
22
+ end
23
+ end
24
+
25
+ build_options do |o|
26
+ o.expand.including(:products, :organizations, :content_views)
27
+ end
28
+ end
29
+
30
+ class InfoCommand < HammerCLIKatello::InfoCommand
31
+ output do
32
+ field :id, _("Id")
33
+ field :name, _("Name")
34
+ field :version, _("Version")
35
+ field :filename, _("Filename"), Fields::Field, hide_blank: true
36
+ end
37
+
38
+ validate_options :before, 'IdResolution' do
39
+ organization_options = [:option_organization_id, :option_organization_name,
40
+ :option_organization_label]
41
+ product_options = [:option_product_id, :option_product_name]
42
+ repository_options = [:option_repository_id, :option_repository_name]
43
+ content_view_version_options = [:option_content_view_version_id,
44
+ :option_content_view_version_version]
45
+
46
+ if option(:option_product_name).exist?
47
+ any(*organization_options).required
48
+ end
49
+
50
+ if option(:option_repository_name).exist?
51
+ any(*product_options).required
52
+ end
53
+
54
+ if option(:option_name).exist?
55
+ any(*(repository_options + content_view_version_options)).required
56
+ end
57
+ end
58
+
59
+ build_options do |o|
60
+ o.expand.including(:products, :organizations, :content_views, :content_view_versions)
61
+ end
62
+ end
63
+
64
+ autoload_subcommands
65
+ end
66
+ end
@@ -197,6 +197,17 @@ module HammerCLIKatello
197
197
  failure_message _("Could not publish the content view")
198
198
 
199
199
  build_options
200
+
201
+ option_family associate: 'lifecycle_environment' do
202
+ child '--lifecycle-environments', 'LIFECYCLE_ENVIRONMENT_NAMES',
203
+ _('Names for Lifecycle Environment'),
204
+ format: HammerCLI::Options::Normalizers::List.new,
205
+ attribute_name: :option_environment_names
206
+ end
207
+
208
+ extend_with(
209
+ HammerCLIKatello::CommandExtensions::LifecycleEnvironments.new(only: :option_sources)
210
+ )
200
211
  end
201
212
 
202
213
  class RemoveFromEnvironmentCommand < HammerCLIKatello::SingleResourceCommand
@@ -60,7 +60,7 @@ module HammerCLIKatello
60
60
  end
61
61
 
62
62
  build_options do |o|
63
- o.expand(:all).including(:environments, :content_views, :organizations)
63
+ o.expand(:all).including(:lifecycle_environments, :content_views, :organizations)
64
64
  end
65
65
 
66
66
  extend_with(HammerCLIKatello::CommandExtensions::LifecycleEnvironment.new)
@@ -143,7 +143,7 @@ module HammerCLIKatello
143
143
  failure_message _("Could not delete the content view")
144
144
 
145
145
  build_options do |o|
146
- o.expand(:all).including(:environments, :content_views, :organizations)
146
+ o.expand(:all).including(:lifecycle_environments, :content_views, :organizations)
147
147
  end
148
148
 
149
149
  extend_with(HammerCLIKatello::CommandExtensions::LifecycleEnvironment.new)
@@ -157,7 +157,7 @@ module HammerCLIKatello
157
157
  failure_message _("Could not update the content view version")
158
158
 
159
159
  build_options do |o|
160
- o.expand(:all).including(:environments, :content_views, :organizations)
160
+ o.expand(:all).including(:lifecycle_environments, :content_views, :organizations)
161
161
  end
162
162
 
163
163
  extend_with(HammerCLIKatello::CommandExtensions::LifecycleEnvironment.new)
@@ -50,6 +50,12 @@ module HammerCLIKatello
50
50
  success_message _("Host collection created.")
51
51
  failure_message _("Could not create the host collection")
52
52
 
53
+ option "--unlimited-hosts", :flag, "Set hosts max to unlimited"
54
+
55
+ validate_options :before, 'IdResolution' do
56
+ all(:option_unlimited_hosts, :option_max_hosts).rejected
57
+ end
58
+
53
59
  build_options
54
60
  end
55
61
 
@@ -11,7 +11,7 @@ module HammerCLIKatello
11
11
  success_message _("Errata is being applied with task %{id}.")
12
12
  failure_message _("Could not apply errata")
13
13
 
14
- build_options
14
+ build_options(without: ['ids'])
15
15
 
16
16
  def execute
17
17
  warn "This command uses katello agent and will be removed in favor of remote execution " \
@@ -46,10 +46,9 @@ module HammerCLIKatello
46
46
  end
47
47
 
48
48
  class RecalculateCommand < HammerCLIKatello::SingleResourceCommand
49
- include HammerCLIForemanTasks::Async
50
49
  resource :host_errata, :applicability
51
50
  command_name "recalculate"
52
- success_message _("Errata recalculated with task %{id}.")
51
+ success_message _("Errata recalculation started.")
53
52
  failure_message _("Could not recalculate errata")
54
53
 
55
54
  build_options
@@ -3,23 +3,25 @@ require 'hammer_cli_katello/host_errata'
3
3
  require 'hammer_cli_katello/host_subscription'
4
4
  require 'hammer_cli_katello/host_package'
5
5
  require 'hammer_cli_katello/host_package_group'
6
- require 'hammer_cli_katello/host_kickstart_repository_options'
7
- require 'hammer_cli_katello/host_content_source_options'
8
6
  require 'hammer_cli_katello/host_traces'
9
7
 
10
8
  module HammerCLIKatello
11
9
  module HostExtensions
12
10
  ::HammerCLIForeman::Host::CreateCommand.instance_eval do
13
11
  include HammerCLIKatello::ResolverCommons
14
- include HammerCLIKatello::HostContentSourceOptions
15
- include ::HammerCLIKatello::HostKickstartRepositoryOptions
16
12
  end
13
+ ::HammerCLIForeman::Host::CreateCommand.extend_with(
14
+ HammerCLIKatello::CommandExtensions::ContentSource.new,
15
+ HammerCLIKatello::CommandExtensions::KickstartRepository.new
16
+ )
17
17
 
18
18
  ::HammerCLIForeman::Host::UpdateCommand.instance_eval do
19
19
  include HammerCLIKatello::ResolverCommons
20
- include HammerCLIKatello::HostContentSourceOptions
21
- include ::HammerCLIKatello::HostKickstartRepositoryOptions
22
20
  end
21
+ ::HammerCLIForeman::Host::UpdateCommand.extend_with(
22
+ HammerCLIKatello::CommandExtensions::ContentSource.new,
23
+ HammerCLIKatello::CommandExtensions::KickstartRepository.new
24
+ )
23
25
 
24
26
  ::HammerCLIForeman::Host::ListCommand.instance_eval do
25
27
  output do
@@ -1,16 +1,19 @@
1
1
  require 'hammer_cli_foreman/hostgroup'
2
- require 'hammer_cli_katello/host_kickstart_repository_options'
3
- require 'hammer_cli_katello/host_content_source_options'
4
2
 
5
3
  module HammerCLIKatello
6
4
  module QueryOrganizationOptions
7
5
  def self.included(base)
8
- base.option '--query-organization-id', 'ORGANIZATION_ID',
9
- _('Organization ID to search by'), attribute_name: :option_organization_id
10
- base.option '--query-organization', 'ORGANIZATION_NAME',
11
- _('Organization name to search by'), attribute_name: :option_organization_name
12
- base.option '--query-organization-label', 'ORGANIZATION_LABEL',
13
- _('Organization label to search by'), attribute_name: :option_organization_label
6
+ base.option_family do
7
+ parent '--query-organization-id', 'ORGANIZATION_ID',
8
+ _('Organization ID to search by'),
9
+ attribute_name: :option_organization_id
10
+ child '--query-organization', 'ORGANIZATION_NAME',
11
+ _('Organization name to search by'),
12
+ attribute_name: :option_organization_name
13
+ child '--query-organization-label', 'ORGANIZATION_LABEL',
14
+ _('Organization label to search by'),
15
+ attribute_name: :option_organization_label
16
+ end
14
17
 
15
18
  base.validate_options :before, 'IdResolution' do
16
19
  organization_options = [
@@ -30,17 +33,21 @@ module HammerCLIKatello
30
33
  include HammerCLIKatello::ResolverCommons
31
34
  include HammerCLIKatello::ContentViewNameResolvable
32
35
  include HammerCLIKatello::QueryOrganizationOptions
33
- include HammerCLIKatello::HostContentSourceOptions
34
- include HammerCLIKatello::HostKickstartRepositoryOptions
35
36
  end
37
+ ::HammerCLIForeman::Hostgroup::CreateCommand.extend_with(
38
+ HammerCLIKatello::CommandExtensions::ContentSource.new,
39
+ HammerCLIKatello::CommandExtensions::KickstartRepository.new
40
+ )
36
41
 
37
42
  ::HammerCLIForeman::Hostgroup::UpdateCommand.instance_eval do
38
43
  include HammerCLIKatello::ResolverCommons
39
44
  include HammerCLIKatello::ContentViewNameResolvable
40
45
  include HammerCLIKatello::QueryOrganizationOptions
41
- include HammerCLIKatello::HostContentSourceOptions
42
- include HammerCLIKatello::HostKickstartRepositoryOptions
43
46
  end
47
+ ::HammerCLIForeman::Hostgroup::UpdateCommand.extend_with(
48
+ HammerCLIKatello::CommandExtensions::ContentSource.new,
49
+ HammerCLIKatello::CommandExtensions::KickstartRepository.new
50
+ )
44
51
 
45
52
  ::HammerCLIForeman::Hostgroup::InfoCommand.instance_eval do
46
53
  output do
@@ -74,12 +74,15 @@ module HammerCLIKatello
74
74
  return options['option_lifecycle_environment_ids']
75
75
  end
76
76
 
77
- key_names = HammerCLI.option_accessor_name 'lifecycle_environment_names'
77
+ names = options[HammerCLI.option_accessor_name('lifecycle_environment_names')] ||
78
+ options[HammerCLI.option_accessor_name('environment_names')] ||
79
+ options[HammerCLI.option_accessor_name('names')]
78
80
  key_organization_id = HammerCLI.option_accessor_name 'organization_id'
79
81
  options[key_organization_id] ||= organization_id(scoped_options('organization', options))
80
82
 
83
+ options['option_lifecycle_environment_names'] = names
81
84
  find_resources(:lifecycle_environments, options)
82
- .select { |repo| options[key_names].include? repo['name'] }.map { |repo| repo['id'] }
85
+ .select { |repo| names.include? repo['name'] }.map { |repo| repo['id'] }
83
86
  end
84
87
 
85
88
  def repository_id(options)
@@ -6,15 +6,52 @@ module HammerCLIKatello
6
6
  end
7
7
 
8
8
  def get_options(_defined_options, result)
9
+ legacy_option_id(result)
10
+ legacy_option_ids(result)
11
+ ensure_option_id(result)
12
+ ensure_option_ids(result)
13
+ result
14
+ end
15
+
16
+ private
17
+
18
+ def lifecycle_environment_resource_name
19
+ (HammerCLIForeman.param_to_resource('environment') ||
20
+ HammerCLIForeman.param_to_resource('lifecycle_environment')).singular_name
21
+ end
22
+
23
+ def legacy_option_id(result)
9
24
  if result['option_environment_name'] && result['option_environment_id'].nil?
10
25
  result['option_environment_id'] = @command.resolver.lifecycle_environment_id(
11
- @command.resolver.scoped_options('environment', result, :single))
26
+ @command.resolver.scoped_options(lifecycle_environment_resource_name, result, :single))
12
27
  end
28
+ end
29
+
30
+ def legacy_option_ids(result)
13
31
  if result['option_environment_names'] && result['option_environment_ids'].nil?
14
32
  result['option_environment_ids'] = @command.resolver.lifecycle_environment_ids(
15
- @command.resolver.scoped_options('environment', result, :multi))
33
+ @command.resolver.scoped_options(lifecycle_environment_resource_name, result, :multi))
34
+ end
35
+ end
36
+
37
+ def ensure_option_id(result)
38
+ if result['option_environment_id'].nil? && result['option_lifecycle_environment_name']
39
+ id = @command.resolver.lifecycle_environment_id(
40
+ @command.resolver.scoped_options(lifecycle_environment_resource_name, result, :single)
41
+ )
42
+ result['option_environment_id'] = id
43
+ result['option_lifecycle_environment_id'] = id
44
+ end
45
+ end
46
+
47
+ def ensure_option_ids(result)
48
+ if result['option_environment_ids'].nil? && result['option_lifecycle_environment_names']
49
+ ids = @command.resolver.lifecycle_environment_ids(
50
+ @command.resolver.scoped_options(lifecycle_environment_resource_name, result, :multi)
51
+ )
52
+ result['option_environment_ids'] = ids
53
+ result['option_lifecycle_environment_ids'] = ids
16
54
  end
17
- result
18
55
  end
19
56
  end
20
57
  end
@@ -20,9 +20,17 @@ module HammerCLIKatello
20
20
  output do
21
21
  field :label, _("Label")
22
22
  field :description, _("Description")
23
- field :redhat_repository_url, _("Red Hat Repository URL")
24
23
  field :simple_content_access_label, _("Simple Content Access")
25
24
  field :service_levels, _("Service Levels"), Fields::List
25
+ from :cdn_configuration do
26
+ label "CDN configuration", hide_blank: true do
27
+ field :url, _("URL"), Fields::Field, hide_blank: true
28
+ field :upstream_organization_label, _("Upstream Organization"),
29
+ Fields::Field, hide_blank: true
30
+ field :username, _("Username"), Fields::Field, hide_blank: true
31
+ field :ssl_ca_credential_id, _("SSL CA Credential ID"), Fields::Field, hide_blank: true
32
+ end
33
+ end
26
34
  end
27
35
 
28
36
  def extend_data(data)
@@ -44,7 +52,9 @@ module HammerCLIKatello
44
52
  success_message _("Organization updated.")
45
53
  failure_message _("Could not update the organization")
46
54
 
47
- build_options
55
+ build_options do |o|
56
+ o.expand(:all).except(:environments)
57
+ end
48
58
  end
49
59
 
50
60
  class CreateCommand < HammerCLIForeman::Organization::CreateCommand
@@ -54,7 +64,9 @@ module HammerCLIKatello
54
64
  success_message _("Organization created.")
55
65
  failure_message _("Could not create the organization")
56
66
 
57
- build_options
67
+ build_options do |o|
68
+ o.expand(:all).except(:environments)
69
+ end
58
70
  end
59
71
 
60
72
  class DeleteCommand < HammerCLIForeman::Organization::DeleteCommand
@@ -68,6 +80,19 @@ module HammerCLIKatello
68
80
  build_options
69
81
  end
70
82
 
83
+ class ConfigureCdnCommand < HammerCLIKatello::SingleResourceCommand
84
+ include HammerCLIKatello::ResolverCommons
85
+ resource :organizations, :cdn_configuration
86
+ command_name "configure-cdn"
87
+ success_message _("Updated CDN configuration.")
88
+ failure_message _("Could not update CDN configuration.")
89
+
90
+ build_options do |o|
91
+ o.expand(:all).except(:organizations, :locations)
92
+ o.without(:organization_id, :location_id)
93
+ end
94
+ end
95
+
71
96
  autoload_subcommands
72
97
  end
73
98
  end
@@ -3,7 +3,6 @@ module HammerCLIKatello
3
3
  resource :packages
4
4
 
5
5
  class ListCommand < HammerCLIKatello::ListCommand
6
- extend_with(HammerCLIKatello::CommandExtensions::LifecycleEnvironment.new)
7
6
  include LifecycleEnvironmentNameMapping
8
7
 
9
8
  output do
@@ -40,6 +39,8 @@ module HammerCLIKatello
40
39
  build_options do |o|
41
40
  o.expand.including(:products, :content_views)
42
41
  end
42
+
43
+ extend_with(HammerCLIKatello::CommandExtensions::LifecycleEnvironment.new)
43
44
  end
44
45
 
45
46
  class InfoCommand < HammerCLIKatello::InfoCommand
@@ -51,6 +51,13 @@ module HammerCLIKatello
51
51
  end
52
52
  end
53
53
 
54
+ label "pulp3_content", :hide_blank => true do
55
+ from "pulp3_content" do
56
+ field "status", _("Status"), Fields::Field, :hide_blank => true
57
+ field "_response", _("Server Response"), Fields::Field, :hide_blank => true
58
+ end
59
+ end
60
+
54
61
  label "foreman_tasks" do
55
62
  from "foreman_tasks" do
56
63
  field "status", _("Status")
@@ -62,10 +62,6 @@ module HammerCLIKatello
62
62
  field :full_path, _("Published At")
63
63
  field :relative_path, _("Relative Path")
64
64
  field :download_policy, _("Download Policy"), Fields::Field, :hide_blank => true
65
- field :ostree_upstream_sync_policy, _("OSTree Upstream Sync Policy"),
66
- Fields::Field, :hide_blank => true
67
- field :_ostree_upstream_sync_depth, _("OSTree Upstream Sync Depth"),
68
- Fields::Field, :hide_blank => true
69
65
  field :docker_upstream_name, _("Upstream Repository Name"),
70
66
  Fields::Field, :hide_blank => true
71
67
  field :docker_tags_whitelist, _("Container Image Tags Filter"),
@@ -114,7 +110,6 @@ module HammerCLIKatello
114
110
  field :docker_manifest_total, _("Container Image Manifests"), Fields::Field,
115
111
  :hide_blank => true
116
112
  field :docker_tag_total, _("Container Image Tags"), Fields::Field, :hide_blank => true
117
- field :ostree_branch_total, _("OSTree Branches"), Fields::Field, :hide_blank => true
118
113
  field :file_total, _("Files"), Fields::Field, :hide_blank => true
119
114
  field :module_stream_total, _("Module Streams"), Fields::Field, :hide_blank => true
120
115
  end
@@ -163,21 +158,11 @@ module HammerCLIKatello
163
158
  data["docker_manifest_list_total"] = content_counts["docker_manifest_list"]
164
159
  data["docker_manifest_total"] = content_counts["docker_manifest"]
165
160
  data["docker_tag_total"] = content_counts["docker_tag"]
166
- when "ostree"
167
- setup_ostree(data)
168
161
  when "file"
169
162
  data["file_total"] = content_counts["file"]
170
163
  end
171
164
  end
172
165
 
173
- def setup_ostree(data)
174
- content_counts = data["content_counts"]
175
- data["ostree_branch_total"] = content_counts["ostree_branch"]
176
- if data["ostree_upstream_sync_policy"] == "custom"
177
- data["_ostree_upstream_sync_depth"] = data["ostree_upstream_sync_depth"]
178
- end
179
- end
180
-
181
166
  def get_sync_status(state)
182
167
  sync_states = {
183
168
  "failed" => _("Failed"), "success" => _("Success"), "finished" => _("Finished"),
@@ -403,6 +388,12 @@ module HammerCLIKatello
403
388
  build_options(:without => [:content]) do |o|
404
389
  o.expand.including(:products, :organizations)
405
390
  end
391
+
392
+ option "--ostree-repository-name", "OSTREE REPOSITORY NAME",
393
+ _("Name of OSTree repository in archive."),
394
+ :attribute_name => :option_ostree_repository_name,
395
+ :required => false
396
+
406
397
  option "--path", "PATH", _("Upload file, directory of files, or glob of files " \
407
398
  "as content for a repository.\n" \
408
399
  "Globs must be escaped by single or double quotes"),
@@ -423,6 +414,7 @@ module HammerCLIKatello
423
414
  repo_id = get_identifier
424
415
  update_content_upload(upload_id, repo_id, file)
425
416
  end
417
+ opts[:ostree_repository_name] = options["option_ostree_repository_name"]
426
418
  results = import_uploads([
427
419
  {
428
420
  id: upload_id,
@@ -479,6 +471,9 @@ module HammerCLIKatello
479
471
  sync_capsule: sync_capsule
480
472
  }
481
473
  params[:content_type] = options["option_content_type"] if options["option_content_type"]
474
+ if options["option_ostree_repository_name"]
475
+ params[:ostree_repository_name] = options["option_ostree_repository_name"]
476
+ end
482
477
  resource.call(:import_uploads, params)
483
478
  end
484
479
 
@@ -541,33 +536,6 @@ module HammerCLIKatello
541
536
  end
542
537
  end
543
538
 
544
- class ExportCommand < HammerCLIKatello::SingleResourceCommand
545
- include HammerCLIForemanTasks::Async
546
- include OrganizationOptions
547
- extend RepositoryScopedToProduct
548
-
549
- validate_repo_name_requires_product_options
550
- action :export
551
- command_name "export"
552
- desc _("Export content from a repository to the configured directory")
553
-
554
- success_message _("Repository is being exported in task %{id}.")
555
- failure_message _("Could not export the repository")
556
-
557
- validate_options :before, 'IdResolution' do
558
- organization_options = [:option_organization_id, :option_organization_name, \
559
- :option_organization_label]
560
-
561
- if option(:option_product_name).exist?
562
- any(*organization_options).required
563
- end
564
- end
565
-
566
- build_options do |o|
567
- o.expand.including(:products)
568
- end
569
- end
570
-
571
539
  autoload_subcommands
572
540
  end
573
541
  end