def build_and_upload
progress 'Building and uploading puppet modules'
prod_name = 'Imported Satellite5 Configuration Files'
@modules.each do |mname, files|
data = files[0]
module_dir = build_puppet_module(mname)
product_hash = mk_product_hash(data, prod_name)
composite_id = [data['org_id'].to_i, prod_name]
product_id = create_entity(:products, product_hash, composite_id)['id']
repo_hash = mk_repo_hash data, product_id
repo = create_entity(:puppet_repositories, repo_hash,
[data['org_id'].to_i, data['channel_id'].to_i])
built_module_path = File.join(File.join(module_dir, 'pkg'),
"#{mname}-#{@interview_answers['version']}.tar.gz")
info "Uploading #{built_module_path}"
rc = system "hammer --username #{api_usr} --password #{api_pwd} " \
"repository upload-content --id #{repo['id']} --path #{built_module_path}"
if rc
report_summary :uploaded, :puppet_modules
else
report_summary :failed, :puppet_modules
end
end
end