hammer_cli_katello 0.0.26 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hammer_cli_katello/activation_key.rb +23 -43
  3. data/lib/hammer_cli_katello/associating_commands.rb +3 -5
  4. data/lib/hammer_cli_katello/capsule.rb +1 -3
  5. data/lib/hammer_cli_katello/commands.rb +1 -7
  6. data/lib/hammer_cli_katello/content_view.rb +6 -3
  7. data/lib/hammer_cli_katello/content_view_name_resolvable.rb +21 -0
  8. data/lib/hammer_cli_katello/content_view_puppet_module.rb +11 -7
  9. data/lib/hammer_cli_katello/content_view_version.rb +30 -29
  10. data/lib/hammer_cli_katello/erratum.rb +0 -1
  11. data/lib/hammer_cli_katello/exception_handler.rb +0 -2
  12. data/lib/hammer_cli_katello/filter.rb +11 -3
  13. data/lib/hammer_cli_katello/filter_rule.rb +8 -2
  14. data/lib/hammer_cli_katello/foreman_search_options_creators.rb +71 -0
  15. data/lib/hammer_cli_katello/gpg_key.rb +0 -5
  16. data/lib/hammer_cli_katello/host.rb +1 -0
  17. data/lib/hammer_cli_katello/host_collection.rb +48 -16
  18. data/lib/hammer_cli_katello/host_errata.rb +0 -1
  19. data/lib/hammer_cli_katello/host_extensions.rb +56 -0
  20. data/lib/hammer_cli_katello/host_package.rb +0 -3
  21. data/lib/hammer_cli_katello/host_package_group.rb +0 -3
  22. data/lib/hammer_cli_katello/host_subscription.rb +67 -1
  23. data/lib/hammer_cli_katello/hostgroup.rb +2 -0
  24. data/lib/hammer_cli_katello/hostgroup_extensions.rb +48 -0
  25. data/lib/hammer_cli_katello/i18n.rb +0 -3
  26. data/lib/hammer_cli_katello/id_resolver.rb +25 -16
  27. data/lib/hammer_cli_katello/katello_environment_name_resolvable.rb +4 -3
  28. data/lib/hammer_cli_katello/lifecycle_environment.rb +0 -3
  29. data/lib/hammer_cli_katello/lifecycle_environment_name_resolvable.rb +4 -3
  30. data/lib/hammer_cli_katello/organization.rb +0 -3
  31. data/lib/hammer_cli_katello/organization_options.rb +12 -0
  32. data/lib/hammer_cli_katello/ostree_branch.rb +0 -1
  33. data/lib/hammer_cli_katello/output/fields.rb +0 -2
  34. data/lib/hammer_cli_katello/output/formatters.rb +0 -4
  35. data/lib/hammer_cli_katello/package.rb +0 -1
  36. data/lib/hammer_cli_katello/package_group.rb +0 -1
  37. data/lib/hammer_cli_katello/ping.rb +0 -6
  38. data/lib/hammer_cli_katello/product.rb +1 -7
  39. data/lib/hammer_cli_katello/puppet_module.rb +0 -1
  40. data/lib/hammer_cli_katello/repository.rb +36 -35
  41. data/lib/hammer_cli_katello/repository_scoped_to_product.rb +0 -4
  42. data/lib/hammer_cli_katello/repository_set.rb +0 -3
  43. data/lib/hammer_cli_katello/search_options_creators.rb +40 -18
  44. data/lib/hammer_cli_katello/subscription.rb +20 -13
  45. data/lib/hammer_cli_katello/sync_plan.rb +4 -8
  46. data/lib/hammer_cli_katello/version.rb +1 -1
  47. data/lib/hammer_cli_katello.rb +21 -26
  48. data/test/data/3.0/foreman_api.json +1 -1
  49. data/test/data/3.2/foreman_api.json +1 -0
  50. data/test/data/Readme.md +5 -0
  51. data/test/functional/activaton_key/add_host_collection_test.rb +62 -0
  52. data/test/functional/activaton_key/create_test.rb +33 -0
  53. data/test/functional/activaton_key/list_test.rb +15 -16
  54. data/test/functional/activaton_key/product_content_test.rb +23 -0
  55. data/test/functional/activaton_key/remove_host_collection_test.rb +62 -0
  56. data/test/functional/activaton_key/subscriptions_test.rb +57 -0
  57. data/test/functional/activaton_key/update_test.rb +26 -0
  58. data/test/functional/capsule/content/cancel_synchronization_test.rb +1 -1
  59. data/test/functional/capsule/content/capsule_content_helpers.rb +0 -2
  60. data/test/functional/content_view/add_content_view_version_test.rb +34 -0
  61. data/test/functional/content_view/add_repository_test.rb +20 -0
  62. data/test/functional/content_view/content_view_helpers.rb +0 -2
  63. data/test/functional/content_view/create_test.rb +3 -3
  64. data/test/functional/content_view/filter/create_test.rb +63 -0
  65. data/test/functional/content_view/list_test.rb +23 -20
  66. data/test/functional/content_view/publish_test.rb +23 -0
  67. data/test/functional/content_view/puppet_module/add_test.rb +23 -0
  68. data/test/functional/content_view/remove_content_view_version_test.rb +34 -0
  69. data/test/functional/content_view/version/incremental_update_test.rb +4 -4
  70. data/test/functional/content_view/version/list_test.rb +44 -0
  71. data/test/functional/content_view/version/promote_test.rb +35 -0
  72. data/test/functional/filter_rule/create_test.rb +20 -0
  73. data/test/functional/host/errata/apply_test.rb +5 -4
  74. data/test/functional/host/extensions/data/host.json +310 -0
  75. data/test/functional/host/extensions/data/host_list.json +115 -0
  76. data/test/functional/host/extensions/info_test.rb +27 -0
  77. data/test/functional/host/extensions/list_test.rb +21 -0
  78. data/test/functional/host/host_helpers.rb +0 -2
  79. data/test/functional/host/subscription/attach_test.rb +54 -0
  80. data/test/functional/host/subscription/auto_attach_test.rb +35 -0
  81. data/test/functional/host/subscription/register_test.rb +2 -2
  82. data/test/functional/host/subscription/remove_test.rb +52 -0
  83. data/test/functional/host_collection/add_host_test.rb +57 -0
  84. data/test/functional/host_collection/copy_test.rb +64 -0
  85. data/test/functional/host_collection/create_test.rb +43 -0
  86. data/test/functional/host_collection/delete_test.rb +57 -0
  87. data/test/functional/host_collection/hosts_test.rb +40 -0
  88. data/test/functional/host_collection/info_test.rb +57 -0
  89. data/test/functional/host_collection/list_test.rb +42 -0
  90. data/test/functional/host_collection/remove_host_test.rb +57 -0
  91. data/test/functional/host_collection/update_test.rb +57 -0
  92. data/test/functional/hostgroup/create_test.rb +55 -0
  93. data/test/functional/hostgroup/data/hostgroup.json +48 -0
  94. data/test/functional/hostgroup/info_test.rb +30 -0
  95. data/test/functional/hostgroup/update_test.rb +55 -0
  96. data/test/functional/lifecycle_environment/lifecycle_environment_helpers.rb +0 -2
  97. data/test/functional/organization/organization_helpers.rb +0 -2
  98. data/test/functional/product/create_test.rb +54 -0
  99. data/test/functional/product/delete_test.rb +41 -0
  100. data/test/functional/product/info_test.rb +33 -0
  101. data/test/functional/product/list_test.rb +58 -0
  102. data/test/functional/product/product_helpers.rb +14 -0
  103. data/test/functional/product/remove_sync_plan_test.rb +35 -0
  104. data/test/functional/product/set_sync_plan_test.rb +49 -0
  105. data/test/functional/product/update_test.rb +46 -0
  106. data/test/functional/repository/info_test.rb +3 -3
  107. data/test/functional/repository/list_test.rb +14 -13
  108. data/test/functional/repository/remove_content_test.rb +18 -0
  109. data/test/functional/repository/repository_helpers.rb +9 -3
  110. data/test/functional/repository/synchronize_test.rb +3 -3
  111. data/test/functional/repository/upload_test.rb +17 -5
  112. data/test/functional/subscription/list_test.rb +92 -0
  113. data/test/functional/sync_plan/sync_plan_helpers.rb +8 -0
  114. data/test/test_helper.rb +3 -3
  115. data/test/unit/id_resolver_test.rb +17 -2
  116. data/test/unit/search_options_creators_test.rb +49 -12
  117. metadata +105 -7
  118. data/lib/hammer_cli_katello/content_host.rb +0 -111
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e094dd1b1cbbc1c14a8aa39a773badfd770b499
4
- data.tar.gz: e9dd8acdc70caf2175484ca6a73dc743290a30f5
3
+ metadata.gz: fba3fe5b5ff30bffe68b77824669b9d143c2d7ab
4
+ data.tar.gz: e6a5a233359eba0135cef5f1d7b45ef48839c9d2
5
5
  SHA512:
