summaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-02-08 13:01:19 -0800
committerelijah <elijah@riseup.net>2015-02-08 13:01:19 -0800
commit5130afca6ff1f5ec49b8abeaccfbe17dec129e32 (patch)
treec527c4ac1b15fda138d27b8a93db4eb770b1d104 /lib/leap_cli/commands
parenta32c332963e3bca8ab4bd40b636d36a77468e219 (diff)
pass --info to puppet_command (needed to support logging deploy details)
Diffstat (limited to 'lib/leap_cli/commands')
-rw-r--r--lib/leap_cli/commands/deploy.rb40
1 files changed, 33 insertions, 7 deletions
diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb
index 204be5f..a0b7c20 100644
--- a/lib/leap_cli/commands/deploy.rb
+++ b/lib/leap_cli/commands/deploy.rb
@@ -1,3 +1,4 @@
+require 'etc'
module LeapCli
module Commands
@@ -7,20 +8,17 @@ module LeapCli
arg_name 'FILTER'
command [:deploy, :d] do |c|
- # --fast
c.switch :fast, :desc => 'Makes the deploy command faster by skipping some slow steps. A "fast" deploy can be used safely if you recently completed a normal deploy.',
:negatable => false
- # --sync
- c.switch :sync, :desc => "Sync files, but don't actually apply recipes."
+ c.switch :sync, :desc => "Sync files, but don't actually apply recipes.", :negatable => false
- # --force
c.switch :force, :desc => 'Deploy even if there is a lockfile.', :negatable => false
- # --dev
+ c.switch :downgrade, :desc => 'Allows deploy to run with an older platform version.', :negatable => false
+
c.switch :dev, :desc => "Development mode: don't run 'git submodule update' before deploy.", :negatable => false
- # --tags
c.flag :tags, :desc => 'Specify tags to pass through to puppet (overriding the default).',
:arg_name => 'TAG[,TAG]'
@@ -71,7 +69,12 @@ module LeapCli
end
unless options[:sync]
ssh.leap.log :applying, "puppet" do
- ssh.puppet.apply(:verbosity => [LeapCli.log_level,5].min, :tags => tags(options), :force => options[:force])
+ ssh.puppet.apply(:verbosity => [LeapCli.log_level,5].min,
+ :tags => tags(options),
+ :force => options[:force],
+ :info => deploy_info,
+ :downgrade => options[:downgrade]
+ )
end
end
end
@@ -297,5 +300,28 @@ module LeapCli
return custom_files
end
+ def deploy_info
+ info = []
+ info << "user: %s" % Etc.getpwuid(Process.euid).name
+ if is_git_directory?(Path.platform) && current_git_branch(Path.platform) != 'master'
+ info << "platform: %s (%s %s)" % [
+ Leap::Platform.version,
+ current_git_branch(Path.platform),
+ current_git_commit(Path.platform)[0..4]
+ ]
+ else
+ info << "platform: %s" % Leap::Platform.version
+ end
+ if is_git_directory?(LEAP_CLI_BASE_DIR)
+ info << "leap_cli: %s (%s %s)" % [
+ LeapCli::VERSION,
+ current_git_branch(LEAP_CLI_BASE_DIR),
+ current_git_commit(LEAP_CLI_BASE_DIR)[0..4]
+ ]
+ else
+ info << "leap_cli: %s" % LeapCli::VERSION
+ end
+ info.join(', ')
+ end
end
end