hammer_cli_katello 0.24.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hammer_cli_katello.rb +6 -14
  3. data/lib/hammer_cli_katello/activation_key.rb +5 -5
  4. data/lib/hammer_cli_katello/capsule.rb +2 -3
  5. data/lib/hammer_cli_katello/command_extensions/lifecycle_environment.rb +10 -7
  6. data/lib/hammer_cli_katello/command_extensions/lifecycle_environments.rb +11 -8
  7. data/lib/hammer_cli_katello/content_credential.rb +20 -19
  8. data/lib/hammer_cli_katello/content_export.rb +1 -0
  9. data/lib/hammer_cli_katello/content_export_helper.rb +23 -14
  10. data/lib/hammer_cli_katello/content_view.rb +16 -31
  11. data/lib/hammer_cli_katello/content_view_version.rb +18 -13
  12. data/lib/hammer_cli_katello/cv_import_export_helper.rb +21 -0
  13. data/lib/hammer_cli_katello/deb_package.rb +3 -3
  14. data/lib/hammer_cli_katello/erratum.rb +1 -1
  15. data/lib/hammer_cli_katello/erratum_info_command.rb +1 -1
  16. data/lib/hammer_cli_katello/file.rb +3 -3
  17. data/lib/hammer_cli_katello/filter.rb +2 -2
  18. data/lib/hammer_cli_katello/foreman_search_options_creators.rb +0 -12
  19. data/lib/hammer_cli_katello/host_collection.rb +2 -2
  20. data/lib/hammer_cli_katello/host_deb.rb +1 -1
  21. data/lib/hammer_cli_katello/host_errata.rb +1 -1
  22. data/lib/hammer_cli_katello/host_extensions.rb +5 -5
  23. data/lib/hammer_cli_katello/host_package.rb +1 -1
  24. data/lib/hammer_cli_katello/hostgroup_extensions.rb +4 -4
  25. data/lib/hammer_cli_katello/id_resolver.rb +5 -6
  26. data/lib/hammer_cli_katello/lifecycle_environment.rb +2 -2
  27. data/lib/hammer_cli_katello/module_stream.rb +8 -8
  28. data/lib/hammer_cli_katello/organization_options.rb +8 -6
  29. data/lib/hammer_cli_katello/ostree_branch.rb +2 -2
  30. data/lib/hammer_cli_katello/package.rb +5 -5
  31. data/lib/hammer_cli_katello/package_group.rb +4 -4
  32. data/lib/hammer_cli_katello/ping.rb +0 -14
  33. data/lib/hammer_cli_katello/product.rb +3 -3
  34. data/lib/hammer_cli_katello/product_content.rb +2 -2
  35. data/lib/hammer_cli_katello/repository.rb +6 -37
  36. data/lib/hammer_cli_katello/repository_set.rb +4 -4
  37. data/lib/hammer_cli_katello/simple_content_access.rb +40 -0
  38. data/lib/hammer_cli_katello/srpm.rb +2 -2
  39. data/lib/hammer_cli_katello/subscription.rb +2 -3
  40. data/lib/hammer_cli_katello/sync_plan.rb +2 -2
  41. data/lib/hammer_cli_katello/version.rb +1 -1
  42. data/test/data/3.18/foreman_api.json +1 -1
  43. data/test/data/3.19/foreman_api.json +1 -0
  44. data/test/data/4.0/foreman_api.json +1 -0
  45. data/test/functional/capsule/content/info_test.rb +1 -2
  46. data/test/functional/content_credentials/create_test.rb +32 -0
  47. data/test/functional/{repository → content_credentials}/data/test_cert.json +0 -0
  48. data/test/functional/content_credentials/list_test.rb +6 -8
  49. data/test/functional/content_export/complete/version_test.rb +35 -3
  50. data/test/functional/content_export/content_export_helpers.rb +19 -14
  51. data/test/functional/content_export/incremental/version_test.rb +35 -3
  52. data/test/functional/content_export/list_test.rb +33 -3
  53. data/test/functional/content_view/content_view_helpers.rb +3 -1
  54. data/test/functional/content_view/list_test.rb +0 -2
  55. data/test/functional/content_view/publish_test.rb +0 -21
  56. data/test/functional/content_view/version/cv_import_export_helper_test.rb +20 -0
  57. data/test/functional/content_view/version/export_test.rb +12 -0
  58. data/test/functional/content_view/version/import_test.rb +28 -0
  59. data/test/functional/content_view/version/promote_test.rb +1 -2
  60. data/test/functional/content_view/version/republish_repositories_test.rb +1 -2
  61. data/test/functional/host/errata/apply_test.rb +0 -2
  62. data/test/functional/host/errata/recalculate_test.rb +0 -2
  63. data/test/functional/lifecycle_environment/lifecycle_environment_helpers.rb +1 -1
  64. data/test/functional/ping_test.rb +0 -2
  65. data/test/functional/repository/create_test.rb +0 -30
  66. data/test/functional/repository/info_test.rb +4 -4
  67. data/test/functional/repository/list_test.rb +0 -2
  68. data/test/functional/search_helpers.rb +11 -0
  69. data/test/functional/simple_content_access/disable_test.rb +48 -0
  70. data/test/functional/simple_content_access/enable_test.rb +46 -0
  71. data/test/test_helper.rb +1 -1
  72. metadata +18 -18
  73. data/lib/hammer_cli_katello/content_view_puppet_module.rb +0 -60
  74. data/lib/hammer_cli_katello/gpg_key.rb +0 -67
  75. data/lib/hammer_cli_katello/puppet_module.rb +0 -59
  76. data/test/functional/content_view/puppet_module/add_test.rb +0 -24
  77. data/test/functional/content_view/puppet_module/remove_test.rb +0 -54
  78. data/test/functional/gpg_test.rb +0 -39
  79. data/test/functional/repository/data/test_ca.json +0 -43
  80. data/test/functional/repository/data/test_key.json +0 -43