6
- metadata.gz: 271de1290be8859f53ad703779871275f9660ce673e969ac1f3b3f4a2ef9b520be07a33e667c94826cf49e1023fe624fca2607dcb2cdb1ad01a0a5812c0e47ac
7
- data.tar.gz: 8a767ae4de73c88592816a683a43c26358d3ba99ded850a6c5ef7a26ac5767520514cec1c6f6963cf9e8568fefe2bdda6345760803de14165061b7c5ed2e446c
6
+ metadata.gz: efe03d7b7ac938789b3449168a83704b23ff2232db7dac164c6404907ea1f20f5506cd1a96b300059558798d50ba1cfaa155546c5259f805c86c2a177de68a06
7
+ data.tar.gz: ad45ddc94638fce64c602bee4e3c6c0a14c0216d6d98ec639c5f622d3d253372abcd9d211d0288c55e050a005e2e52752577b38a36d106d890b8fb3f7d47b6fe
@@ -1,5 +1,4 @@
1
1
  module HammerCLIKatello
2
-
3
2
  class ActivationKeyCommand < HammerCLIKatello::Command
4
3
  resource :activation_keys
5
4
 
@@ -20,11 +19,13 @@ module HammerCLIKatello
20
19
  end
21
20
 
22
21
  def extend_data(data)
