diff options
author | elijah <elijah@riseup.net> | 2014-05-13 01:52:58 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2014-05-13 01:52:58 -0700 |
commit | 8beaa3bd0a7c8b38ef7f97c245ddc7f021c16dd9 (patch) | |
tree | 87981a7558e272ea176fe45149f6e24cbf7af9b5 /lib | |
parent | 53390d13f1a4da8aed0c4fb70240b9f487120930 (diff) | |
download | leap_cli-8beaa3bd0a7c8b38ef7f97c245ddc7f021c16dd9.tar.gz leap_cli-8beaa3bd0a7c8b38ef7f97c245ddc7f021c16dd9.tar.bz2 |
bail `node init` on bad `apt-get update` (closes #3849)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap_cli/log.rb | 1 | ||||
-rw-r--r-- | lib/leap_cli/remote/tasks.rb | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/leap_cli/log.rb b/lib/leap_cli/log.rb index 69e9f67..f496b9a 100644 --- a/lib/leap_cli/log.rb +++ b/lib/leap_cli/log.rb @@ -80,6 +80,7 @@ module LeapCli if title prefix_options = case title when :error then ['error', :red, :bold] + when :fatal_error then ['fatal error', :red, :bold] when :warning then ['warning:', :yellow, :bold] when :info then ['info', :cyan, :bold] when :updated then ['updated', :cyan, :bold] diff --git a/lib/leap_cli/remote/tasks.rb b/lib/leap_cli/remote/tasks.rb index 0a12a95..e66b0a8 100644 --- a/lib/leap_cli/remote/tasks.rb +++ b/lib/leap_cli/remote/tasks.rb @@ -30,12 +30,23 @@ task :install_insecure_vagrant_key, :max_hosts => MAX_HOSTS do end end +BAD_APT_GET_UPDATE = /(BADSIG|NO_PUBKEY|KEYEXPIRED|REVKEYSIG|NODATA)/ + task :install_prerequisites, :max_hosts => MAX_HOSTS do apt_get = "DEBIAN_FRONTEND=noninteractive apt-get -q -y -o DPkg::Options::=--force-confold" leap.mkdirs LeapCli::PUPPET_DESTINATION run "echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen" leap.log :updating, "package list" do - run "apt-get update" + run "apt-get update" do |channel, stream, data| + # sadly exitcode is unreliable measure if apt-get update hit a failure. + if data =~ BAD_APT_GET_UPDATE + LeapCli::Util.bail! do + LeapCli::Util.log :fatal_error, "in `apt-get update`: #{data}", :host => channel[:host] + end + else + logger.log(1, data, channel[:host]) + end + end end leap.log :updating, "server time" do run "( test -f /etc/init.d/ntp && /etc/init.d/ntp stop ) || true" |