lib/kitchen/provisioner/cfengine.rb in kitchen-cfengine-0.0.3 vs lib/kitchen/provisioner/cfengine.rb in kitchen-cfengine-0.0.5
- old
+ new
@@ -30,30 +30,36 @@
lines = [Kitchen::Util.shell_helpers, install_cfengine, install_busser]
lines.join("\n")
end
def init_command
+ cfengine_files = File.join(config[:root_path], "cfengine_files")
+
if config[:cfengine_policy_server_address] == ""
<<-INIT
+ #{sudo("rm")} -rf #{cfengine_files}
+ mkdir -p #{config[:root_path]}
if [ ! -e "/var/cfengine/policy_server.dat" ]
then
LANG=en /sbin/ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1 }' | head -n 1 | xargs #{sudo('/var/cfengine/bin/cf-agent')} --bootstrap
fi
INIT
else
<<-INIT
+ #{sudo("rm")} -rf #{cfengine_files}
+ mkdir -p #{config[:root_path]}
if [ ! -e "/var/cfengine/policy_server.dat" ]
then
#{sudo('/var/cfengine/bin/cf-agent')} --bootstrap #{config[:cfengine_policy_server_address]}
fi
INIT
end
end
def prepare_command
<<-PREP
- #{sudo('cp')} -rf #{config[:root_path]}/* /var/cfengine
+ #{sudo('cp')} -rf #{config[:root_path]}/cfengine_files/* /var/cfengine
#{sudo('/var/cfengine/bin/cf-agent')} -KI -f failsafe.cf
sleep 5
PREP
end
@@ -90,10 +96,10 @@
<<-INSTALL
if [ ! -d "/var/cfengine" ]
then
echo "-----> Installing cfengine (#{config[:cfenging_type]})"
do_download #{cfengine_quick_install_url} /tmp/install.sh
- #{sudo('sh')} /tmp/install.sh
+ #{sudo('bash')} /tmp/install.sh
fi
INSTALL
end
def install_busser