22
+ limit = data["unlimited_hosts"] ? _("Unlimited") : data["max_hosts"]
23
+
23
24
  data["format_consumed"] = _("%{consumed} of %{limit}") %
24
- {
25
- :consumed => data["usage_count"],
26
- :limit => data["unlimited_hosts"] ? _("Unlimited") : data["max_hosts"]
27
- }
25
+ {
26
+ :consumed => data["usage_count"],
27
+ :limit => limit
28
+ }
28
29
  data
29
30
  end
30
31
 
@@ -39,7 +40,8 @@ module HammerCLIKatello
39
40
  params = super
40
41
  if options.keys.any? { |o| o.match(/\Aoption_organization.*/) }
41
42
  params['organization_id'] = resolver.organization_id(
42
- resolver.scoped_options('organization', all_options))
43
+ resolver.scoped_options('organization', all_options)
44
+ )
43
45
  end
44
46
  params
45
47
  end
@@ -141,37 +143,16 @@ module HammerCLIKatello
141
143
  field :account_number, _("Account")
142
144
  end
143
145
 
144
- def extend_data(data)
145
- data["format_consumed"] = _("%{consumed} of %{limit}") %
146
- {
147
- :consumed => data["consumed"],
148
- :limit => data["quantity"] == -1 ? _("Unlimited") : data["quantity"]
149
- }
150
- data
151
- end
152
-
153
- option "--id", "ID", _("ID of activation key"),
154
- :attribute_name => :option_activation_key_id
155
- option "--name", "NAME", _("Name of activation key"),
156
- :attribute_name => :option_activation_key_name
146
+ option '--id', "ACTIVATION_KEY_ID", _("ID of the activation key"),
147
+ attribute_name: :option_activation_key_id
148
+ option '--name', "ACTIVATION_KEY_NAME", _("Activation key name to search by"),
149
+ attribute_name: :option_activation_key_name
157
150
 
158
151
  validate_options do
159
152
  any(:option_activation_key_id, :option_activation_key_name).required
160
153
  end
161
154
 
162
- build_options do |o|
163
- o.expand.only(:organizations)
164
- o.without(
165
- :system_id,
166
- :activation_key_id,
167
- :full_results,
168
- :search,
169
- :order,
170
- :sort,
171
- :page,
172
- :per_page
173
- )
174
- end
155
+ build_options
175
156
  end
176
157
 
177
158
  class AddSubscriptionsCommand < HammerCLIKatello::SingleResourceCommand