@@ -162,5 +162,26 @@ module HammerCLIKatello
162
162
  end
163
163
  json
164
164
  end
165
+
166
+ def fail_msg_import
167
+ _("This command is not supported with Pulp 3. Use `hammer content-import` instead.")
168
+ end
169
+
170
+ def fail_msg_export
171
+ _("This command is not supported with Pulp 3. Use `hammer content-export` instead.")
172
+ end
173
+
174
+ def validate_pulp3_not_enabled(failure_message)
175
+ pulp3_enabled = HammerCLIForeman
176
+ .foreman_api_connection
177
+ .resource(:content_exports)
178
+ .call(:api_status)['api_usable']
179
+ if pulp3_enabled
180
+ raise failure_message
181
+ end
182
+ rescue NoMethodError
183
+ # if the api endpoint isn't there, the validation passes
184
+ true
185
+ end
165
186
  end
166
187
  end
@@ -7,7 +7,7 @@ module HammerCLIKatello
7
7
  include LifecycleEnvironmentNameMapping
8
8
 
9
9
  output do
10
- field :id, _("ID")
10
+ field :id, _("Id")
11
11
  field :filename, _("Filename")
12
12
  end
13
13
 
@@ -43,9 +43,9 @@ module HammerCLIKatello
43
43
 
44
44
  class InfoCommand < HammerCLIKatello::InfoCommand
45
45
  output do
46
- field :id, _("ID")
46
+ field :id, _("Id")
47
47
  field :pulp_id, _("Pulp ID")
48
- field :uuid, _("UUID")
48
+ field :uuid, _("Uuid")
49
49
  field :name, _("Name")
50
50
  field :version, _("Version")
51
51
  field :checksum, _("checksum")
@@ -10,7 +10,7 @@ module HammerCLIKatello
10
10
  validate_repo_name_requires_product_options(:option_repository_name)
11
11
 
12
12
  output do
13
- field :id, _("ID")
13
+ field :id, _("Id")
14
14
  field :errata_id, _("Errata ID")
15
15
  field :type, _("Type")
16
16
  field :title, _("Title")
@@ -7,7 +7,7 @@ module HammerCLIKatello
7
7
  field :version, _("Version")
