hammer_cli_katello 0.24.4 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,60 +0,0 @@
|
|
1
|
-
module HammerCLIKatello
|
2
|
-
class ContentViewPuppetModule < HammerCLIKatello::Command
|
3
|
-
resource :content_view_puppet_modules
|
4
|
-
command_name 'puppet-module'
|
5
|
-
desc 'View and manage puppet modules'
|
6
|
-
|
7
|
-
class ListCommand < HammerCLIKatello::ListCommand
|
8
|
-
include OrganizationOptions
|
9
|
-
|
10
|
-
output do
|
11
|
-
field :uuid, _("UUID")
|
12
|
-
field :name, _("Name")
|
13
|
-
field :author, _("Author")
|
14
|
-
field :version, _("Version")
|
15
|
-
end
|
16
|
-
|
17
|
-
def extend_data(mod)
|
18
|
-
mod['version'] = if mod['uuid']
|
19
|
-
mod['computed_version']
|
20
|
-
else
|
21
|
-
_("Latest(Currently %s)") % mod['computed_version']
|
22
|
-
end
|
23
|
-
mod
|
24
|
-
end
|
25
|
-
|
26
|
-
build_options
|
27
|
-
end
|
28
|
-
|
29
|
-
class CreateCommand < HammerCLIKatello::CreateCommand
|
30
|
-
include OrganizationOptions
|
31
|
-
|
32
|
-
command_name "add"
|
33
|
-
|
34
|
-
success_message _("Puppet module added to content view.")
|
35
|
-
failure_message _("Could not add the puppet module")
|
36
|
-
|
37
|
-
build_options
|
38
|
-
|
39
|
-
def get_identifier(*)
|
40
|
-
# This will intentionally disable the id resolver. Without it, if the user were to
|
41
|
-
# execute the 'add' command specifying a 'name', the id resolver will attempt to
|
42
|
-
# translate the 'name' to an 'id'. That is not desirable for this command.
|
43
|
-
nil
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
class DeleteCommand < HammerCLIKatello::DeleteCommand
|
48
|
-
include OrganizationOptions
|
49
|
-
|
50
|
-
command_name "remove"
|
51
|
-
|
52
|
-
success_message _("Puppet module removed from content view.")
|
53
|
-
failure_message _("Couldn't remove puppet module from the content view")
|
54
|
-
|
55
|
-
build_options
|
56
|
-
end
|
57
|
-
|
58
|
-
autoload_subcommands
|
59
|
-
end
|
60
|
-
end
|
@@ -1,166 +0,0 @@
|
|
1
|
-
# rubocop:disable Metrics/ModuleLength
|
2
|
-
module HammerCLIKatello
|
3
|
-
module CVImportExportHelper
|
4
|
-
PUBLISHED_REPOS_DIR = "/var/lib/pulp/published/yum/https/repos/".freeze
|
5
|
-
|
6
|
-
def fetch_exportable_cvv_repositories(cvv)
|
7
|
-
immediate = []
|
8
|
-
non_immediate_names = []
|
9
|
-
|
10
|
-
cvv['repositories'].each do |repo|
|
11
|
-
next unless repo['content_type'] == 'yum'
|
12
|
-
|
13
|
-
api_repo = show(:repositories, 'id' => repo['id'], :full_result => true)
|
14
|
-
|
15
|
-
download_policy = if api_repo['library_instance_id']
|
16
|
-
library = show(:repositories, 'id' => api_repo['library_instance_id'])
|
17
|
-
library['download_policy']
|
18
|
-
else
|
19
|
-
api_repo['download_policy']
|
20
|
-
end
|
21
|
-
|
22
|
-
if download_policy == 'immediate'
|
23
|
-
immediate << api_repo
|
24
|
-
else
|
25
|
-
non_immediate_names << api_repo['name']
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
warn_repo_download_policy(non_immediate_names)
|
30
|
-
|
31
|
-
return immediate
|
32
|
-
end
|
33
|
-
|
34
|
-
def find_local_component_id(component_from_export)
|
35
|
-
*name, version = component_from_export.split(' ')
|
36
|
-
name = name.join(' ')
|
37
|
-
existing_component_cv = content_view(name, options['option_organization_id'])
|
38
|
-
found_composite_version = existing_component_cv['versions'].select do |v|
|
39
|
-
v['version'] == version
|
40
|
-
end
|
41
|
-
if found_composite_version.empty?
|
42
|
-
raise _("Unable to find CV version %{cvv} on system. Please ensure it " \
|
43
|
-
"is already imported." % {'cvv' => component_from_export})
|
44
|
-
end
|
45
|
-
found_composite_version.first['id']
|
46
|
-
end
|
47
|
-
|
48
|
-
def warn_repo_download_policy(repository_names)
|
49
|
-
return if repository_names.empty?
|
50
|
-
|
51
|
-
msg = <<~MSG
|
52
|
-
The following repositories could not be exported due to the download policy
|
53
|
-
not being set to 'immediate':
|
54
|
-
#{repository_names.join(', ')}
|
55
|
-
MSG
|
56
|
-
print_message msg
|
57
|
-
end
|
58
|
-
|
59
|
-
def collect_packages(repositories)
|
60
|
-
repositories.each do |repo|
|
61
|
-
per_page = 50
|
62
|
-
repo['packages'] = []
|
63
|
-
repo['errata'] = []
|
64
|
-
repo_packages = repo['content_counts']['rpm']
|
65
|
-
errata_count = repo['content_counts']['erratum']
|
66
|
-
pkg_pages = (repo_packages / per_page.to_f).ceil
|
67
|
-
errata_pages = (errata_count / per_page.to_f).ceil
|
68
|
-
(1..pkg_pages).each do |page|
|
69
|
-
repo['packages'] += index(:packages, 'repository_id' => repo['id'],
|
70
|
-
:page => page, :per_page => 50)
|
71
|
-
end
|
72
|
-
(1..errata_pages).each do |page|
|
73
|
-
repo['errata'] += index(:errata, 'repository_id' => repo['id'],
|
74
|
-
:page => page, :per_page => 50)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def import_checks(cv, import_cv, major, minor)
|
80
|
-
version = "#{major}.#{minor}".to_f
|
81
|
-
|
82
|
-
if import_cv.nil?
|
83
|
-
raise _("The Content View #{cv['name']} is not present on this server,"\
|
84
|
-
" please create the Content View and try the import again.")
|
85
|
-
end
|
86
|
-
|
87
|
-
unless import_cv['default']
|
88
|
-
if import_cv['latest_version'].to_f >= version
|
89
|
-
raise _("The latest version (#{import_cv['latest_version']}) of"\
|
90
|
-
" the Content View '#{cv['name']}'"\
|
91
|
-
" is greater or equal to the version you are trying to import (#{version})")
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
unless import_cv['repository_ids'].nil?
|
96
|
-
repositories = import_cv['repository_ids'].collect do |repo_id|
|
97
|
-
show(:repositories, 'id' => repo_id)
|
98
|
-
end
|
99
|
-
repositories.each do |repo|
|
100
|
-
if repo['mirror_on_sync'] == true
|
101
|
-
raise _("The Repository '#{repo['name']}' is set with Mirror-on-Sync to YES."\
|
102
|
-
" Please change Mirror-on-Sync to NO and try the import again.")
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def untar_export(options)
|
109
|
-
export_tar_file = options[:filename]
|
110
|
-
export_tar_dir = options[:dirname]
|
111
|
-
export_tar_prefix = options[:prefix]
|
112
|
-
|
113
|
-
Dir.chdir(export_tar_dir) do
|
114
|
-
`tar -xf #{export_tar_file}`
|
115
|
-
end
|
116
|
-
|
117
|
-
Dir.chdir("#{export_tar_dir}/#{export_tar_prefix}") do
|
118
|
-
if File.exist?(export_tar_file.gsub('.tar', '-repos.tar'))
|
119
|
-
`tar -xf #{export_tar_file.gsub('.tar', '-repos.tar')}`
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def obtain_export_params(option_export_tar)
|
125
|
-
export_tar_file = File.basename(option_export_tar)
|
126
|
-
{:filename => export_tar_file,
|
127
|
-
:dirname => File.dirname(option_export_tar),
|
128
|
-
:prefix => export_tar_file.gsub('.tar', '')}
|
129
|
-
end
|
130
|
-
|
131
|
-
def read_json(options)
|
132
|
-
export_tar_file = options[:filename]
|
133
|
-
export_tar_dir = options[:dirname]
|
134
|
-
export_tar_prefix = options[:prefix]
|
135
|
-
|
136
|
-
json_file = export_tar_file.gsub('tar', 'json')
|
137
|
-
json_file = "#{export_tar_dir}/#{export_tar_prefix}/#{json_file}"
|
138
|
-
json_file = File.read(json_file)
|
139
|
-
JSON.parse(json_file)
|
140
|
-
end
|
141
|
-
|
142
|
-
def export_json(export_json_options)
|
143
|
-
content_view_version = export_json_options[:cvv]
|
144
|
-
repositories = export_json_options[:repositories]
|
145
|
-
json = {
|
146
|
-
"name" => content_view_version['content_view']['name'],
|
147
|
-
"major" => content_view_version['major'],
|
148
|
-
"minor" => content_view_version['minor']
|
149
|
-
}
|
150
|
-
json["composite_components"] = export_json_options[:component_cvvs]
|
151
|
-
json["repositories"] = repositories.collect do |repo|
|
152
|
-
{
|
153
|
-
"id" => repo['id'],
|
154
|
-
"label" => repo['label'],
|
155
|
-
"content_type" => repo['content_type'],
|
156
|
-
"backend_identifier" => repo['backend_identifier'],
|
157
|
-
"relative_path" => repo['relative_path'],
|
158
|
-
"on_disk_path" => "#{PUBLISHED_REPOS_DIR}/#{repo['relative_path']}",
|
159
|
-
"rpm_filenames" => repo['packages'].collect { |package| package['filename'] },
|
160
|
-
"errata_ids" => repo['errata'].collect { |errata| errata['errata_id'] }
|
161
|
-
}
|
162
|
-
end
|
163
|
-
json
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
module HammerCLIKatello
|
2
|
-
class GpgKeyCommand < HammerCLIForeman::Command
|
3
|
-
resource :gpg_keys
|
4
|
-
|
5
|
-
class ListCommand < HammerCLIKatello::ListCommand
|
6
|
-
output do
|
7
|
-
field :id, _("ID")
|
8
|
-
field :name, _("Name")
|
9
|
-
end
|
10
|
-
|
11
|
-
build_options
|
12
|
-
end
|
13
|
-
|
14
|
-
class InfoCommand < HammerCLIKatello::InfoCommand
|
15
|
-
output do
|
16
|
-
field :id, _("ID")
|
17
|
-
field :name, _("Name")
|
18
|
-
from :organization do
|
19
|
-
field :name, _("Organization")
|
20
|
-
end
|
21
|
-
|
22
|
-
collection :repositories, "Repositories" do
|
23
|
-
field :id, _("ID")
|
24
|
-
field :name, _("Name")
|
25
|
-
field :content_type, _("Content Type")
|
26
|
-
from :product do
|
27
|
-
field :name, _("Product")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
field :content, _("Content"), Fields::LongText
|
32
|
-
end
|
33
|
-
|
34
|
-
build_options
|
35
|
-
end
|
36
|
-
|
37
|
-
class CreateCommand < HammerCLIKatello::CreateCommand
|
38
|
-
success_message _("GPG Key created.")
|
39
|
-
failure_message _("Could not create GPG Key")
|
40
|
-
|
41
|
-
build_options :without => [:content]
|
42
|
-
option "--key", "GPG_KEY_FILE", _("GPG Key file"),
|
43
|
-
:attribute_name => :option_content,
|
44
|
-
:required => true,
|
45
|
-
:format => HammerCLI::Options::Normalizers::File.new
|
46
|
-
end
|
47
|
-
|
48
|
-
class UpdateCommand < HammerCLIKatello::UpdateCommand
|
49
|
-
success_message _("GPG Key updated.")
|
50
|
-
failure_message _("Could not update GPG Key")
|
51
|
-
|
52
|
-
build_options :without => [:content]
|
53
|
-
option "--key", "GPG_KEY_FILE", _("GPG Key file"),
|
54
|
-
:attribute_name => :option_content,
|
55
|
-
:format => HammerCLI::Options::Normalizers::File.new
|
56
|
-
end
|
57
|
-
|
58
|
-
class DeleteCommand < HammerCLIKatello::DeleteCommand
|
59
|
-
success_message _("GPG Key deleted.")
|
60
|
-
failure_message _("Could not delete the GPG Key")
|
61
|
-
|
62
|
-
build_options
|
63
|
-
end
|
64
|
-
|
65
|
-
autoload_subcommands
|
66
|
-
end
|
67
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
module HammerCLIKatello
|
2
|
-
class PuppetModule < HammerCLIKatello::Command
|
3
|
-
resource :puppet_modules
|
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 :author, _("Author")
|
14
|
-
field :version, _("Version")
|
15
|
-
field :uuid, _("Uuid")
|
16
|
-
end
|
17
|
-
|
18
|
-
build_options do |o|
|
19
|
-
o.expand(:all).including(:organizations, :products, :content_views)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class InfoCommand < HammerCLIKatello::InfoCommand
|
24
|
-
output do
|
25
|
-
field :id, _("ID")
|
26
|
-
field :name, _("Name")
|
27
|
-
field :version, _("Version")
|
28
|
-
field :author, _("Author")
|
29
|
-
field :uuid, _("Uuid")
|
30
|
-
|
31
|
-
field :summary, _("Summary")
|
32
|
-
field :description, _("Description")
|
33
|
-
field :license, _("License")
|
34
|
-
field :project_page, _("Project Page")
|
35
|
-
field :source, _("Source")
|
36
|
-
|
37
|
-
collection :dependencies, _("Dependencies"), :numbered => false do
|
38
|
-
field nil, nil, HammerCLIKatello::Output::Fields::Dependency
|
39
|
-
end
|
40
|
-
collection :checksums, _("File checksums"), :numbered => false do
|
41
|
-
field nil, nil, HammerCLIKatello::Output::Fields::ChecksumFilePair
|
42
|
-
end
|
43
|
-
|
44
|
-
field :tag_list, _("Tag List"), Fields::List
|
45
|
-
|
46
|
-
collection :repositories, _("Repositories") do
|
47
|
-
field :id, _("Id")
|
48
|
-
field :name, _("Name")
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
build_options do |o|
|
53
|
-
o.expand(:all).including(:organizations)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
autoload_subcommands
|
58
|
-
end
|
59
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require_relative '../../test_helper'
|
2
|
-
require 'hammer_cli_katello/content_view_puppet_module'
|
3
|
-
|
4
|
-
module HammerCLIKatello
|
5
|
-
describe ContentViewPuppetModule do
|
6
|
-
it 'allows adding a puppet module' do
|
7
|
-
ex = api_expects(:organizations, :index) do |p|
|
8
|
-
p[:search] == "name = \"org1\""
|
9
|
-
end
|
10
|
-
ex.returns(index_response([{'id' => 1}]))
|
11
|
-
|
12
|
-
ex = api_expects(:content_views, :index) do |p|
|
13
|
-
p['name'] == 'cv' && p['organization_id'] == 1
|
14
|
-
end
|
15
|
-
ex.returns(index_response([{'id' => 3}]))
|
16
|
-
|
17
|
-
api_expects(:content_view_puppet_modules, :create) do |p|
|
18
|
-
p['content_view_id'] == 3
|
19
|
-
end
|
20
|
-
|
21
|
-
run_cmd(%w(content-view puppet-module add --organization org1 --content-view cv --id 1))
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require_relative '../../test_helper'
|
2
|
-
require_relative '../../content_view/content_view_helpers'
|
3
|
-
require_relative '../../organization/organization_helpers'
|
4
|
-
require 'hammer_cli_katello/content_view_puppet_module'
|
5
|
-
|
6
|
-
module HammerCLIKatello
|
7
|
-
describe ContentViewPuppetModule::DeleteCommand do
|
8
|
-
include ContentViewHelpers
|
9
|
-
include OrganizationHelpers
|
10
|
-
|
11
|
-
def expect_module_destroy(opts)
|
12
|
-
api_expects(:content_view_puppet_modules, :destroy).with_params(opts[:params])
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'allows minimal options' do
|
16
|
-
expect_module_destroy(params: {'content_view_id' => 1, 'id' => 2})
|
17
|
-
|
18
|
-
run_cmd(%w(content-view puppet-module remove --content-view-id 1 --id 2))
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'resolves puppet module ID from UUID' do
|
22
|
-
expect_generic_search(:content_view_puppet_modules,
|
23
|
-
params: {'uuid' => 'abcd1234', 'content_view_id' => 1},
|
24
|
-
returns: {'id' => 2})
|
25
|
-
expect_module_destroy(params: {'content_view_id' => 1, 'id' => 2})
|
26
|
-
|
27
|
-
run_cmd(%w(content-view puppet-module remove --content-view-id 1 --uuid abcd1234))
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'resolves content view ID from name' do
|
31
|
-
expect_content_view_search('3', 'cv1', 1)
|
32
|
-
expect_module_destroy(params: {'content_view_id' => 1, 'id' => 2})
|
33
|
-
|
34
|
-
run_cmd(%w(content-view puppet-module remove --content-view cv1 --organization-id 3 --id 2))
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'resolves organization ID from name' do
|
38
|
-
expect_organization_search('org3', 3)
|
39
|
-
expect_content_view_search(3, 'cv1', 1)
|
40
|
-
expect_module_destroy(params: {'content_view_id' => 1, 'id' => 2})
|
41
|
-
|
42
|
-
run_cmd(%w(content-view puppet-module remove --content-view cv1 --organization org3 --id 2))
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'resolves organization ID from label' do
|
46
|
-
expect_organization_search('org3', 3, field: 'label')
|
47
|
-
expect_content_view_search(3, 'cv1', 1)
|
48
|
-
expect_module_destroy(params: {'content_view_id' => 1, 'id' => 2})
|
49
|
-
|
50
|
-
run_cmd(%w(content-view puppet-module remove --content-view cv1 --organization-label
|
51
|
-
org3 --id 2))
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
|
-
|
3
|
-
describe 'content-view version export' do
|
4
|
-
include ForemanTaskHelpers
|
5
|
-
|
6
|
-
before do
|
7
|
-
@cmd = %w(content-view version export-default)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "performs export with bad SELinux" do
|
11
|
-
params = [
|
12
|
-
'--export-dir=/tmp/default'
|
13
|
-
]
|
14
|
-
|
15
|
-
File.expects(:exist?).with('/usr/share/foreman').returns(true)
|
16
|
-
File.stubs(:exist?).with('/var/log/hammer/hammer.log._copy_').returns(false)
|
17
|
-
|
18
|
-
Dir.expects(:mkdir).with('/tmp/default').returns(0)
|
19
|
-
Kernel.expects(:system).with("rsync -aL /var/lib/pulp/published/yum/https/repos/ /tmp/default")
|
20
|
-
|
21
|
-
result = run_cmd(@cmd + params)
|
22
|
-
assert_equal(HammerCLI::EX_CANTCREAT, result.exit_code)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "performs export" do
|
26
|
-
params = [
|
27
|
-
'--export-dir=/tmp/default'
|
28
|
-
]
|
29
|
-
|
30
|
-
File.expects(:exist?).with('/usr/share/foreman').returns(true)
|
31
|
-
File.stubs(:exist?).with('/var/log/hammer/hammer.log._copy_').returns(false)
|
32
|
-
|
33
|
-
Dir.expects(:exist?).with('/tmp/default').returns(0)
|
34
|
-
Kernel.expects(:system).with("rsync -aL /var/lib/pulp/published/yum/https/repos/ /tmp/default")
|
35
|
-
.returns(true)
|
36
|
-
|
37
|
-
result = run_cmd(@cmd + params)
|
38
|
-
assert_equal(HammerCLI::EX_OK, result.exit_code)
|
39
|
-
end
|
40
|
-
end
|