@@ -225,7 +206,8 @@ module HammerCLIKatello
225
206
  field :gpgUrl, _("GPG Key")
226
207
  field :label, _("Label")
227
208
  end
228
- field :override, _("Enabled?")
209
+ field :enabled, _("Enabled?"), Fields::Boolean
210
+ field :override, _("Override")
229
211
  end
230
212
 
231
213
  build_options
@@ -266,15 +248,14 @@ module HammerCLIKatello
266
248
  build_options do |o|
267
249
  o.expand.only(:organizations)
268
250
  o.without(
269
- :system_id,
270
- :activation_key_id,
271
- :full_results,
272
- :search,
273
- :order,
274
- :sort,
275
- :page,
276
- :per_page
277
- )
251
+ :activation_key_id,
252
+ :full_results,
253
+ :search,
254
+ :order,
255
+ :sort,
256
+ :page,
257
+ :per_page
258
+ )
278
259
  end
279
260
  end
280
261
 
@@ -282,5 +263,4 @@ module HammerCLIKatello
282
263
 
283
264
  autoload_subcommands
284
265
  end
285
-
286
266
  end
@@ -1,6 +1,5 @@
1
1
  module HammerCLIKatello
2
2
  module AssociatingCommands
3
-
4
3
  module Repository
5
4
  module AddProductOptions
6
5
  def dependencies
@@ -14,7 +13,7 @@ module HammerCLIKatello
14
13
  products = dependencies.find { |r| r.name == :products }
15
14
  if products
16
15
  option_builder.builders << HammerCLIForeman::DependentSearchablesOptionBuilder.new(
17
- products, searchables)
16
+ products, searchables)
18
17
  end
19
18
  end
20
19
  end
@@ -25,6 +24,7 @@ module HammerCLIKatello
25
24
  class AddRepositoryCommand < HammerCLIKatello::AddAssociatedCommand
26
25
  extend AddProductOptions
27
26
  include RepositoryScopedToProduct
27
+ include OrganizationOptions
28
28
  command_name 'add-repository'
29
29
  associated_resource :repositories
30
30
 
@@ -40,6 +40,7 @@ module HammerCLIKatello
40
40
  class RemoveRepositoryCommand < HammerCLIKatello::RemoveAssociatedCommand
41
41
  extend AddProductOptions
42
42
  include RepositoryScopedToProduct
43
+ include OrganizationOptions
43
44
  command_name 'remove-repository'
44
45
  associated_resource :repositories
45
46
 
@@ -51,7 +52,6 @@ module HammerCLIKatello
51
52
  success_message _("The repository has been removed")
52
53
  failure_message _("Could not remove repository")
53
54
  end
54
-
55
55
  end
56
56
 
57
57
  module HostCollection
@@ -72,7 +72,6 @@ module HammerCLIKatello
72
72
  success_message _("The host collection has been removed")
73
73
  failure_message _("Could not remove host collection")
74
74
  end
75
-
76
75
  end
77
76
 
78
77
  module Host
@@ -93,7 +92,6 @@ module HammerCLIKatello
93
92
  success_message _("The host has been removed")
94
93
  failure_message _("Could not remove host")
95
94
  end
96
-
97
95
  end
98
96
  end
99
97
  end
@@ -18,7 +18,6 @@ module HammerCLIKatello
18
18
  from :organization do
19
19
  field :name, _("Organization")
20
20
  end
21
-
22
21
  end
23
22
 
24
23
  build_options
@@ -34,7 +33,6 @@ module HammerCLIKatello
34
33
  from :organization do
35
34
  field :name, _("Organization")
36
35
  end
37
-
38
36
  end
39
37
 
40
38
  build_options
@@ -114,7 +112,7 @@ module HammerCLIKatello
114
112
  data['_last_failure'] = data["last_failed_sync_tasks"][-1]
115
113
 
116
114
  data["active_sync_tasks"].each do |task|
117
- task['_progress'] = format_progress(task['progress'])
115
+ task['_progress'] = format_progress(task['progress'])
118
116
  end
119
117
  data
120
118
  end
@@ -1,17 +1,12 @@
1
1
  module HammerCLIKatello
2
-
3
- RESOURCE_NAME_MAPPING = {
4
- :system => :content_host
5
- }.freeze
2
+ RESOURCE_NAME_MAPPING = {}.freeze
6
3
 