8
8
  field :description, _("Description")
9
9
  field :status, _("Status")
10
- field :id, _("ID")
10
+ field :id, _("Id")
11
11
  field :errata_id, _("Errata ID")
12
12
  field :reboot_suggested, _("Reboot Suggested")
13
13
  field :updated, _("Updated")
@@ -8,7 +8,7 @@ module HammerCLIKatello
8
8
  validate_repo_name_requires_product_options(:option_repository_name)
9
9
 
10
10
  output do
11
- field :id, _("ID")
11
+ field :id, _("Id")
12
12
  field :name, _("Name")
13
13
  field :path, _("Path")
14
14
  end
@@ -28,10 +28,10 @@ module HammerCLIKatello
28
28
 
29
29
  class InfoCommand < HammerCLIKatello::InfoCommand
30
30
  output do
31
- field :id, _("ID")
31
+ field :id, _("Id")
32
32
  field :name, _("Name")
33
33
  field :path, _("Path")
34
- field :uuid, _("UUID")
34
+ field :uuid, _("Uuid")
35
35
  field :checksum, _("Checksum")
36
36
  end
37
37
 
@@ -34,13 +34,13 @@ module HammerCLIKatello
34
34
  field :description, _("Description")
35
35
 
36
36
  collection :repositories, _("Repositories") do
37
- field :id, _("ID")
37
+ field :id, _("Id")
38
38
  field :name, _("Name")
39
39
  field :label, _("Label")
40
40
  end
41
41
 
42
42
  collection :rules, _("Rules") do
43
- field :id, _("ID")
43
+ field :id, _("Id")
44
44
  field :name, _("Name"), Fields::Field, :hide_blank => true
45
45
  field :version, _("Version"), Fields::Field, :hide_blank => true
46
46
  field :min_version, _("Minimum Version"), Fields::Field, :hide_blank => true
@@ -48,18 +48,6 @@ module HammerCLIKatello
48
48
  create_search_options_without_katello_api(options, api.resource(:ptables), mode)
49
49
  end
50
50
 
51
- def create_puppet_ca_proxies_search_options(options, mode = nil)
52
- create_search_options_without_katello_api(options, api.resource(:puppet_ca_proxies), mode)
53
- end
54
-
55
- def create_puppet_proxies_search_options(options, mode = nil)
56
- create_search_options_without_katello_api(options, api.resource(:puppet_proxies), mode)
57
- end
58
-
59
- def create_puppetclasses_search_options(options, mode = nil)
60
- create_search_options_without_katello_api(options, api.resource(:puppetclasses), mode)
61
- end
62
-
63
51
  def create_subnets_search_options(options, mode = nil)
64
52
  create_search_options_without_katello_api(options, api.resource(:subnets), mode)
65
53
  end
@@ -28,7 +28,7 @@ module HammerCLIKatello
28
28
  resource :host_collections, :index
29
29
 
30
30
  output do
31
- field :id, _("ID")
31
+ field :id, _("Id")
32
32
  field :name, _("Name")
33
33
  field :_limit, _("Limit")
34
34
  field :description, _("Description")
@@ -99,7 +99,7 @@ module HammerCLIKatello
99
99
  end
100
100
 
101
101
  output do
102
- field :id, _("ID")
102
+ field :id, _("Id")
103
103
  field :name, _("Name")
104
104
  from :content_facet_attributes do
105
105
  from :errata_counts do
@@ -6,7 +6,7 @@ module HammerCLIKatello
6
6
  resource :host_debs, :index
7
7
 
8
8
  output do
9
- field :id, _("ID")
9
+ field :id, _("Id")
10
10
  field :name, _("Name")
11
11
  field :version, _("Version")
12
12
  field :architecture, _("Arch")
@@ -21,7 +21,7 @@ module HammerCLIKatello
21
21
  command_name "list"
22
22
 
23
23
  output do
24
- field :id, _("ID")
24
+ field :id, _("Id")
25
25
  field :errata_id, _("Erratum ID")
26
26
  field :type, _("Type")
