lib/itamae-mitsurin/mitsurin/serverspec_task.rb in itamae-mitsurin-0.21 vs lib/itamae-mitsurin/mitsurin/serverspec_task.rb in itamae-mitsurin-0.22
- old
+ new
@@ -17,10 +17,15 @@
rescue JSON::ParserError => e
puts e.class.to_s + ", " + e.backtrace[0].to_s
puts "nodefile error, nodefile:#{node_file}, reason:#{e.message}"
end
+ node_short = node_attr[:environments][:hostname].split(".")[0]
+ all << node_short
+ desc "Serverspec to all nodes"
+ task :all => all
+
desc "Spec to #{file_name}"
task node_attr[:environments][:hostname].split(".")[0] do
begin
recipes = []
@@ -44,14 +49,10 @@
ssh_password = node_attr[:environments][:ssh_password]
sudo_password = node_attr[:environments][:sudo_password]
ssh_port = node_attr[:environments][:ssh_port]
ssh_key = node_attr[:environments][:ssh_key]
- node_short = node_name.split(".")[0]
- all << node_short
- task :all => all
-
desc "Run spec to #{file_name}"
ENV['TARGET_HOST'] = node_name
ENV['NODE_FILE'] = node_file
ENV['SSH_PASSWORD'] = ssh_password
ENV['SUDO_PASSWORD'] = sudo_password
@@ -75,11 +76,9 @@
puts TaskBase.hl.color(%!Run Serverspec to \"#{node_name}\"!, :red)
puts TaskBase.hl.color(%!Run List to \"#{run_list_noti.uniq.join(", ")}\"!, :green)
st = system specs
exit 1 unless st
end
- desc "Serverspec to all nodes"
- task :all => 'spec:all'
end
end
end
end