7
4
  module ResolverCommons
8
-
9
5
  def self.included(base)
10
6
  base.extend(ClassMethods)
11
7
  end
12
8
 
13
9
  module ClassMethods
14
-
15
10
  def resolver
16
11
  api = HammerCLI::Connection.get("foreman").api
17
12
  HammerCLIKatello::IdResolver.new(api, HammerCLIKatello::Searchables.new)
@@ -25,7 +20,6 @@ module HammerCLIKatello
25
20
  def resource_name_mapping
26
21
  HammerCLIKatello::RESOURCE_NAME_MAPPING.dup
27
22
  end
28
-
29
23
  end
30
24
  end
31
25
 
@@ -3,7 +3,6 @@ require 'hammer_cli_katello/filter'
3
3
  require 'hammer_cli_katello/content_view_version'
4
4
 
5
5
  module HammerCLIKatello
6
-
7
6
  class ContentView < HammerCLIKatello::Command
8
7
  resource :content_views
9
8
 
@@ -14,6 +13,7 @@ module HammerCLIKatello
14
13
  field :name, _("Name")
15
14
  field :label, _("Label")
16
15
  field :composite, _("Composite")
16
+ field :last_published, _("Last Published"), Fields::Date, :hide_blank => true
17
17
  field :repository_ids, _("Repository IDs"), Fields::List
18
18
  end
19
19
 
@@ -21,6 +21,8 @@ module HammerCLIKatello
21
21
  end
22
22
 
23
23
  class InfoCommand < HammerCLIKatello::InfoCommand
24
+ include OrganizationOptions
25
+
24
26
  output do
25
27
  field :id, _("ID")
26
28
  field :name, _("Name")
@@ -56,8 +58,6 @@ module HammerCLIKatello
56
58
  field :uuid, _("UUID"), Fields::Field, :hide_blank => true
57
59
  field :name, _("Name")
58
60
  field :author, _("Author")
59
- field :created_at, _("Created"), Fields::Date
60
- field :updated_at, _("Updated"), Fields::Date
61
61
  end
62
62
 
63
63
  collection :environments, _("Lifecycle Environments") do
@@ -157,6 +157,7 @@ module HammerCLIKatello
157
157
 
158
158
  class PublishCommand < HammerCLIKatello::SingleResourceCommand
159
159
  include HammerCLIForemanTasks::Async
160
+ include OrganizationOptions
160
161
 
161
162
  action :publish
162
163
  command_name "publish"
@@ -170,6 +171,7 @@ module HammerCLIKatello
170
171
  class RemoveFromEnvironmentCommand < HammerCLIKatello::SingleResourceCommand
171
172
  include KatelloEnvironmentNameResolvable
172
173
  include HammerCLIForemanTasks::Async
174
+ include OrganizationOptions
173
175
 
174
176
  action :remove_from_environment
175
177
  command_name "remove-from-environment"
@@ -182,6 +184,7 @@ module HammerCLIKatello
182
184
 
183
185
  class RemoveCommand < HammerCLIKatello::SingleResourceCommand
184
186
  include HammerCLIForemanTasks::Async
187
+ include OrganizationOptions
185
188
 
186
189
  # command to remove content view environments and versions from a content view.
187
190
  # corresponds to the UI screen.
@@ -0,0 +1,21 @@
1
+ module HammerCLIKatello
2
+ module ContentViewNameResolvable
3
+ def content_view_resolve_options(options)
4
+ {
5
+ HammerCLI.option_accessor_name("name") => options['option_content_view_name'],
6
+ HammerCLI.option_accessor_name("organization_id") => options["option_organization_id"],
7
+ HammerCLI.option_accessor_name("organization_name") => options["option_organization_name"]
8
+ }
9
+ end
10
+
11
+ def all_options
12
+ result = super.clone
13
+ if result['option_content_view_name'] && result['option_content_view_id'].nil?
14
+ result['option_content_view_id'] = resolver.content_view_id(
15
+ content_view_resolve_options(result))
16
+ @all_options = result
17
+ end
18
+ result
19
+ end
20
+ end
21
+ end
@@ -1,12 +1,12 @@
1
1
  module HammerCLIKatello
