summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-04-08 18:14:09 -0700
committerelijah <elijah@riseup.net>2015-04-08 18:14:09 -0700
commitddd160afb1fd2c729cf806de879add5a15cafe31 (patch)
tree5abe3076a055eb85bec95c7e682cd9a1f6e9f191
parent2dc48bf4bcf0f98fe715233c3746b7affc0a9175 (diff)
added `leap history` command to dump the recent deploy history to console
-rw-r--r--lib/leap_cli/commands/deploy.rb16
-rw-r--r--lib/leap_cli/remote/leap_plugin.rb7
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb
index a0b7c20..394ea61 100644
--- a/lib/leap_cli/commands/deploy.rb
+++ b/lib/leap_cli/commands/deploy.rb
@@ -84,6 +84,22 @@ module LeapCli
end
end
+ desc 'Display recent deployment history for a set of nodes.'
+ long_desc 'The FILTER can be the name of a node, service, or tag.'
+ arg_name 'FILTER'
+ command [:history, :h] do |c|
+ c.flag :port, :desc => 'Override the default SSH port.',
+ :arg_name => 'PORT'
+ c.flag :ip, :desc => 'Override the default SSH IP address.',
+ :arg_name => 'IPADDRESS'
+ c.action do |global,options,args|
+ nodes = manager.filter!(args)
+ ssh_connect(nodes, connect_options(options)) do |ssh|
+ ssh.leap.history
+ end
+ end
+ end
+
private
#
diff --git a/lib/leap_cli/remote/leap_plugin.rb b/lib/leap_cli/remote/leap_plugin.rb
index af88c2a..c155097 100644
--- a/lib/leap_cli/remote/leap_plugin.rb
+++ b/lib/leap_cli/remote/leap_plugin.rb
@@ -61,6 +61,13 @@ module LeapCli; module Remote; module LeapPlugin
end
#
+ # dumps the recent deploy history to the console
+ #
+ def history
+ run "(test -s /var/log/leap/deploy-summary.log && tail /var/log/leap/deploy-summary.log) || (test -s /var/log/leap/deploy-summary.log.1 && tail /var/log/leap/deploy-summary.log.1) || (echo 'no history')"
+ end
+
+ #
# This is a hairy ugly hack, exactly the kind of stuff that makes ruby
# dangerous and too much fun for its own good.
#