Skip to content

Commit

Permalink
Better error message printing on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Aug 2, 2018
1 parent d2b0a70 commit 636e0a6
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions lib/tasks/evm_ansible.rake
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,30 @@ namespace :evm do
namespace :ansible do
desc "Seed galaxy roles for provider playbooks"
task :seed do
plugins_with_req_yml = Vmdb::Plugins.select do |p|
req_yml_path = p.root.join('content_tmp', 'ansible', 'requirements.yml')
plugins_with_req_yml = Vmdb::Plugins.select do |plugin|
req_yml_path = plugin.root.join('content_tmp', 'ansible', 'requirements.yml')
File.file?(req_yml_path)
end

plugins_with_req_yml.each do |p|
puts "Seeding roles for #{p.name.split("::Engine").first}..."
plugins_with_req_yml.each do |plugin|
puts "Seeding roles for #{plugin.name}..."

roles_path = p.root.join('content_tmp', 'ansible', 'roles')
role_file = p.root.join('content_tmp', 'ansible', 'requirements.yml')
roles_path = plugin.root.join('content_tmp', 'ansible', 'roles')
role_file = plugin.root.join('content_tmp', 'ansible', 'requirements.yml')

AwesomeSpawn.run!(
"ansible-galaxy",
:params => {
nil => "install",
:roles_path= => roles_path,
:role_file= => role_file
}
)
puts "Seeding roles for #{p.name.split("::Engine").first}...Complete"
params = {
nil => "install",
:roles_path= => roles_path,
:role_file= => role_file
}

begin
AwesomeSpawn.run!("ansible-galaxy", :params => params)
puts "Seeding roles for #{plugin.name}...Complete"
rescue AwesomeSpawn::CommandResultError => err
puts "Seeding roles for #{plugin.name}...Failed - #{err.result.error}"
raise
end
end
end
end
Expand Down

0 comments on commit 636e0a6

Please sign in to comment.