27
27
  field :title, _("Title")
@@ -41,22 +41,22 @@ module HammerCLIKatello
41
41
  label _('Content Information') do
42
42
  from :content_facet_attributes do
43
43
  label _("Content View") do
44
- field :content_view_id, _("ID")
44
+ field :content_view_id, _("Id")
45
45
  field :content_view_name, _("Name")
46
46
  end
47
47
 
48
48
  label _("Lifecycle Environment") do
49
- field :lifecycle_environment_id, _("ID")
49
+ field :lifecycle_environment_id, _("Id")
50
50
  field :lifecycle_environment_name, _("Name")
51
51
  end
52
52
 
53
53
  label _("Content Source") do
54
- field :content_source_id, _("ID")
54
+ field :content_source_id, _("Id")
55
55
  field :content_source_name, _("Name")
56
56
  end
57
57
 
58
58
  label _("Kickstart Repository") do
59
- field :kickstart_repository_id, _("ID")
59
+ field :kickstart_repository_id, _("Id")
60
60
  field :kickstart_repository_name, _("Name")
61
61
  end
62
62
 
@@ -75,7 +75,7 @@ module HammerCLIKatello
75
75
 
76
76
  label _('Subscription Information') do
77
77
  from :subscription_facet_attributes do
78
- field :uuid, _('UUID')
78
+ field :uuid, _('Uuid')
79
79
  field :last_checkin, _('Last Checkin')
80
80
  field :release_version, _('Release Version')
81
81
  field :autoheal, _('Autoheal')
@@ -6,7 +6,7 @@ module HammerCLIKatello
6
6
  resource :host_packages, :index
7
7
 
8
8
  output do
9
- field :nvra, _("NVRA")
9
+ field :nvra, _("Nvra")
10
10
  end
11
11
 
12
12
  build_options
@@ -45,22 +45,22 @@ module HammerCLIKatello
45
45
  ::HammerCLIForeman::Hostgroup::InfoCommand.instance_eval do
46
46
  output do
47
47
  label _("Content View") do
48
- field :content_view_id, _("ID")
48
+ field :content_view_id, _("Id")
49
49
  field :content_view_name, _("Name")
50
50
  end
51
51
 
52
52
  label _("Lifecycle Environment") do
53
- field :lifecycle_environment_id, _("ID")
53
+ field :lifecycle_environment_id, _("Id")
54
54
  field :lifecycle_environment_name, _("Name")
55
55
  end
56
56
 
57
57
  label _("Content Source") do
58
- field :content_source_id, _("ID")
58
+ field :content_source_id, _("Id")
59
59
  field :content_source_name, _("Name")
60
60
  end
61
61
 
62
62
  label _("Kickstart Repository") do
63
- field :kickstart_repository_id, _("ID")
63
+ field :kickstart_repository_id, _("Id")
64
64
  field :kickstart_repository_name, _("Name")
65
65
  end
66
66
  end
@@ -28,11 +28,6 @@ module HammerCLIKatello
28
28
  :subscription => [s_name(_("Subscription name to search by"))],
29
29
  :sync_plan => [s_name(_("Sync plan name to search by"))],
30
30
  :task => [s_name(_("Task name to search by"))],
31
- :content_view_puppet_module => [
32
- s_name(_("Puppet module name to search by")),
33
- s("author", _("Puppet module's author to search by")),
34
- s("uuid", _("Puppet module's UUID to search by"))
35
- ],
36
31
  :content_view_version => [s("version", _("Content view version number"))]
37
32
  }.freeze
38
33
 
@@ -117,6 +112,7 @@ module HammerCLIKatello
117
112
  end
118
113
  end
119
114
 
115
+ # rubocop:disable Style/EmptyElse
120
116
  def content_view_version_id(options)
121
117
  key_id = HammerCLI.option_accessor_name("id")
122
118
  key_content_view_id = HammerCLI.option_accessor_name("content_view_id")
@@ -129,6 +125,8 @@ module HammerCLIKatello
129
125
  results = find_resources(:content_view_versions, options)
