aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-11-13 22:49:32 -0800
committerelijah <elijah@riseup.net>2012-11-13 22:49:32 -0800
commit10bd0ba9d66a32cb8e0f7fb322843005b23181b7 (patch)
tree5768b4fc787b189b5df9035596d7de945342852f /lib/leap_cli/commands
parent622236c3ad6abc4aef200cc2d4fc2a09effd8647 (diff)
downloadleap_cli-10bd0ba9d66a32cb8e0f7fb322843005b23181b7.tar.gz
leap_cli-10bd0ba9d66a32cb8e0f7fb322843005b23181b7.tar.bz2
cleaned up logging, and much improved error message when file is not found
Diffstat (limited to 'lib/leap_cli/commands')
-rw-r--r--lib/leap_cli/commands/ca.rb4
-rw-r--r--lib/leap_cli/commands/deploy.rb2
-rw-r--r--lib/leap_cli/commands/node.rb10
-rw-r--r--lib/leap_cli/commands/user.rb4
-rw-r--r--lib/leap_cli/commands/vagrant.rb2
5 files changed, 11 insertions, 11 deletions
diff --git a/lib/leap_cli/commands/ca.rb b/lib/leap_cli/commands/ca.rb
index 94a173c..e0b57da 100644
--- a/lib/leap_cli/commands/ca.rb
+++ b/lib/leap_cli/commands/ca.rb
@@ -87,11 +87,11 @@ module LeapCli; module Commands
c.action do |global_options,options,args|
long_running do
if cmd_exists?('certtool')
- progress('Generating DH parameters (takes a long time)...')
+ log 0, 'Generating DH parameters (takes a long time)...'
output = assert_run!('certtool --generate-dh-params --sec-param high')
write_file!(:dh_params, output)
else
- progress('Generating DH parameters (takes a REALLY long time)...')
+ log 0, 'Generating DH parameters (takes a REALLY long time)...'
output = OpenSSL::PKey::DH.generate(3248).to_pem
write_file!(:dh_params, output)
end
diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb
index 13fcb1d..84c7846 100644
--- a/lib/leap_cli/commands/deploy.rb
+++ b/lib/leap_cli/commands/deploy.rb
@@ -56,7 +56,7 @@ module LeapCli
statuses.strip.split("\n").each do |status_line|
if status_line =~ /^-/
submodule = status_line.split(' ')[1]
- progress "Updating submodule #{submodule}"
+ log "Updating submodule #{submodule}"
assert_run! "git submodule update --init #{submodule}"
end
end
diff --git a/lib/leap_cli/commands/node.rb b/lib/leap_cli/commands/node.rb
index 4956d64..61e463b 100644
--- a/lib/leap_cli/commands/node.rb
+++ b/lib/leap_cli/commands/node.rb
@@ -26,7 +26,7 @@ module LeapCli; module Commands
ssh.install_authorized_keys
ssh.install_prerequisites
end
- progress("Completed: init-node #{node.name}")
+ log("Completed: init-node #{node.name}")
end
end
@@ -87,17 +87,17 @@ module LeapCli; module Commands
# see `man sshd` for the format of known_hosts
#
def save_public_host_key(node)
- progress("Fetching public SSH host key for #{node.name}")
+ log("Fetching public SSH host key for #{node.name}")
public_key = get_public_key_for_ip(node.ip_address, node.ssh.port)
pub_key_path = Path.named_path([:node_ssh_pub_key, node.name])
if Path.exists?(pub_key_path)
if public_key == SshKey.load_from_file(pub_key_path)
- progress("Public SSH host key for #{node.name} has not changed")
+ log("Public SSH host key for #{node.name} has not changed")
else
bail!("WARNING: The public SSH host key we just fetched for #{node.name} doesn't match what we have saved previously. Remove the file #{pub_key_path} if you really want to change it.")
end
elsif public_key.in_known_hosts?(node.name, node.ip_address, node.domain.name)
- progress("Public SSH host key for #{node.name} is trusted (key found in your ~/.ssh/known_hosts)")
+ log("Public SSH host key for #{node.name} is trusted (key found in your ~/.ssh/known_hosts)")
else
puts
say("This is the SSH host key you got back from node \"#{node.name}\"")
@@ -123,7 +123,7 @@ module LeapCli; module Commands
end
def ping_node(node)
- progress("Pinging #{node.name}")
+ log("Pinging #{node.name}")
assert_run!("ping -W 1 -c 1 #{node.ip_address}", "Could not ping #{node.name} (address #{node.ip_address}). Try again, we only send a single ping.")
end
diff --git a/lib/leap_cli/commands/user.rb b/lib/leap_cli/commands/user.rb
index 22ed9c9..aed29b7 100644
--- a/lib/leap_cli/commands/user.rb
+++ b/lib/leap_cli/commands/user.rb
@@ -94,7 +94,7 @@ module LeapCli
def pick_pgp_key
secret_keys = GPGME::Key.find(:secret)
if secret_keys.empty?
- progress("Skipping OpenPGP setup because I could not find any OpenPGP keys for you")
+ log "Skipping OpenPGP setup because I could not find any OpenPGP keys for you"
return nil
end
@@ -126,7 +126,7 @@ module LeapCli
buffer << " "
buffer << ssh_key
buffer << " "
- buffer << relative_path(keyfile)
+ buffer << Path.relative_path(keyfile)
buffer << "\n"
end
write_file!(:authorized_keys, buffer.string)
diff --git a/lib/leap_cli/commands/vagrant.rb b/lib/leap_cli/commands/vagrant.rb
index 07bb863..4a480ff 100644
--- a/lib/leap_cli/commands/vagrant.rb
+++ b/lib/leap_cli/commands/vagrant.rb
@@ -48,7 +48,7 @@ module LeapCli; module Commands
end
def execute(cmd)
- progress2 "Running: #{cmd}"
+ log 2, :run, cmd
exec cmd
end