2
-
3
2
  class ContentViewPuppetModule < HammerCLIKatello::Command
4
-
5
3
  resource :content_view_puppet_modules
6
4
  command_name 'puppet-module'
7
5
  desc 'View and manage puppet modules'
8
6
 
9
7
  class ListCommand < HammerCLIKatello::ListCommand
8
+ include OrganizationOptions
9
+
10
10
  output do
11
11
  field :uuid, _("UUID")
12
12
  field :name, _("Name")
@@ -15,11 +15,11 @@ module HammerCLIKatello
15
15
  end
16
16
 
17
17
  def extend_data(mod)
18
- if mod['uuid']
19
- mod['version'] = mod['computed_version']
20
- else
21
- mod['version'] = _("Latest(Currently %s)") % mod['computed_version']
22
- end
18
+ mod['version'] = if mod['uuid']
19
+ mod['computed_version']
20
+ else
21
+ _("Latest(Currently %s)") % mod['computed_version']
22
+ end
23
23
  mod
24
24
  end
25
25
 
@@ -27,6 +27,8 @@ module HammerCLIKatello
27
27
  end
28
28
 
29
29
  class CreateCommand < HammerCLIKatello::CreateCommand
30
+ include OrganizationOptions
31
+
30
32
  command_name "add"
31
33
 
32
34
  success_message _("Puppet module added to content view")
@@ -44,6 +46,8 @@ module HammerCLIKatello
44
46
  end
45
47
 
46
48
  class DeleteCommand < HammerCLIKatello::DeleteCommand
49
+ include OrganizationOptions
50
+
47
51
  command_name "remove"
48
52
 
49
53
  success_message _("Puppet module removed from content view")
@@ -1,5 +1,4 @@
1
1
  module HammerCLIKatello
2
-
3
2
  class ContentViewVersion < HammerCLIKatello::Command
4
3
  resource :content_view_versions
5
4
  command_name 'version'
@@ -24,6 +23,8 @@ module HammerCLIKatello
24
23
  end
25
24
 
26
25
  class InfoCommand < HammerCLIKatello::InfoCommand
26
+ resource :content_view_versions, :show
27
+
27
28
  output do
28
29
  field :id, _("ID")
29
30
  field :name, _("Name")
@@ -133,41 +134,41 @@ module HammerCLIKatello
133
134
  failure_message _("An error occurred incrementally updating the content view")
134
135
 
135
136
  option('--lifecycle-environment-ids',
136
- 'ENVIRONMENT_IDS',
137
- _("list of lifecycle environment IDs to update the content view version in"),
138
- :format => HammerCLI::Options::Normalizers::List.new
139
- )
137
+ 'ENVIRONMENT_IDS',
138
+ _("list of lifecycle environment IDs to update the content view version in"),
139
+ :format => HammerCLI::Options::Normalizers::List.new
140
+ )
140
141
 
141
142
  option('--lifecycle-environments',
142
- 'ENVIRONMENTS',
143
- _("list of lifecycle environment names to update the content view version in"),
144
- :format => HammerCLI::Options::Normalizers::List.new,
145
- :attribute_name => :option_lifecycle_environment_names
146
- )
143
+ 'ENVIRONMENTS',
144
+ _("list of lifecycle environment names to update the content view version in"),
145
+ :format => HammerCLI::Options::Normalizers::List.new,
146
+ :attribute_name => :option_lifecycle_environment_names
147
+ )
147
148
 
148
149
  option('--organization',
149
- 'ORGANIZATION_NAME',
150
- _("Organization name for resolving lifecycle environment names"),
151
- :attribute_name => :option_organization_name
152
- )
150
+ 'ORGANIZATION_NAME',
151
+ _("Organization name for resolving lifecycle environment names"),
152
+ :attribute_name => :option_organization_name
153
+ )
153
154
 
154
155
  option('--organization-id',
155
- 'ORGANIZATION_ID',
156
- _("Organization id for resolving lifecycle environment names")
157
- )
156
+ 'ORGANIZATION_ID',
157
+ _("Organization id for resolving lifecycle environment names")
158
+ )
158
159
 