130
126
  options[from_environment_id] ||= from_lifecycle_environment_id(options)
131
127
 
128
+ return pick_result(results, @api.resource(:content_view_versions))['id'] if results.size == 1
129
+
132
130
  if results.size > 1 && options[from_environment_id]
133
131
  results_in_from_environment = results.select do |version|
134
132
  member_of_environment_ids = version['environments'].map { |env| env['id'].to_s }
@@ -137,9 +135,10 @@ module HammerCLIKatello
137
135
  results_in_from_environment
138
136
  .sort { |a, b| a['version'].to_f <=> b['version'].to_f }.last['id']
139
137
  else
140
- pick_result(results, @api.resource(:content_view_versions))['id']
138
+ nil
141
139
  end
142
140
  end
141
+ # rubocop:enable Style/EmptyElse
143
142
 
144
143
  private
145
144
 
@@ -29,7 +29,7 @@ module HammerCLIKatello
29
29
 
30
30
  class ListCommand < HammerCLIKatello::ListCommand
31
31
  output do
32
- field :id, _("ID")
32
+ field :id, _("Id")
33
33
  field :name, _("Name")
34
34
  from :prior do
35
35
  field :name, _("Prior")
@@ -57,7 +57,7 @@ module HammerCLIKatello
57
57
 
58
58
  class InfoCommand < HammerCLIKatello::InfoCommand
59
59
  output do
60
- field :id, _("ID")
60
+ field :id, _("Id")
61
61
  field :name, _("Name")
62
62
  field :label, _("Label")
63
63
  field :description, _("Description")
@@ -10,10 +10,10 @@ module HammerCLIKatello
10
10
  validate_repo_name_requires_product_options(:option_repository_name)
11
11
 
12
12
  output do
13
- field :id, _("ID")
13
+ field :id, _("Id")
14
14
  field :name, _("Module Stream Name")
15
15
  field :stream, _("Stream")
16
- field :uuid, _("UUID")
16
+ field :uuid, _("Uuid")
17
17
  field :version, _("Version")
18
18
  field :arch, _("Architecture")
19
19
  field :context, _("Context")
@@ -30,30 +30,30 @@ module HammerCLIKatello
30
30
  validate_repo_name_requires_product_options(:option_repository_name)
31
31
 
32
32
  output do
33
- field :id, _("ID")
33
+ field :id, _("Id")
34
34
  field :name, _("Module Stream Name")
35
35
  field :stream, _("Stream")
36
- field :uuid, _("UUID")
36
+ field :uuid, _("Uuid")
37
37
  field :version, _("Version")
38
38
  field :arch, _("Architecture")
39
39
  field :context, _("Context")
40
40
 
41
41
  collection :repositories, _("Repositories") do
42
- field :id, _("ID")
42
+ field :id, _("Id")
43
43
  field :name, _("Name")
44
44
  field :label, _("Label")
45
45
  end
46
46
 
47
47
  collection :artifacts, _("Artifacts") do
48
- field :id, _("ID")
48
+ field :id, _("Id")
49
49
  field :name, _("Name")
50
50
  end
51
51
 
52
52
  collection :profiles, _("Profiles") do
53
- field :id, _("ID")
53
+ field :id, _("Id")
54
54
  field :name, _("Name")
55
55
  collection :rpms, _("RPMs") do
56
- field :id, _("ID")
56
+ field :id, _("Id")
57
57
  field :name, _("Name")
58
58
  end
59
59
  end
@@ -1,12 +1,14 @@
1
1
  module HammerCLIKatello
2
2
  module OrganizationOptions
3
3
  def self.included(base)
4
- base.option '--organization-id', 'ORGANIZATION_ID',
5
- _('Organization ID to search by'), attribute_name: :option_organization_id
6
- base.option '--organization', 'ORGANIZATION_NAME',
7
- _('Organization name to search by'), attribute_name: :option_organization_name
8
- base.option '--organization-label', 'ORGANIZATION_LABEL',
9
- _('Organization label to search by'), attribute_name: :option_organization_label
4
+ base.option_family do
5
+ parent '--organization-id', 'ORGANIZATION_ID',
6
+ _('Organization ID to search by'), attribute_name: :option_organization_id
7
+ child '--organization', 'ORGANIZATION_NAME',
8
+ _('Organization name to search by'), attribute_name: :option_organization_name
9
+ child '--organization-label', 'ORGANIZATION_LABEL',
10
+ _('Organization label to search by'), attribute_name: :option_organization_label
11
+ end
10
12
  end
