stack-kicker 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stack-kicker/version.rb +1 -1
- data/lib/stack.rb +10 -3
- metadata +1 -1
data/lib/stack-kicker/version.rb
CHANGED
data/lib/stack.rb
CHANGED
@@ -384,6 +384,11 @@ cookbook_path [ '<%=config[:stackhome]%>/cookbooks' ]
|
|
384
384
|
role_details[:security_group] = role.to_s
|
385
385
|
end
|
386
386
|
|
387
|
+
# default to execing post install scripts in stackhome is a cwd wasn't set
|
388
|
+
if role_details[:post_install_cwd].nil?
|
389
|
+
role_details[:post_install_cwd] = config[:stackhome]
|
390
|
+
end
|
391
|
+
|
387
392
|
(1..role_details[:count]).each do |p|
|
388
393
|
Logger.debug { "Populating the config[:role_details][:azs] array with AZ" }
|
389
394
|
role_details[:azs] = Array.new if role_details[:azs].nil?
|
@@ -733,7 +738,7 @@ cookbook_path [ '<%=config[:stackhome]%>/cookbooks' ]
|
|
733
738
|
# attach a floating IP to this if we have one
|
734
739
|
if role_details[:floating_ips] && role_details[:floating_ips][p-1]
|
735
740
|
floating_ip = role_details[:floating_ips][p-1]
|
736
|
-
Logger.info "Attaching #{floating_ip} to #{hostname}\n"
|
741
|
+
Logger.info "Attaching #{floating_ip} to #{hostname}\n via 'nova add-floating-ip'"
|
737
742
|
# nova --os-region-name $REGION add-floating-ip $SERVER_NAME $FLOATING_IP
|
738
743
|
floating_ip_add = `nova --os-region-name #{node_details[hostname][:az]} add-floating-ip #{hostname} #{floating_ip}`
|
739
744
|
Logger.info floating_ip_add
|
@@ -744,6 +749,7 @@ cookbook_path [ '<%=config[:stackhome]%>/cookbooks' ]
|
|
744
749
|
|
745
750
|
# run any post-install scripts, these are run from the current host, not the nodes
|
746
751
|
if role_details[:post_install_script]
|
752
|
+
Logger.debug { "This role has a post-install script (#{role_details[:post_install_script]}, preparing to run" }
|
747
753
|
# convert when we got passed to an absolute path
|
748
754
|
post_install_script_abs = File.realpath(config[:stackhome] + '/' + role_details[:post_install_script])
|
749
755
|
post_install_cwd_abs = File.realpath(config[:stackhome] + '/' + role_details[:post_install_cwd])
|
@@ -751,8 +757,9 @@ cookbook_path [ '<%=config[:stackhome]%>/cookbooks' ]
|
|
751
757
|
# replace any tokens in the argument
|
752
758
|
public_ip = Stack.get_public_ip(config, hostname)
|
753
759
|
role_details[:post_install_args].sub!(%q!%PUBLIC_IP%!, public_ip)
|
754
|
-
|
755
|
-
|
760
|
+
|
761
|
+
# we system this, so that the script can give live feed back
|
762
|
+
Logger.info "Executing '#{post_install_script_abs} #{role_details[:post_install_args]}' in #{post_install_cwd_abs} as the post_install_script"
|
756
763
|
system("cd #{post_install_cwd_abs} ; #{post_install_script_abs} #{role_details[:post_install_args]}")
|
757
764
|
end
|
758
765
|
else
|