159
160
  option('--update-all-hosts',
160
- 'UPDATE',
161
- _('Update all editable and applicable hosts within the specified Content View and \
162
- Lifecycle Environments'),
163
- :format => HammerCLI::Options::Normalizers::Bool.new
164
- )
161
+ 'UPDATE',
162
+ _('Update all editable and applicable hosts within the specified Content View and \
163
+ Lifecycle Environments'),
164
+ :format => HammerCLI::Options::Normalizers::Bool.new
165
+ )
165
166
 
166
167
  option('--host-ids',
167
- 'HOST_IDS',
168
- _("IDs of hosts to update"),
169
- :format => HammerCLI::Options::Normalizers::List.new
170
- )
168
+ 'HOST_IDS',
169
+ _("IDs of hosts to update"),
170
+ :format => HammerCLI::Options::Normalizers::List.new
171
+ )
171
172
 
172
173
  validate_options do
173
174
  organization_options = [:option_organization_id, :option_organization_name]
@@ -191,9 +192,9 @@ module HammerCLIKatello
191
192
  ]
192
193
 
193
194
  if options.key?(HammerCLI.option_accessor_name(:lifecycle_environment_names)) ||
194
- options.key?(HammerCLI.option_accessor_name(:lifecycle_environment_ids))
195
+ options.key?(HammerCLI.option_accessor_name(:lifecycle_environment_ids))
195
196
  params[:content_view_version_environments][0][:environment_ids] =
196
- resolver.environment_ids(options)
197
+ resolver.environment_ids(options)
197
198
  end
198
199
 
199
200
  add_content = {}
@@ -210,7 +211,7 @@ module HammerCLIKatello
210
211
 
211
212
  def request_params_hosts(params)
212
213
  if params['update_hosts'] && params['update_hosts']['included'] &&
213
- params['update_hosts']['included'].key?('ids')
214
+ params['update_hosts']['included'].key?('ids')
214
215
  params['update_hosts'].delete('excluded')
215
216
  else
216
217
  params.delete('update_hosts')
@@ -1,5 +1,4 @@
1
1
  module HammerCLIKatello
2
-
3
2
  class ErratumCommand < HammerCLIKatello::Command
4
3
  resource :errata
5
4
 
@@ -1,7 +1,6 @@
1
1
 
2
2
  module HammerCLIKatello
3
3
  class ExceptionHandler < HammerCLIForeman::ExceptionHandler
4
-
5
4
  def mappings
