lib/commands/config_amazon.rb in zzdeploy-0.1.0 vs lib/commands/config_amazon.rb in zzdeploy-0.1.2
- old
+ new
@@ -41,21 +41,21 @@
:aws_access_key_id => access_key,
:aws_secret_access_key => secret_key
}
# make sure the chef dir exists
+ chef_dir = "/var/chef"
`sudo mkdir -p #{chef_dir}`
# generate the json into a temp file
json = JSON.pretty_generate(info)
- chef_dir = "/var/chef"
amazon_path = "#{chef_dir}/amazon.json"
temp_path = File.expand_path('.', "~/amazon_temp.json")
File.open(temp_path, 'w') {|f| f.write(json) }
# now move the file and set permissions
`sudo cp #{temp_path} #{amazon_path}`
- cmd = "sudo chown `whoami`:`whoami` #{amazon_path} && sudo chmod 0644 #{amazon_path}"
+ cmd = "sudo chown `whoami` #{amazon_path} && sudo chmod 0644 #{amazon_path}"
`#{cmd}`
# remove the temp file
`rm -f #{temp_path}`
puts "Your amazon config has been saved to #{amazon_path}"
end