aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/remote/leap_plugin.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/leap_cli/remote/leap_plugin.rb')
-rw-r--r--lib/leap_cli/remote/leap_plugin.rb21
1 files changed, 21 insertions, 0 deletions
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