Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Commit

Permalink
Fixes #19718 - Allow import of unpublished CVs
Browse files Browse the repository at this point in the history
  • Loading branch information
akofink committed Jun 6, 2017
1 parent 0030fb4 commit ebb0044
Show file tree
Hide file tree
Showing 6 changed files with 64,090 additions and 3 deletions.
9 changes: 7 additions & 2 deletions lib/hammer_cli_csv/content_views.rb
Expand Up @@ -124,8 +124,13 @@ def create_contentviews_from_csv(line)
contentview_id = contentview['id']

# Content views cannot be used in composites unless a publish has occurred
publish_content_view(contentview_id, line) if contentview['versions'].empty?
promote_content_view(contentview_id, line)
if contentview['versions'].empty? && !line[ENVIRONMENTS].empty?
publish_content_view(contentview_id, line)
end

unless line[ENVIRONMENTS].empty?
promote_content_view(contentview_id, line)
end

puts _('done') if option_verbose?
end
Expand Down
22 changes: 22 additions & 0 deletions test/csv_test_helper.rb
Expand Up @@ -108,6 +108,28 @@ def host_delete(hostname)
end
end

def content_view_delete(name)
org = 'Test Corporation'
id = nil
stdout,stderr = capture {
hammer.run(%W(content-view list --search #{name}))
}
lines = stdout.split("\n")
if lines.length == 5
id = lines[3].split(" ")[0]
end

if id
stdout,stderr = capture {
hammer.run(%W(content-view remove --id #{id} --organization #{org} --environments Library))
}

stdout,stderr = capture {
hammer.run(%W(content-view delete --id #{id}))
}
end
end

require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
require File.join(File.dirname(__FILE__), 'helpers/command')
require File.join(File.dirname(__FILE__), 'helpers/resource_disabled')
2 changes: 1 addition & 1 deletion test/data/content-views.csv
Expand Up @@ -3,4 +3,4 @@ Katello,1,Mega Corporation,"Katello - The Sysadmin's Fortress",No,katello-1.4,Li
Katello,1,Mega Corporation,"Katello - The Sysadmin's Fortress",No,katello-1.4-client,Library
RHEL 6Server (Minimal),1,Mega Corporation,"RHEL 6Server - minimal installation",No,Red Hat Enterprise Linux 6 Server RPMs x86_64 6Server,Library
RHEL 6.1 Kickstart,1,Mega Corporation,"RHEL 6.1 Kickstart",No,Red Hat Enterprise Linux 6 Server Kickstart x86_64 6.1,Library

Blank CV,Mega Corporation,"The blank unpublished CV",No,"",""

0 comments on commit ebb0044

Please sign in to comment.