From 3e7c500dda3a1998a892a9ee06dabf5a2fa70f38 Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 5 Dec 2013 16:26:36 -0800 Subject: added no-deploy check and simple `leap test run`. --- lib/leap_cli/remote/leap_plugin.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/leap_cli/remote') diff --git a/lib/leap_cli/remote/leap_plugin.rb b/lib/leap_cli/remote/leap_plugin.rb index 04b1e2c..a284712 100644 --- a/lib/leap_cli/remote/leap_plugin.rb +++ b/lib/leap_cli/remote/leap_plugin.rb @@ -21,6 +21,9 @@ module LeapCli; module Remote; module LeapPlugin run dirs.collect{|dir| "mkdir -m 700 -p #{dir}; "}.join end + # + # echos "ok" if the node has been initialized and the required packages are installed, bails out otherwise. + # def assert_initialized begin test_initialized_file = "test -f #{INITIALIZED_FILE}" @@ -35,6 +38,24 @@ module LeapCli; module Remote; module LeapPlugin end end + # + # bails out the deploy if the file /etc/leap/no-deploy exists. + # This kind of sucks, because it would be better to skip over nodes that have no-deploy set instead + # halting the entire deploy. As far as I know, with capistrano, there is no way to close one of the + # ssh connections in the pool and make sure it gets no further commands. + # + def check_for_no_deploy + begin + run "test ! -f /etc/leap/no-deploy" + rescue Capistrano::CommandError => exc + LeapCli::Util.bail! do + exc.hosts.each do |host| + LeapCli::Util.log "Can't continue because file /etc/leap/no-deploy exists", :host => host + end + end + end + end + def mark_initialized run "touch #{INITIALIZED_FILE}" end -- cgit v1.2.3