diff options
Diffstat (limited to 'lib/leap_cli')
-rw-r--r-- | lib/leap_cli/commands/ca.rb | 3 | ||||
-rw-r--r-- | lib/leap_cli/commands/compile.rb | 1 | ||||
-rw-r--r-- | lib/leap_cli/commands/inspect.rb | 2 | ||||
-rw-r--r-- | lib/leap_cli/commands/node.rb | 2 | ||||
-rw-r--r-- | lib/leap_cli/commands/node_init.rb | 10 | ||||
-rw-r--r-- | lib/leap_cli/commands/test.rb | 4 | ||||
-rw-r--r-- | lib/leap_cli/macros/haproxy.rb | 2 | ||||
-rw-r--r-- | lib/leap_cli/macros/keys.rb | 2 |
8 files changed, 12 insertions, 14 deletions
diff --git a/lib/leap_cli/commands/ca.rb b/lib/leap_cli/commands/ca.rb index 1b311eee..6abffe7b 100644 --- a/lib/leap_cli/commands/ca.rb +++ b/lib/leap_cli/commands/ca.rb @@ -39,7 +39,7 @@ module LeapCli; module Commands if cmd_exists?('certtool') log 0, 'Generating DH parameters (takes a long time)...' output = assert_run!('certtool --generate-dh-params --sec-param high') - output.sub! /.*(-----BEGIN DH PARAMETERS-----.*-----END DH PARAMETERS-----).*/m, '\1' + output.sub!(/.*(-----BEGIN DH PARAMETERS-----.*-----END DH PARAMETERS-----).*/m, '\1') output << "\n" write_file!(:dh_params, output) else @@ -116,7 +116,6 @@ module LeapCli; module Commands digest = options[:digest] || server_certificates.digest log :generating, "CSR with #{digest} digest and #{print_dn(dn)}" do csr = create_csr(dn, keypair, digest) - request = csr.to_x509_csr write_file! [:commercial_csr, domain], csr.to_pem end diff --git a/lib/leap_cli/commands/compile.rb b/lib/leap_cli/commands/compile.rb index f9079279..92c879d7 100644 --- a/lib/leap_cli/commands/compile.rb +++ b/lib/leap_cli/commands/compile.rb @@ -284,7 +284,6 @@ remove this directory if you don't use it. # note: we use the default provider for all nodes, because we use it # to generate hostnames that are relative to the default domain. provider = manager.env('default').provider - hosts_seen = {} lines = [] # diff --git a/lib/leap_cli/commands/inspect.rb b/lib/leap_cli/commands/inspect.rb index 20654fa7..6f58a65f 100644 --- a/lib/leap_cli/commands/inspect.rb +++ b/lib/leap_cli/commands/inspect.rb @@ -26,7 +26,7 @@ module LeapCli; module Commands } def inspection_method(object) - if File.exists?(object) + if File.exist?(object) ftype = `file #{object}`.split(':').last.strip log 2, "file is of type '#{ftype}'" if FTYPE_MAP[ftype] diff --git a/lib/leap_cli/commands/node.rb b/lib/leap_cli/commands/node.rb index a23661b3..1dce437e 100644 --- a/lib/leap_cli/commands/node.rb +++ b/lib/leap_cli/commands/node.rb @@ -43,7 +43,7 @@ module LeapCli; module Commands if file_exists? :ca_cert, :ca_key generate_cert_for_node(manager.reload_node!(node)) end - rescue LeapCli::ConfigError => exc + rescue LeapCli::ConfigError remove_node_files(name) end end diff --git a/lib/leap_cli/commands/node_init.rb b/lib/leap_cli/commands/node_init.rb index 33f6288d..9698a789 100644 --- a/lib/leap_cli/commands/node_init.rb +++ b/lib/leap_cli/commands/node_init.rb @@ -6,14 +6,14 @@ module LeapCli; module Commands desc 'Node management' - command :node do |node| - node.desc 'Bootstraps a node or nodes, setting up SSH keys and installing prerequisite packages' - node.long_desc "This command prepares a server to be used with the LEAP Platform by saving the server's SSH host key, " + + command :node do |cmd| + cmd.desc 'Bootstraps a node or nodes, setting up SSH keys and installing prerequisite packages' + cmd.long_desc "This command prepares a server to be used with the LEAP Platform by saving the server's SSH host key, " + "copying the authorized_keys file, installing packages that are required for deploying, and registering important facts. " + "Node init must be run before deploying to a server, and the server must be running and available via the network. " + "This command only needs to be run once, but there is no harm in running it multiple times." - node.arg_name 'FILTER' - node.command :init do |init| + cmd.arg_name 'FILTER' + cmd.command :init do |init| init.switch 'echo', :desc => 'If set, passwords are visible as you type them (default is hidden)', :negatable => false init.flag :port, :desc => 'Override the default SSH port.', :arg_name => 'PORT' init.flag :ip, :desc => 'Override the default SSH IP address.', :arg_name => 'IPADDRESS' diff --git a/lib/leap_cli/commands/test.rb b/lib/leap_cli/commands/test.rb index 73207b31..f506d849 100644 --- a/lib/leap_cli/commands/test.rb +++ b/lib/leap_cli/commands/test.rb @@ -8,7 +8,7 @@ module LeapCli; module Commands run.switch 'continue', :desc => 'Continue over errors and failures (default is --no-continue).', :negatable => true run.action do |global_options,options,args| test_order = File.join(Path.platform, 'tests/order.rb') - if File.exists?(test_order) + if File.exist?(test_order) require test_order end manager.filter!(args).names_in_test_dependency_order.each do |node_name| @@ -17,7 +17,7 @@ module LeapCli; module Commands ssh_connect(node) do |ssh| ssh.run(test_cmd(options)) end - rescue Capistrano::CommandError => exc + rescue Capistrano::CommandError if options[:continue] exit_status(1) else diff --git a/lib/leap_cli/macros/haproxy.rb b/lib/leap_cli/macros/haproxy.rb index 602ae726..3fef24c4 100644 --- a/lib/leap_cli/macros/haproxy.rb +++ b/lib/leap_cli/macros/haproxy.rb @@ -26,7 +26,7 @@ module LeapCli # create a simple map for node name -> local stunnel accept port accept_ports = stunnel_clients.inject({}) do |hsh, stunnel_entry| - name = stunnel_entry.first.sub /_[0-9]+$/, '' + name = stunnel_entry.first.sub(/_[0-9]+$/, '') hsh[name] = stunnel_entry.last['accept_port'] hsh end diff --git a/lib/leap_cli/macros/keys.rb b/lib/leap_cli/macros/keys.rb index e7a75cfb..9dd9b34f 100644 --- a/lib/leap_cli/macros/keys.rb +++ b/lib/leap_cli/macros/keys.rb @@ -56,7 +56,7 @@ module LeapCli require 'base64' require 'openssl' path = Path.find_file([path_name, self.name]) - if path && File.exists?(path) + if path && File.exist?(path) public_key_str = File.readlines(path).grep(/^[^-]/).join public_key = Base64.decode64(public_key_str) public_key = public_key.slice(22..-1) # Tor ignores the 22 byte SPKI header |