6
5
  super + [
7
6
  [RestClient::InternalServerError, :handle_internal_error],
@@ -41,6 +40,5 @@ module HammerCLIKatello
41
40
  print_error response["displayMessage"] || response["full_messages"] || response["message"]
42
41
  log_full_error e
43
42
  end
44
-
45
43
  end
46
44
  end
@@ -1,9 +1,7 @@
1
1
  require 'hammer_cli_katello/filter_rule'
2
2
 
3
3
  module HammerCLIKatello
4
-
5
4
  class Filter < HammerCLIKatello::Command
6
-
7
5
  resource :content_view_filters
8
6
  command_name 'filter'
9
7
  desc 'View and manage filters'
@@ -52,9 +50,20 @@ module HammerCLIKatello
52
50
  end
53
51
 
54
52
  class CreateCommand < HammerCLIKatello::CreateCommand
53
+ include OrganizationOptions
54
+
55
55
  success_message _("Filter created")
56
56
  failure_message _("Could not create the filter")
57
57
 
58
+ validate_options do
59
+ organization_options = [:option_organization_id, :option_organization_name, \
60
+ :option_organization_label]
61
+
62
+ if option(:option_repository_names).exist? || option(:option_content_view_name).exist?
63
+ any(*organization_options).required
64
+ end
65
+ end
66
+
58
67
  build_options
59
68
  end
60
69
 
@@ -79,6 +88,5 @@ module HammerCLIKatello
79
88
  subcommand HammerCLIKatello::FilterRule.command_name,
80
89
  HammerCLIKatello::FilterRule.desc,
81
90
  HammerCLIKatello::FilterRule
82
-
83
91
  end
84
92
  end
@@ -1,7 +1,5 @@
1
1
  module HammerCLIKatello
2
-
3
2
  class FilterRule < HammerCLIKatello::Command
4
-
5
3
  resource :content_view_filter_rules
6
4
  command_name 'rule'
7
5
  desc 'View and manage filter rules'
@@ -48,6 +46,14 @@ module HammerCLIKatello
48
46
  success_message _("Filter rule created")
49
47
  failure_message _("Could not create the filter rule")
50
48
 
49
+ option '--names', 'NAMES', _('Package and package group names')
50
+
51
+ def all_options
52
+ options = super
53
+ options['option_name'] ||= options['option_names'].split(',') if options['option_names']
54
+ options
55
+ end
56
+
51
57
  build_options
52
58
  end
53
59
 
@@ -0,0 +1,71 @@
1
+ module HammerCLIKatello
2
+ module ForemanSearchOptionsCreators
3
+ def create_environments_search_options(options)
4
+ create_search_options_without_katello_api(options, api.resource(:environments))
5
+ end
6
+
7
+ def create_organizations_search_options(options)
8
+ create_search_options_without_katello_api(options, api.resource(:organizations))
9
+ end
10
+
11
+ def create_smart_proxies_search_options(options)
12
+ create_search_options_without_katello_api(options, api.resource(:smart_proxies))
13
+ end
14
+
15
+ def create_capsules_search_options(options)
16
+ create_search_options_without_katello_api(options, api.resource(:smart_proxies))
17
+ end
18
+
19
+ def create_hosts_search_options(options)
20
+ create_search_options_without_katello_api(options, api.resource(:hosts))
21
+ end
22
+
23
+ def create_architectures_search_options(options)
24
+ create_search_options_without_katello_api(options, api.resource(:architectures))
25
+ end
26
+
27
+ def create_operatingsystems_search_options(options)
28
+ create_search_options_without_katello_api(options, api.resource(:operatingsystems))
29
+ end
30
+
31
+ def create_domains_search_options(options)
32
+ create_search_options_without_katello_api(options, api.resource(:domains))
33
+ end
34
+
35
+ def create_locations_search_options(options)
36
+ create_search_options_without_katello_api(options, api.resource(:locations))
37
+ end
38
+
39
+ def create_media_search_options(options)
40
+ create_search_options_without_katello_api(options, api.resource(:media))
41
+ end
42
+
43
+ def create_hostgroups_search_options(options)
44
+ create_search_options_without_katello_api(options, api.resource(:hostgroups))
45
+ end
46
+
47
+ def create_ptables_search_options(options)
48
+ create_search_options_without_katello_api(options, api.resource(:ptables))
49
+ end
50
+
51
+ def create_puppet_ca_proxies_search_options(options)
52
+ create_search_options_without_katello_api(options, api.resource(:puppet_ca_proxies))
53
+ end
54
+
55
+ def create_puppet_proxies_search_options(options)
56
+ create_search_options_without_katello_api(options, api.resource(:puppet_proxies))
57
+ end
58
+
59
+ def create_puppetclasses_search_options(options)
60
+ create_search_options_without_katello_api(options, api.resource(:puppetclasses))
61
+ end
62
+
63
+ def create_subnets_search_options(options)
64
+ create_search_options_without_katello_api(options, api.resource(:subnets))
65
+ end
66
+
67
+ def create_realms_search_options(options)
68
+ create_search_options_without_katello_api(options, api.resource(:realms))
69
+ end
70
+ end
71
+ end
@@ -1,11 +1,8 @@
1
1
  module HammerCLIKatello
2
-
3
2
  class GpgKeyCommand < HammerCLIForeman::Command
4
-
5
3
  resource :gpg_keys
6
4
 
7
5
  class ListCommand < HammerCLIKatello::ListCommand
8
-
9
6
  output do
10
7
  field :id, _("ID")
11
8
  field :name, _("Name")
@@ -15,7 +12,6 @@ module HammerCLIKatello
15
12
  end
16
13
 
17
14
  class InfoCommand < HammerCLIKatello::InfoCommand
18
-
19
15
  output do
20
16
  field :id, _("ID")
21
17
  field :name, _("Name")
@@ -68,5 +64,4 @@ module HammerCLIKatello
68
64
 
69
65
  autoload_subcommands
70
66
  end
71
-
72
67
  end
@@ -1,4 +1,5 @@
1
1
  require 'hammer_cli_foreman/host'
2
+ require 'hammer_cli_katello/host_extensions'
2
3
  require 'hammer_cli_katello/host_errata'
3
4
  require 'hammer_cli_katello/host_subscription'
4
5
  require 'hammer_cli_katello/host_package'