hammer_cli_katello 0.24.4 → 1.1.2
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.
- checksums.yaml +4 -4
- data/lib/hammer_cli_katello.rb +11 -15
- data/lib/hammer_cli_katello/activation_key.rb +5 -5
- data/lib/hammer_cli_katello/capsule.rb +2 -3
- data/lib/hammer_cli_katello/command_extensions/lifecycle_environment.rb +10 -7
- data/lib/hammer_cli_katello/command_extensions/lifecycle_environments.rb +11 -8
- data/lib/hammer_cli_katello/content_credential.rb +20 -19
- data/lib/hammer_cli_katello/content_export.rb +1 -0
- data/lib/hammer_cli_katello/content_export_helper.rb +1 -1
- data/lib/hammer_cli_katello/content_import.rb +16 -1
- data/lib/hammer_cli_katello/content_view.rb +16 -31
- data/lib/hammer_cli_katello/content_view_version.rb +4 -273
- data/lib/hammer_cli_katello/deb_package.rb +3 -3
- data/lib/hammer_cli_katello/docker.rb +13 -0
- data/lib/hammer_cli_katello/docker_manifest.rb +53 -0
- data/lib/hammer_cli_katello/docker_tag.rb +40 -0
- data/lib/hammer_cli_katello/erratum.rb +1 -1
- data/lib/hammer_cli_katello/erratum_info_command.rb +1 -1
- data/lib/hammer_cli_katello/file.rb +3 -3
- data/lib/hammer_cli_katello/filter.rb +2 -2
- data/lib/hammer_cli_katello/foreman_search_options_creators.rb +0 -12
- data/lib/hammer_cli_katello/host_collection.rb +2 -2
- data/lib/hammer_cli_katello/host_collection_erratum.rb +10 -0
- data/lib/hammer_cli_katello/host_collection_package.rb +30 -0
- data/lib/hammer_cli_katello/host_collection_package_group.rb +30 -0
- data/lib/hammer_cli_katello/host_deb.rb +1 -1
- data/lib/hammer_cli_katello/host_errata.rb +9 -1
- data/lib/hammer_cli_katello/host_extensions.rb +5 -5
- data/lib/hammer_cli_katello/host_package.rb +33 -1
- data/lib/hammer_cli_katello/host_package_group.rb +16 -0
- data/lib/hammer_cli_katello/hostgroup_extensions.rb +4 -4
- data/lib/hammer_cli_katello/id_resolver.rb +3 -6
- data/lib/hammer_cli_katello/lifecycle_environment.rb +2 -2
- data/lib/hammer_cli_katello/module_stream.rb +8 -8
- data/lib/hammer_cli_katello/organization.rb +10 -0
- data/lib/hammer_cli_katello/organization_options.rb +8 -6
- data/lib/hammer_cli_katello/ostree_branch.rb +2 -2
- data/lib/hammer_cli_katello/package.rb +5 -5
- data/lib/hammer_cli_katello/package_group.rb +4 -4
- data/lib/hammer_cli_katello/ping.rb +13 -19
- data/lib/hammer_cli_katello/product.rb +3 -3
- data/lib/hammer_cli_katello/product_content.rb +2 -2
- data/lib/hammer_cli_katello/repository.rb +27 -37
- data/lib/hammer_cli_katello/repository_set.rb +4 -4
- data/lib/hammer_cli_katello/simple_content_access.rb +42 -0
- data/lib/hammer_cli_katello/srpm.rb +2 -2
- data/lib/hammer_cli_katello/subscription.rb +2 -3
- data/lib/hammer_cli_katello/sync_plan.rb +2 -2
- data/lib/hammer_cli_katello/version.rb +1 -1
- data/locale/hammer-cli-katello.pot +0 -25
- data/test/data/3.18/foreman_api.json +1 -1
- data/test/data/3.19/foreman_api.json +1 -0
- data/test/data/4.0/foreman_api.json +1 -0
- data/test/data/4.1/foreman_api.json +1 -0
- data/test/functional/activation_key/subscriptions_test.rb +5 -2
- data/test/functional/capsule/content/info_test.rb +1 -2
- data/test/functional/content_credentials/create_test.rb +32 -0
- data/test/functional/{repository → content_credentials}/data/test_cert.json +0 -0
- data/test/functional/content_credentials/list_test.rb +6 -8
- data/test/functional/content_export/complete/version_test.rb +35 -0
- data/test/functional/content_export/list_test.rb +9 -9
- data/test/functional/content_import/list_test.rb +65 -0
- data/test/functional/content_import/version_test.rb +6 -6
- data/test/functional/content_view/list_test.rb +0 -2
- data/test/functional/content_view/publish_test.rb +0 -21
- data/test/functional/content_view/version/promote_test.rb +1 -2
- data/test/functional/content_view/version/republish_repositories_test.rb +1 -2
- data/test/functional/host/errata/apply_test.rb +0 -2
- data/test/functional/host/errata/recalculate_test.rb +0 -2
- data/test/functional/organization/info_test.rb +22 -0
- data/test/functional/ping_test.rb +52 -15
- data/test/functional/repository/create_test.rb +0 -30
- data/test/functional/repository/info_test.rb +4 -4
- data/test/functional/repository/list_test.rb +0 -2
- data/test/functional/simple_content_access/disable_test.rb +48 -0
- data/test/functional/simple_content_access/enable_test.rb +46 -0
- data/test/test_helper.rb +1 -1
- metadata +24 -52
- data/lib/hammer_cli_katello/content_view_puppet_module.rb +0 -60
- data/lib/hammer_cli_katello/cv_import_export_helper.rb +0 -166
- data/lib/hammer_cli_katello/gpg_key.rb +0 -67
- data/lib/hammer_cli_katello/puppet_module.rb +0 -59
- data/test/functional/content_view/puppet_module/add_test.rb +0 -24
- data/test/functional/content_view/puppet_module/remove_test.rb +0 -54
- data/test/functional/content_view/version/default_export_test.rb +0 -40
- data/test/functional/content_view/version/export_test.rb +0 -136
- data/test/functional/content_view/version/import_test.rb +0 -318
- data/test/functional/gpg_test.rb +0 -39
- data/test/functional/repository/data/test_ca.json +0 -43
- data/test/functional/repository/data/test_key.json +0 -43
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d8787337433eea048dbc889beeb9d09dd0264d9f22838851544f08230e4fdb01
|
|
4
|
+
data.tar.gz: 280fbe62f124439debe0bcb7e19cf13f041857801d06eaf0ad2e162cdc53b36b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 611b6017e7bb314e31dcfa9138f37c9171a6e118e87b9174664bfe4f0569bc6b77b5b1e5cb2682ede8716c1f62aab4b9b046e6aad8e518a5dec83d0d2ddb4402
|
|
7
|
+
data.tar.gz: 61acf6ec874572401e818494534a264476b4300efead8781fe64f22ddbd350b33eed22eb764558fc80e5e8e3517c4df43bd24613dc84800dc7f094a333f091f2
|
data/lib/hammer_cli_katello.rb
CHANGED
|
@@ -30,7 +30,6 @@ module HammerCLIKatello
|
|
|
30
30
|
require 'hammer_cli_katello/id_name_options_validator'
|
|
31
31
|
require 'hammer_cli_katello/local_helper'
|
|
32
32
|
require 'hammer_cli_katello/apipie_helper'
|
|
33
|
-
require 'hammer_cli_katello/cv_import_export_helper'
|
|
34
33
|
require 'hammer_cli_katello/content_export_helper'
|
|
35
34
|
|
|
36
35
|
# commands
|
|
@@ -44,15 +43,6 @@ module HammerCLIKatello
|
|
|
44
43
|
'hammer_cli_katello/organization'
|
|
45
44
|
)
|
|
46
45
|
|
|
47
|
-
HammerCLI::MainCommand.lazy_subcommand("gpg",
|
|
48
|
-
_("Manipulate GPG Key actions on the server"),
|
|
49
|
-
'HammerCLIKatello::GpgKeyCommand',
|
|
50
|
-
'hammer_cli_katello/gpg_key',
|
|
51
|
-
:warning =>
|
|
52
|
-
_('The gpg sub-command is deprecated and will be removed in one of the future versions.' \
|
|
53
|
-
' Please use the content-credentials command instead.')
|
|
54
|
-
)
|
|
55
|
-
|
|
56
46
|
HammerCLI::MainCommand.lazy_subcommand("content-credentials",
|
|
57
47
|
_("Manipulate content credentials on the server"),
|
|
58
48
|
'HammerCLIKatello::ContentCredentialCommand',
|
|
@@ -70,11 +60,6 @@ module HammerCLIKatello
|
|
|
70
60
|
'hammer_cli_katello/product'
|
|
71
61
|
)
|
|
72
62
|
|
|
73
|
-
HammerCLI::MainCommand.lazy_subcommand("puppet-module", _("View Puppet Module details"),
|
|
74
|
-
'HammerCLIKatello::PuppetModule',
|
|
75
|
-
'hammer_cli_katello/puppet_module'
|
|
76
|
-
)
|
|
77
|
-
|
|
78
63
|
HammerCLI::MainCommand.lazy_subcommand("repository", _("Manipulate repositories"),
|
|
79
64
|
'HammerCLIKatello::Repository',
|
|
80
65
|
'hammer_cli_katello/repository'
|
|
@@ -164,6 +149,17 @@ module HammerCLIKatello
|
|
|
164
149
|
'hammer_cli_katello/srpm'
|
|
165
150
|
)
|
|
166
151
|
|
|
152
|
+
HammerCLI::MainCommand.lazy_subcommand("simple-content-access",
|
|
153
|
+
_("Simple content access commands"),
|
|
154
|
+
'HammerCLIKatello::SimpleContentAccess',
|
|
155
|
+
'hammer_cli_katello/simple_content_access'
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
HammerCLI::MainCommand.lazy_subcommand("docker", _("Manipulate docker content"),
|
|
159
|
+
'HammerCLIKatello::DockerCommand',
|
|
160
|
+
'hammer_cli_katello/docker'
|
|
161
|
+
)
|
|
162
|
+
|
|
167
163
|
# subcommands to hammer_cli_foreman commands
|
|
168
164
|
require 'hammer_cli_katello/host'
|
|
169
165
|
require 'hammer_cli_katello/hostgroup'
|
|
@@ -11,7 +11,7 @@ module HammerCLIKatello
|
|
|
11
11
|
action :index
|
|
12
12
|
|
|
13
13
|
output do
|
|
14
|
-
field :id, _("
|
|
14
|
+
field :id, _("Id")
|
|
15
15
|
field :name, _("Name")
|
|
16
16
|
field :format_consumed, _("Host Limit")
|
|
17
17
|
from :environment do
|
|
@@ -53,7 +53,7 @@ module HammerCLIKatello
|
|
|
53
53
|
|
|
54
54
|
output do
|
|
55
55
|
field :name, _("Name")
|
|
56
|
-
field :id, _("
|
|
56
|
+
field :id, _("Id")
|
|
57
57
|
field :description, _("Description")
|
|
58
58
|
field :format_limit, _("Host Limit")
|
|
59
59
|
field :auto_attach, _("Auto Attach")
|
|
@@ -67,7 +67,7 @@ module HammerCLIKatello
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
collection :host_collections, _("Host Collections") do
|
|
70
|
-
field :id, _("
|
|
70
|
+
field :id, _("Id")
|
|
71
71
|
field :name, _("Name")
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -150,7 +150,7 @@ module HammerCLIKatello
|
|
|
150
150
|
command_name "subscriptions"
|
|
151
151
|
|
|
152
152
|
output do
|
|
153
|
-
field :id, _("
|
|
153
|
+
field :id, _("Id")
|
|
154
154
|
field :product_name, _("Name")
|
|
155
155
|
field :format_consumed, _("Attached")
|
|
156
156
|
field :quantity_attached, _("Quantity")
|
|
@@ -230,7 +230,7 @@ module HammerCLIKatello
|
|
|
230
230
|
command_name "host-collections"
|
|
231
231
|
|
|
232
232
|
output do
|
|
233
|
-
field :id, _("
|
|
233
|
+
field :id, _("Id")
|
|
234
234
|
field :name, _("Name")
|
|
235
235
|
end
|
|
236
236
|
|
|
@@ -13,7 +13,7 @@ module HammerCLIKatello
|
|
|
13
13
|
command_name 'lifecycle-environments'
|
|
14
14
|
|
|
15
15
|
output do
|
|
16
|
-
field :id, _("
|
|
16
|
+
field :id, _("Id")
|
|
17
17
|
field :name, _("Name")
|
|
18
18
|
from :organization do
|
|
19
19
|
field :name, _("Organization")
|
|
@@ -28,7 +28,7 @@ module HammerCLIKatello
|
|
|
28
28
|
command_name 'available-lifecycle-environments'
|
|
29
29
|
|
|
30
30
|
output do
|
|
31
|
-
field :id, _("
|
|
31
|
+
field :id, _("Id")
|
|
32
32
|
field :name, _("Name")
|
|
33
33
|
from :organization do
|
|
34
34
|
field :name, _("Organization")
|
|
@@ -167,7 +167,6 @@ module HammerCLIKatello
|
|
|
167
167
|
field :packages, _('Packages')
|
|
168
168
|
field :package_groups, _('Package groups')
|
|
169
169
|
field :errata, _('Errata')
|
|
170
|
-
field :puppet_modules, _('Puppet modules')
|
|
171
170
|
end
|
|
172
171
|
end
|
|
173
172
|
end
|
|
@@ -2,13 +2,16 @@ module HammerCLIKatello
|
|
|
2
2
|
module CommandExtensions
|
|
3
3
|
class LifecycleEnvironment < HammerCLI::CommandExtensions
|
|
4
4
|
# Remove when support of --environment options is ended.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
option_family(
|
|
6
|
+
deprecated: { '--environment' => _("Use %s instead") % '--lifecycle-environment',
|
|
7
|
+
'--environment-id' => _("Use %s instead") % '--lifecycle-environment-id'}
|
|
8
|
+
) do
|
|
9
|
+
child '--environment', 'ENVIRONMENT_NAME', _('Lifecycle environment name to search by'),
|
|
10
|
+
attribute_name: :option_environment_name
|
|
11
|
+
parent '--environment-id', 'ENVIRONMENT_ID', _(''),
|
|
12
|
+
format: HammerCLI::Options::Normalizers::Number.new,
|
|
13
|
+
attribute_name: :option_environment_id
|
|
14
|
+
end
|
|
12
15
|
|
|
13
16
|
option_sources do |sources, command|
|
|
14
17
|
sources.find_by_name('IdResolution').insert_relative(
|
|
@@ -2,14 +2,17 @@ module HammerCLIKatello
|
|
|
2
2
|
module CommandExtensions
|
|
3
3
|
class LifecycleEnvironments < HammerCLI::CommandExtensions
|
|
4
4
|
# Remove when support of --environments options is ended.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
option_family(
|
|
6
|
+
format: HammerCLI::Options::Normalizers::List.new,
|
|
7
|
+
deprecation: _("Use %s instead") % '--lifecycle-environment[s|-ids]',
|
|
8
|
+
deprecated: { '--environments' => _("Use %s instead") % '--lifecycle-environments',
|
|
9
|
+
'--environment-ids' => _("Use %s instead") % '--lifecycle-environment-ids'}
|
|
10
|
+
) do
|
|
11
|
+
parent '--environment-ids', 'ENVIRONMENT_IDS', _(''),
|
|
12
|
+
attribute_name: :option_environment_ids
|
|
13
|
+
child '--environments', 'ENVIRONMENT_NAMES', _(''),
|
|
14
|
+
attribute_name: :option_environment_names
|
|
15
|
+
end
|
|
13
16
|
|
|
14
17
|
option_sources do |sources, command|
|
|
15
18
|
sources.find_by_name('IdResolution').insert_relative(
|
|
@@ -4,8 +4,9 @@ module HammerCLIKatello
|
|
|
4
4
|
|
|
5
5
|
class ListCommand < HammerCLIKatello::ListCommand
|
|
6
6
|
output do
|
|
7
|
-
field :id, _(
|
|
8
|
-
field :name, _(
|
|
7
|
+
field :id, _('Id')
|
|
8
|
+
field :name, _('Name')
|
|
9
|
+
field :content_type, _('Content Type')
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
build_options
|
|
@@ -13,51 +14,51 @@ module HammerCLIKatello
|
|
|
13
14
|
|
|
14
15
|
class InfoCommand < HammerCLIKatello::InfoCommand
|
|
15
16
|
output do
|
|
16
|
-
field :id, _(
|
|
17
|
-
field :name, _(
|
|
17
|
+
field :id, _('Id')
|
|
18
|
+
field :name, _('Name')
|
|
18
19
|
from :organization do
|
|
19
|
-
field :name, _(
|
|
20
|
+
field :name, _('Organization')
|
|
20
21
|
end
|
|
21
22
|
|
|
22
|
-
collection :repositories,
|
|
23
|
-
field :id, _(
|
|
24
|
-
field :name, _(
|
|
25
|
-
field :content_type, _(
|
|
23
|
+
collection :repositories, 'Repositories' do
|
|
24
|
+
field :id, _('Id')
|
|
25
|
+
field :name, _('Name')
|
|
26
|
+
field :content_type, _('Content Type')
|
|
26
27
|
from :product do
|
|
27
|
-
field :name, _(
|
|
28
|
+
field :name, _('Product')
|
|
28
29
|
end
|
|
29
30
|
end
|
|
30
31
|
|
|
31
|
-
field :content, _(
|
|
32
|
+
field :content, _('Content'), Fields::LongText
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
build_options
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
class CreateCommand < HammerCLIKatello::CreateCommand
|
|
38
|
-
success_message _(
|
|
39
|
-
failure_message _(
|
|
39
|
+
success_message _('Content Credential created.')
|
|
40
|
+
failure_message _('Could not create Content Credential')
|
|
40
41
|
|
|
41
42
|
build_options :without => [:content]
|
|
42
|
-
option
|
|
43
|
+
option '--path', 'KEY_FILE', _('Key file'),
|
|
43
44
|
:attribute_name => :option_content,
|
|
44
45
|
:required => true,
|
|
45
46
|
:format => HammerCLI::Options::Normalizers::File.new
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
class UpdateCommand < HammerCLIKatello::UpdateCommand
|
|
49
|
-
success_message _(
|
|
50
|
-
failure_message _(
|
|
50
|
+
success_message _('Content Credential updated.')
|
|
51
|
+
failure_message _('Could not update Content Credential')
|
|
51
52
|
|
|
52
53
|
build_options :without => [:content]
|
|
53
|
-
option
|
|
54
|
+
option '--path', 'KEY_FILE', _('Key file'),
|
|
54
55
|
:attribute_name => :option_content,
|
|
55
56
|
:format => HammerCLI::Options::Normalizers::File.new
|
|
56
57
|
end
|
|
57
58
|
|
|
58
59
|
class DeleteCommand < HammerCLIKatello::DeleteCommand
|
|
59
|
-
success_message _(
|
|
60
|
-
failure_message _(
|
|
60
|
+
success_message _('Content Credential deleted.')
|
|
61
|
+
failure_message _('Could not delete the Content Credential')
|
|
61
62
|
|
|
62
63
|
build_options
|
|
63
64
|
end
|
|
@@ -50,6 +50,7 @@ module HammerCLIKatello
|
|
|
50
50
|
field :id, _('ID')
|
|
51
51
|
field :destination_server, _('Destination Server')
|
|
52
52
|
field :path, _('Path')
|
|
53
|
+
field :type, _('Type')
|
|
53
54
|
field :content_view_version, _('Content View Version')
|
|
54
55
|
field :content_view_version_id, _('Content View Version ID')
|
|
55
56
|
field :created_at, _('Created at')
|
|
@@ -40,7 +40,7 @@ module HammerCLIKatello
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def fetch_export_history(export_history_id)
|
|
43
|
-
|
|
43
|
+
index(:content_exports, :id => export_history_id).first if export_history_id
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def fetch_export_history_from_task(task)
|
|
@@ -13,7 +13,7 @@ module HammerCLIKatello
|
|
|
13
13
|
:required => false
|
|
14
14
|
|
|
15
15
|
base.build_options do |o|
|
|
16
|
-
o.expand(:all).including(:
|
|
16
|
+
o.expand(:all).including(:organizations).except(:metadata)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
base.validate_options do
|
|
@@ -58,6 +58,21 @@ module HammerCLIKatello
|
|
|
58
58
|
include ContentImportCommon
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
class ListCommand < HammerCLIKatello::ListCommand
|
|
62
|
+
desc "View content view import histories"
|
|
63
|
+
output do
|
|
64
|
+
field :id, _('ID')
|
|
65
|
+
field :path, _('Path')
|
|
66
|
+
field :type, _('Type')
|
|
67
|
+
field :content_view_version, _('Content View Version')
|
|
68
|
+
field :content_view_version_id, _('Content View Version ID')
|
|
69
|
+
field :created_at, _('Created at')
|
|
70
|
+
field :updated_at, _('Updated at'), Fields::Field, :hide_blank => true
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
build_options
|
|
74
|
+
end
|
|
75
|
+
|
|
61
76
|
autoload_subcommands
|
|
62
77
|
end
|
|
63
78
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require 'hammer_cli_katello/content_view_puppet_module'
|
|
2
1
|
require 'hammer_cli_katello/content_view_purge'
|
|
3
2
|
require 'hammer_cli_katello/filter'
|
|
4
3
|
require 'hammer_cli_katello/content_view_version'
|
|
@@ -29,13 +28,12 @@ module HammerCLIKatello
|
|
|
29
28
|
include OrganizationOptions
|
|
30
29
|
|
|
31
30
|
output do
|
|
32
|
-
field :id, _("
|
|
31
|
+
field :id, _("Id")
|
|
33
32
|
field :name, _("Name")
|
|
34
33
|
field :label, _("Label")
|
|
35
34
|
field :composite, _("Composite")
|
|
36
35
|
field :description, _("Description")
|
|
37
36
|
field :content_host_count, _("Content Host Count")
|
|
38
|
-
field :force_puppet_environment, _("Force Puppet")
|
|
39
37
|
field :solve_dependencies, _("Solve Dependencies")
|
|
40
38
|
|
|
41
39
|
from :organization do
|
|
@@ -43,43 +41,36 @@ module HammerCLIKatello
|
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
collection :_yum_repositories, _("Yum Repositories") do
|
|
46
|
-
field :id, _("
|
|
44
|
+
field :id, _("Id")
|
|
47
45
|
field :name, _("Name")
|
|
48
46
|
field :label, _("Label")
|
|
49
47
|
end
|
|
50
48
|
|
|
51
49
|
collection :_docker_repositories, _("Container Image Repositories") do
|
|
52
|
-
field :id, _("
|
|
50
|
+
field :id, _("Id")
|
|
53
51
|
field :name, _("Name")
|
|
54
52
|
field :label, _("Label")
|
|
55
53
|
end
|
|
56
54
|
|
|
57
55
|
collection :_ostree_repositories, _("OSTree Repositories") do
|
|
58
|
-
field :id, _("
|
|
56
|
+
field :id, _("Id")
|
|
59
57
|
field :name, _("Name")
|
|
60
58
|
field :label, _("Label")
|
|
61
59
|
end
|
|
62
60
|
|
|
63
|
-
collection :puppet_modules, _("Puppet Modules") do
|
|
64
|
-
field :id, _("ID")
|
|
65
|
-
field :uuid, _("UUID"), Fields::Field, :hide_blank => true
|
|
66
|
-
field :name, _("Name")
|
|
67
|
-
field :author, _("Author")
|
|
68
|
-
end
|
|
69
|
-
|
|
70
61
|
collection :environments, _("Lifecycle Environments") do
|
|
71
|
-
field :id, _("
|
|
62
|
+
field :id, _("Id")
|
|
72
63
|
field :name, _("Name")
|
|
73
64
|
end
|
|
74
65
|
|
|
75
66
|
collection :versions, _("Versions") do
|
|
76
|
-
field :id, _("
|
|
67
|
+
field :id, _("Id")
|
|
77
68
|
field :version, _("Version")
|
|
78
69
|
field :published, _("Published"), Fields::Date
|
|
79
70
|
end
|
|
80
71
|
|
|
81
72
|
collection :components, _("Components") do
|
|
82
|
-
field :id, _("
|
|
73
|
+
field :id, _("Id")
|
|
83
74
|
field :name, _("Name")
|
|
84
75
|
end
|
|
85
76
|
|
|
@@ -246,13 +237,6 @@ module HammerCLIKatello
|
|
|
246
237
|
action :remove
|
|
247
238
|
command_name "remove"
|
|
248
239
|
|
|
249
|
-
option ["--content-view-version-ids"], "VERSION_IDS",
|
|
250
|
-
_("Version ids to remove"),
|
|
251
|
-
:format => HammerCLI::Options::Normalizers::List.new
|
|
252
|
-
option ["--lifecycle-environment-ids"], "LIFECYCLE_ENVIRONMENT_IDS",
|
|
253
|
-
_("Environment ids to remove"),
|
|
254
|
-
:format => HammerCLI::Options::Normalizers::List.new
|
|
255
|
-
|
|
256
240
|
def option_sources
|
|
257
241
|
sources = super
|
|
258
242
|
sources.find_by_name('IdResolution').insert_relative(
|
|
@@ -285,10 +269,15 @@ module HammerCLIKatello
|
|
|
285
269
|
command_name 'add-version'
|
|
286
270
|
desc _('Add a content view version to a composite view')
|
|
287
271
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
272
|
+
option_family do
|
|
273
|
+
parent "--content-view-id", "CONTENT_VIEW_ID",
|
|
274
|
+
_("Content view id to search by"),
|
|
275
|
+
attribute_name: :option_content_view_id,
|
|
276
|
+
format: HammerCLI::Options::Normalizers::Number.new
|
|
277
|
+
child "--content-view", "CONTENT_VIEW_NAME",
|
|
278
|
+
_("Content view name to search by"),
|
|
279
|
+
attribute_name: :option_content_view_name
|
|
280
|
+
end
|
|
292
281
|
|
|
293
282
|
validate_options :before, 'IdResolution' do
|
|
294
283
|
if option(:option_content_view_version_version).exist?
|
|
@@ -358,10 +347,6 @@ module HammerCLIKatello
|
|
|
358
347
|
|
|
359
348
|
autoload_subcommands
|
|
360
349
|
|
|
361
|
-
subcommand 'puppet-module',
|
|
362
|
-
HammerCLIKatello::ContentViewPuppetModule.desc,
|
|
363
|
-
HammerCLIKatello::ContentViewPuppetModule
|
|
364
|
-
|
|
365
350
|
subcommand HammerCLIKatello::Filter.command_name,
|
|
366
351
|
HammerCLIKatello::Filter.desc,
|
|
367
352
|
HammerCLIKatello::Filter
|
|
@@ -10,7 +10,7 @@ module HammerCLIKatello
|
|
|
10
10
|
include LifecycleEnvironmentNameMapping
|
|
11
11
|
|
|
12
12
|
output do
|
|
13
|
-
field :id, _("
|
|
13
|
+
field :id, _("Id")
|
|
14
14
|
field :name, _("Name")
|
|
15
15
|
field :version, _("Version")
|
|
16
16
|
field :description, _("Description")
|
|
@@ -35,7 +35,7 @@ module HammerCLIKatello
|
|
|
35
35
|
resource :content_view_versions, :show
|
|
36
36
|
|
|
37
37
|
output do
|
|
38
|
-
field :id, _("
|
|
38
|
+
field :id, _("Id")
|
|
39
39
|
field :name, _("Name")
|
|
40
40
|
field :version, _("Version")
|
|
41
41
|
field :description, _("Description")
|
|
@@ -47,23 +47,16 @@ module HammerCLIKatello
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
collection :environments, _("Lifecycle Environments") do
|
|
50
|
-
field :id, _("
|
|
50
|
+
field :id, _("Id")
|
|
51
51
|
field :name, _("Name")
|
|
52
52
|
field :label, _("Label")
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
collection :repositories, _("Repositories") do
|
|
56
|
-
field :id, _("
|
|
56
|
+
field :id, _("Id")
|
|
57
57
|
field :name, _("Name")
|
|
58
58
|
field :label, _("Label")
|
|
59
59
|
end
|
|
60
|
-
|
|
61
|
-
collection :puppet_modules, _("Puppet Modules") do
|
|
62
|
-
field :id, _("ID")
|
|
63
|
-
field :name, _("Name")
|
|
64
|
-
field :author, _("Author")
|
|
65
|
-
field :version, _("Version")
|
|
66
|
-
end
|
|
67
60
|
end
|
|
68
61
|
|
|
69
62
|
build_options do |o|
|
|
@@ -278,268 +271,6 @@ module HammerCLIKatello
|
|
|
278
271
|
end
|
|
279
272
|
end
|
|
280
273
|
|
|
281
|
-
class ExportDefaultCommand < HammerCLIForeman::Command
|
|
282
|
-
include HammerCLIKatello::LocalHelper
|
|
283
|
-
include HammerCLIKatello::ApipieHelper
|
|
284
|
-
|
|
285
|
-
PUBLISHED_REPOS_DIR = "/var/lib/pulp/published/yum/https/repos/".freeze
|
|
286
|
-
|
|
287
|
-
desc _('Export the library default content view')
|
|
288
|
-
|
|
289
|
-
command_name "export-default"
|
|
290
|
-
|
|
291
|
-
option '--export-dir', 'EXPORT_DIR', _("Directory to put content view version export into.")
|
|
292
|
-
|
|
293
|
-
validate_options do
|
|
294
|
-
option(:option_export_dir).required
|
|
295
|
-
end
|
|
296
|
-
|
|
297
|
-
build_options
|
|
298
|
-
|
|
299
|
-
def execute
|
|
300
|
-
export_dir = options['option_export_dir']
|
|
301
|
-
|
|
302
|
-
Dir.mkdir(export_dir) unless Dir.exist?(export_dir)
|
|
303
|
-
result = Kernel.system("rsync -aL #{PUBLISHED_REPOS_DIR} #{export_dir}")
|
|
304
|
-
if result == true
|
|
305
|
-
output.print_message _("Default content view export is available at #{export_dir}")
|
|
306
|
-
HammerCLI::EX_OK
|
|
307
|
-
else
|
|
308
|
-
output.print_error _("Could not export the default content view at #{export_dir}")
|
|
309
|
-
HammerCLI::EX_CANTCREAT
|
|
310
|
-
end
|
|
311
|
-
end
|
|
312
|
-
end
|
|
313
|
-
|
|
314
|
-
class LegacyExportCommand < HammerCLIKatello::SingleResourceCommand
|
|
315
|
-
include HammerCLIForemanTasks::Async
|
|
316
|
-
include LifecycleEnvironmentNameMapping
|
|
317
|
-
desc _('Export a content view (legacy method)')
|
|
318
|
-
|
|
319
|
-
action :export
|
|
320
|
-
command_name "export-legacy"
|
|
321
|
-
|
|
322
|
-
success_message _("Content view is being exported in task %{id}.")
|
|
323
|
-
failure_message _("Could not export the content view")
|
|
324
|
-
|
|
325
|
-
build_options do |o|
|
|
326
|
-
o.expand(:all).including(:environments, :content_views, :organizations)
|
|
327
|
-
end
|
|
328
|
-
|
|
329
|
-
extend_with(HammerCLIKatello::CommandExtensions::LifecycleEnvironment.new)
|
|
330
|
-
end
|
|
331
|
-
|
|
332
|
-
class ExportCommand < HammerCLIForeman::Command
|
|
333
|
-
include HammerCLIKatello::LocalHelper
|
|
334
|
-
include HammerCLIKatello::ApipieHelper
|
|
335
|
-
include HammerCLIKatello::CVImportExportHelper
|
|
336
|
-
|
|
337
|
-
PUBLISHED_REPOS_DIR = "/var/lib/pulp/published/yum/https/repos/".freeze
|
|
338
|
-
|
|
339
|
-
desc _('Export a content view version')
|
|
340
|
-
|
|
341
|
-
command_name "export"
|
|
342
|
-
|
|
343
|
-
success_message _("Content view export is available in %{directory}.")
|
|
344
|
-
failure_message _("Could not export the content view")
|
|
345
|
-
|
|
346
|
-
option "--id", "ID", _("Content View Version numeric identifier")
|
|
347
|
-
option '--export-dir', 'EXPORT_DIR', _("Directory to put content view version export into.")
|
|
348
|
-
|
|
349
|
-
validate_options do
|
|
350
|
-
option(:option_export_dir).required
|
|
351
|
-
option(:option_id).required
|
|
352
|
-
end
|
|
353
|
-
|
|
354
|
-
build_options
|
|
355
|
-
|
|
356
|
-
def execute
|
|
357
|
-
cvv = show(:content_view_versions, 'id' => options['option_id'])
|
|
358
|
-
cv = show(:content_views, 'id' => cvv['content_view_id'])
|
|
359
|
-
|
|
360
|
-
composite = cv["composite"]
|
|
361
|
-
|
|
362
|
-
export_json_options = { :cvv => cvv }
|
|
363
|
-
|
|
364
|
-
if composite
|
|
365
|
-
components = cv['components']
|
|
366
|
-
export_json_options[:component_cvvs] = components.collect do |component|
|
|
367
|
-
component['name']
|
|
368
|
-
end
|
|
369
|
-
export_json_options[:repositories] = []
|
|
370
|
-
else
|
|
371
|
-
repositories = fetch_exportable_cvv_repositories(cvv)
|
|
372
|
-
collect_packages(repositories)
|
|
373
|
-
|
|
374
|
-
export_json_options[:repositories] = repositories
|
|
375
|
-
end
|
|
376
|
-
|
|
377
|
-
json = export_json(export_json_options)
|
|
378
|
-
if repositories&.any? || cv['composite']
|
|
379
|
-
create_tar(cv, cvv, repositories, json)
|
|
380
|
-
else
|
|
381
|
-
msg = <<~MSG
|
|
382
|
-
Ensure the content view version '#{cvv['name']}' has at least one repository.
|
|
383
|
-
MSG
|
|
384
|
-
raise _(msg)
|
|
385
|
-
end
|
|
386
|
-
return HammerCLI::EX_OK
|
|
387
|
-
end
|
|
388
|
-
|
|
389
|
-
def create_tar(cv, cvv, repositories, json)
|
|
390
|
-
export_prefix = "export-#{cv['label']}-#{cvv['major']}.#{cvv['minor']}"
|
|
391
|
-
export_file = "#{export_prefix}.json"
|
|
392
|
-
export_repos_tar = "#{export_prefix}-repos.tar"
|
|
393
|
-
export_tar = "#{export_prefix}.tar"
|
|
394
|
-
export_dir = File.expand_path(options['option_export_dir'].to_s)
|
|
395
|
-
|
|
396
|
-
Dir.mkdir("#{export_dir}/#{export_prefix}")
|
|
397
|
-
|
|
398
|
-
if repositories&.any?
|
|
399
|
-
|
|
400
|
-
Dir.chdir(PUBLISHED_REPOS_DIR) do
|
|
401
|
-
repo_tar = "#{export_dir}/#{export_prefix}/#{export_repos_tar}"
|
|
402
|
-
repo_dirs = []
|
|
403
|
-
|
|
404
|
-
repositories.each do |repo|
|
|
405
|
-
repo_dirs.push(repo['relative_path'])
|
|
406
|
-
end
|
|
407
|
-
|
|
408
|
-
`tar cvfh #{repo_tar} #{repo_dirs.join(" ")}`
|
|
409
|
-
end
|
|
410
|
-
end
|
|
411
|
-
|
|
412
|
-
Dir.chdir("#{export_dir}/#{export_prefix}") do
|
|
413
|
-
File.open(export_file, 'w') do |file|
|
|
414
|
-
file.write(JSON.pretty_generate(json))
|
|
415
|
-
end
|
|
416
|
-
end
|
|
417
|
-
|
|
418
|
-
Dir.chdir(export_dir) do
|
|
419
|
-
`tar cf #{export_tar} #{export_prefix}`
|
|
420
|
-
FileUtils.rm_rf(export_prefix)
|
|
421
|
-
end
|
|
422
|
-
end
|
|
423
|
-
end
|
|
424
|
-
|
|
425
|
-
class ImportCommand < HammerCLIForeman::Command
|
|
426
|
-
include HammerCLIForemanTasks::Async
|
|
427
|
-
include HammerCLIKatello::LocalHelper
|
|
428
|
-
include HammerCLIKatello::ApipieHelper
|
|
429
|
-
include HammerCLIKatello::CVImportExportHelper
|
|
430
|
-
|
|
431
|
-
attr_accessor :export_tar_dir, :export_tar_file, :export_tar_prefix
|
|
432
|
-
|
|
433
|
-
desc _('Import a content view version')
|
|
434
|
-
|
|
435
|
-
command_name "import"
|
|
436
|
-
|
|
437
|
-
success_message _("Content view imported.")
|
|
438
|
-
failure_message _("Could not import the content view")
|
|
439
|
-
|
|
440
|
-
option "--organization-id", "ORGANIZATION_ID", _("Organization numeric identifier")
|
|
441
|
-
option(
|
|
442
|
-
'--export-tar', 'EXPORT_TAR',
|
|
443
|
-
_("Location of export tar on disk")
|
|
444
|
-
)
|
|
445
|
-
|
|
446
|
-
validate_options do
|
|
447
|
-
option(:option_export_tar).required
|
|
448
|
-
option(:option_organization_id).required
|
|
449
|
-
end
|
|
450
|
-
|
|
451
|
-
build_options
|
|
452
|
-
|
|
453
|
-
# rubocop:disable Metrics/AbcSize
|
|
454
|
-
def execute
|
|
455
|
-
unless File.exist?(options['option_export_tar'])
|
|
456
|
-
raise _("Export tar #{options['option_export_tar']} does not exist.")
|
|
457
|
-
end
|
|
458
|
-
|
|
459
|
-
import_tar_params = obtain_export_params(options['option_export_tar'])
|
|
460
|
-
untar_export(import_tar_params)
|
|
461
|
-
|
|
462
|
-
export_json = read_json(import_tar_params)
|
|
463
|
-
cv = content_view(export_json['name'], options['option_organization_id'])
|
|
464
|
-
major = export_json['major'].to_s
|
|
465
|
-
minor = export_json['minor'].to_s
|
|
466
|
-
import_checks(export_json, cv, major, minor)
|
|
467
|
-
|
|
468
|
-
if export_json['composite_components']
|
|
469
|
-
composite_version_ids = export_json['composite_components'].map do |component|
|
|
470
|
-
find_local_component_id(component)
|
|
471
|
-
end
|
|
472
|
-
update(:content_views, 'id' => cv['id'], 'component_ids' => composite_version_ids)
|
|
473
|
-
publish(cv['id'], export_json['major'], export_json['minor'])
|
|
474
|
-
else
|
|
475
|
-
sync_repositories(export_json['repositories'], options['option_organization_id'],
|
|
476
|
-
import_tar_params)
|
|
477
|
-
|
|
478
|
-
unless cv['default']
|
|
479
|
-
publish(
|
|
480
|
-
cv['id'], export_json['major'],
|
|
481
|
-
export_json['minor'], repos_units(export_json['repositories'])
|
|
482
|
-
)
|
|
483
|
-
end
|
|
484
|
-
end
|
|
485
|
-
return HammerCLI::EX_OK
|
|
486
|
-
end
|
|
487
|
-
# rubocop:enable Metrics/AbcSize
|
|
488
|
-
|
|
489
|
-
def sync_repositories(repositories, organization_id, options)
|
|
490
|
-
export_tar_dir = options[:dirname]
|
|
491
|
-
export_tar_prefix = options[:prefix]
|
|
492
|
-
|
|
493
|
-
repositories.each do |repo|
|
|
494
|
-
library_repos = index(
|
|
495
|
-
:repositories,
|
|
496
|
-
'organization_id' => organization_id,
|
|
497
|
-
'library' => true,
|
|
498
|
-
'label' => repo['label']
|
|
499
|
-
)
|
|
500
|
-
|
|
501
|
-
library_repo = library_repos.select do |candidate_repo|
|
|
502
|
-
candidate_repo['label'] == repo['label']
|
|
503
|
-
end
|
|
504
|
-
|
|
505
|
-
library_repo = library_repo.first
|
|
506
|
-
|
|
507
|
-
if library_repo.nil?
|
|
508
|
-
msg = _("Unable to sync repositories, no library repository found for %s")
|
|
509
|
-
raise msg % repo['label']
|
|
510
|
-
end
|
|
511
|
-
|
|
512
|
-
synchronize(
|
|
513
|
-
library_repo['id'],
|
|
514
|
-
"file://#{export_tar_dir}/#{export_tar_prefix}/#{repo['relative_path']}"
|
|
515
|
-
)
|
|
516
|
-
end
|
|
517
|
-
end
|
|
518
|
-
|
|
519
|
-
def repos_units(repositories)
|
|
520
|
-
repositories.collect do |repo|
|
|
521
|
-
{
|
|
522
|
-
'label' => repo['label'],
|
|
523
|
-
'rpm_filenames' => repo['rpm_filenames']
|
|
524
|
-
}
|
|
525
|
-
end
|
|
526
|
-
end
|
|
527
|
-
|
|
528
|
-
def content_view(name, organization_id)
|
|
529
|
-
index(:content_views, 'name' => name, 'organization_id' => organization_id).first
|
|
530
|
-
end
|
|
531
|
-
|
|
532
|
-
def synchronize(id, source_url)
|
|
533
|
-
task_progress(call(:sync, :repositories, 'id' => id, 'source_url' => source_url))
|
|
534
|
-
end
|
|
535
|
-
|
|
536
|
-
def publish(id, major, minor, repos_units = nil)
|
|
537
|
-
params = {'id' => id, 'major' => major, 'minor' => minor }
|
|
538
|
-
params['repos_units'] = repos_units if repos_units
|
|
539
|
-
task_progress(call(:publish, :content_views, params))
|
|
540
|
-
end
|
|
541
|
-
end
|
|
542
|
-
|
|
543
274
|
autoload_subcommands
|
|
544
275
|
end
|
|
545
276
|
end
|