11
13
 
12
14
  def org_options
@@ -8,7 +8,7 @@ module HammerCLIKatello
8
8
  validate_repo_name_requires_product_options(:option_repository_name)
9
9
 
10
10
  output do
11
- field :id, _("ID")
11
+ field :id, _("Id")
12
12
  field :name, _("Name")
13
13
  field :version, _("version")
14
14
  end
@@ -20,7 +20,7 @@ module HammerCLIKatello
20
20
 
21
21
  class InfoCommand < HammerCLIKatello::InfoCommand
22
22
  output do
23
- field :id, _("ID")
23
+ field :id, _("Id")
24
24
  field :name, _("Name")
25
25
  field :version, _("Version")
26
26
  field :commit, _("Commit")
@@ -7,7 +7,7 @@ module HammerCLIKatello
7
7
  include LifecycleEnvironmentNameMapping
8
8
 
9
9
  output do
10
- field :id, _("ID")
10
+ field :id, _("Id")
11
11
  field :filename, _("Filename")
12
12
  field :sourcerpm, _("Source RPM")
13
13
  end
@@ -44,9 +44,9 @@ module HammerCLIKatello
44
44
 
45
45
  class InfoCommand < HammerCLIKatello::InfoCommand
46
46
  output do
47
- field :id, _("ID")
47
+ field :id, _("Id")
48
48
  field :pulp_id, _("Pulp ID")
49
- field :uuid, _("UUID")
49
+ field :uuid, _("Uuid")
50
50
  field :name, _("Name")
51
51
  field :version, _("Version")
52
52
  field :arch, _("Architecture")
@@ -55,7 +55,7 @@ module HammerCLIKatello
55
55
  field :author, _("Author")
56
56
  field :filename, _("Filename")
57
57
  field :sourcerpm, _("Source rpm")
58
- field :nvrea, _("nvrea")
58
+ field :nvrea, _("Nvrea")
59
59
  field :buildhost, _("Build Host")
60
60
  field :hosts_available_count, _("Available Host Count")
61
61
  field :hosts_applicable_count, _("Applicable Host Count")
@@ -65,7 +65,7 @@ module HammerCLIKatello
65
65
  field :relativepath, _("Relative Path")
66
66
  field :description, _("Description")
67
67
  field :summary, _("Summary")
68
- field :url, _("URL")
68
+ field :url, _("Url")
69
69
  field :build_time, _("Build Time")
70
70
  field :group, _("Group")
71
71
  field :requires, _("Requires")
@@ -8,10 +8,10 @@ module HammerCLIKatello
8
8
  validate_repo_name_requires_product_options(:option_repository_name)
9
9
 
10
10
  output do
11
- field :id, _("ID")
11
+ field :id, _("Id")
12
12
  field :name, _("Package Group Name")
13
13
  field :repo_name, _("Repository Name")
14
- field :uuid, _("UUID")
14
+ field :uuid, _("Uuid")
15
15
  end
16
16
 
17
17
  def extend_data(data)
@@ -26,10 +26,10 @@ module HammerCLIKatello
26
26
 
27
27
  class InfoCommand < HammerCLIKatello::InfoCommand
28
28
  output do
29
- field :id, _("ID")
29
+ field :id, _("Id")
30
30
  field :name, _("Package Group Name")
31
31
  field :repo_name, _("Repository Name")
32
- field :uuid, _("UUID")
32
+ field :uuid, _("Uuid")
33
33
  field :description, _("Description")
34
34
  field :default_package_names, _("Default Packages"), Fields::List
35
35
  field :mandatory_package_names, _("Mandatory Packages"), Fields::List