leap_cli 1.5.6 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/leap +29 -6
- data/lib/leap/platform.rb +36 -1
- data/lib/leap_cli/commands/ca.rb +97 -20
- data/lib/leap_cli/commands/compile.rb +49 -8
- data/lib/leap_cli/commands/db.rb +13 -4
- data/lib/leap_cli/commands/deploy.rb +138 -29
- data/lib/leap_cli/commands/env.rb +76 -0
- data/lib/leap_cli/commands/facts.rb +10 -3
- data/lib/leap_cli/commands/inspect.rb +2 -2
- data/lib/leap_cli/commands/list.rb +10 -10
- data/lib/leap_cli/commands/node.rb +7 -132
- data/lib/leap_cli/commands/node_init.rb +169 -0
- data/lib/leap_cli/commands/pre.rb +4 -27
- data/lib/leap_cli/commands/ssh.rb +152 -0
- data/lib/leap_cli/commands/test.rb +22 -13
- data/lib/leap_cli/commands/user.rb +12 -4
- data/lib/leap_cli/commands/vagrant.rb +4 -4
- data/lib/leap_cli/config/filter.rb +175 -0
- data/lib/leap_cli/config/manager.rb +130 -61
- data/lib/leap_cli/config/node.rb +32 -0
- data/lib/leap_cli/config/object.rb +69 -44
- data/lib/leap_cli/config/object_list.rb +44 -39
- data/lib/leap_cli/config/secrets.rb +24 -12
- data/lib/leap_cli/config/tag.rb +7 -0
- data/lib/{core_ext → leap_cli/core_ext}/boolean.rb +0 -0
- data/lib/{core_ext → leap_cli/core_ext}/hash.rb +0 -0
- data/lib/{core_ext → leap_cli/core_ext}/json.rb +0 -0
- data/lib/{core_ext → leap_cli/core_ext}/nil.rb +0 -0
- data/lib/{core_ext → leap_cli/core_ext}/string.rb +0 -0
- data/lib/leap_cli/core_ext/yaml.rb +29 -0
- data/lib/leap_cli/exceptions.rb +24 -0
- data/lib/leap_cli/leapfile.rb +60 -10
- data/lib/{lib_ext → leap_cli/lib_ext}/capistrano_connections.rb +0 -0
- data/lib/{lib_ext → leap_cli/lib_ext}/gli.rb +0 -0
- data/lib/leap_cli/log.rb +1 -1
- data/lib/leap_cli/logger.rb +18 -1
- data/lib/leap_cli/markdown_document_listener.rb +1 -1
- data/lib/leap_cli/override/json.rb +11 -0
- data/lib/leap_cli/path.rb +20 -6
- data/lib/leap_cli/remote/leap_plugin.rb +2 -2
- data/lib/leap_cli/remote/puppet_plugin.rb +1 -1
- data/lib/leap_cli/remote/rsync_plugin.rb +1 -1
- data/lib/leap_cli/remote/tasks.rb +1 -1
- data/lib/leap_cli/ssh_key.rb +63 -1
- data/lib/leap_cli/util/remote_command.rb +19 -2
- data/lib/leap_cli/util/secret.rb +1 -1
- data/lib/leap_cli/util/x509.rb +3 -2
- data/lib/leap_cli/util.rb +11 -3
- data/lib/leap_cli/version.rb +2 -2
- data/lib/leap_cli.rb +24 -14
- data/vendor/certificate_authority/lib/certificate_authority/certificate.rb +85 -29
- data/vendor/certificate_authority/lib/certificate_authority/distinguished_name.rb +5 -0
- data/vendor/certificate_authority/lib/certificate_authority/extensions.rb +406 -41
- data/vendor/certificate_authority/lib/certificate_authority/key_material.rb +0 -34
- data/vendor/certificate_authority/lib/certificate_authority/serial_number.rb +6 -0
- data/vendor/certificate_authority/lib/certificate_authority/signing_request.rb +36 -1
- metadata +25 -24
- data/lib/leap_cli/commands/shell.rb +0 -89
- data/lib/leap_cli/config/macros.rb +0 -430
- data/lib/leap_cli/constants.rb +0 -7
- data/lib/leap_cli/requirements.rb +0 -19
- data/lib/lib_ext/markdown_document_listener.rb +0 -122
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Object
|
2
|
+
#
|
3
|
+
# ya2yaml will output hash keys in sorted order, but it outputs arrays
|
4
|
+
# in natural order. This new method, sorted_ya2yaml(), is the same as
|
5
|
+
# ya2yaml but ensures that arrays are sorted.
|
6
|
+
#
|
7
|
+
# This is important so that the .yaml files don't change each time you recompile.
|
8
|
+
#
|
9
|
+
# see https://github.com/afunai/ya2yaml/blob/master/lib/ya2yaml.rb
|
10
|
+
#
|
11
|
+
def sorted_ya2yaml(options = {})
|
12
|
+
# modify array
|
13
|
+
Array.class_eval do
|
14
|
+
alias_method :collect_without_sort, :collect
|
15
|
+
def collect(&block)
|
16
|
+
sorted = sort {|a,b| a.to_s <=> b.to_s}
|
17
|
+
sorted.collect_without_sort(&block)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# generate yaml
|
22
|
+
yaml_str = self.ya2yaml(options)
|
23
|
+
|
24
|
+
# restore array
|
25
|
+
Array.class_eval {alias_method :collect, :collect_without_sort}
|
26
|
+
|
27
|
+
return yaml_str
|
28
|
+
end
|
29
|
+
end
|
data/lib/leap_cli/exceptions.rb
CHANGED
@@ -6,6 +6,30 @@ module LeapCli
|
|
6
6
|
@node = node
|
7
7
|
super(msg)
|
8
8
|
end
|
9
|
+
def log
|
10
|
+
Util.log(0, :error, "in node `#{@node.name}`: " + self.message)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class FileMissing < StandardError
|
15
|
+
attr_accessor :path, :options
|
16
|
+
def initialize(path, options={})
|
17
|
+
@path = path
|
18
|
+
@options = options
|
19
|
+
end
|
20
|
+
def to_s
|
21
|
+
@path
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class AssertionFailed < StandardError
|
26
|
+
attr_accessor :assertion
|
27
|
+
def initialize(assertion)
|
28
|
+
@assertion = assertion
|
29
|
+
end
|
30
|
+
def to_s
|
31
|
+
@assertion
|
32
|
+
end
|
9
33
|
end
|
10
34
|
|
11
35
|
end
|
data/lib/leap_cli/leapfile.rb
CHANGED
@@ -16,13 +16,28 @@ module LeapCli
|
|
16
16
|
attr_accessor :leap_version
|
17
17
|
attr_accessor :log
|
18
18
|
attr_accessor :vagrant_network
|
19
|
-
attr_accessor :
|
20
|
-
attr_accessor :allow_production_deploy
|
19
|
+
attr_accessor :environment
|
21
20
|
|
22
21
|
def initialize
|
23
22
|
@vagrant_network = '10.5.5.0/24'
|
24
23
|
end
|
25
24
|
|
25
|
+
#
|
26
|
+
# The way the Leapfile handles pinning of environment (self.environment) is a little tricky.
|
27
|
+
# If self.environment is nil, then there is no pin. If self.environment is 'default', then
|
28
|
+
# there is a pin to the default environment. The problem is that an environment of nil
|
29
|
+
# is used to indicate the default environment in node properties.
|
30
|
+
#
|
31
|
+
# This method returns the environment tag as needed when filtering nodes.
|
32
|
+
#
|
33
|
+
def environment_filter
|
34
|
+
if self.environment == 'default'
|
35
|
+
nil
|
36
|
+
else
|
37
|
+
self.environment
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
26
41
|
def load(search_directory=nil)
|
27
42
|
directory = File.expand_path(find_in_directory_tree('Leapfile', search_directory))
|
28
43
|
if directory == '/'
|
@@ -33,7 +48,7 @@ module LeapCli
|
|
33
48
|
#
|
34
49
|
@provider_directory_path = directory
|
35
50
|
read_settings(directory + '/Leapfile')
|
36
|
-
read_settings(
|
51
|
+
read_settings(leaprc_path)
|
37
52
|
@platform_directory_path = File.expand_path(@platform_directory_path || '../leap_platform', @provider_directory_path)
|
38
53
|
|
39
54
|
#
|
@@ -51,20 +66,55 @@ module LeapCli
|
|
51
66
|
"You need platform version #{LeapCli::COMPATIBLE_PLATFORM_VERSION.first} to #{LeapCli::COMPATIBLE_PLATFORM_VERSION.last}."
|
52
67
|
end
|
53
68
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
@allow_production_deploy = !LeapCli::Util.is_git_directory?(@provider_directory_path) ||
|
60
|
-
LeapCli::Util.current_git_branch(@provider_directory_path) == 'master'
|
69
|
+
unless @allow_production_deploy.nil?
|
70
|
+
Util::log 0, :warning, "in Leapfile: @allow_production_deploy is no longer supported."
|
71
|
+
end
|
72
|
+
unless @platform_branch.nil?
|
73
|
+
Util::log 0, :warning, "in Leapfile: @platform_branch is no longer supported."
|
61
74
|
end
|
62
75
|
return true
|
63
76
|
end
|
64
77
|
end
|
65
78
|
|
79
|
+
def set(property, value)
|
80
|
+
edit_leaprc(property, value)
|
81
|
+
end
|
82
|
+
|
83
|
+
def unset(property)
|
84
|
+
edit_leaprc(property)
|
85
|
+
end
|
86
|
+
|
66
87
|
private
|
67
88
|
|
89
|
+
#
|
90
|
+
# adds or removes a line to .leaprc for this particular provider directory.
|
91
|
+
# if value is nil, the line is removed. if not nil, it is added or replaced.
|
92
|
+
#
|
93
|
+
def edit_leaprc(property, value=nil)
|
94
|
+
file_path = leaprc_path
|
95
|
+
lines = []
|
96
|
+
if File.exists?(file_path)
|
97
|
+
regexp = /self\.#{Regexp.escape(property)} = .*? if @provider_directory_path == '#{Regexp.escape(@provider_directory_path)}'/
|
98
|
+
File.readlines(file_path).each do |line|
|
99
|
+
unless line =~ regexp
|
100
|
+
lines << line
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
unless value.nil?
|
105
|
+
lines << "self.#{property} = #{value.inspect} if @provider_directory_path == '#{@provider_directory_path}'\n"
|
106
|
+
end
|
107
|
+
File.open(file_path, 'w') do |f|
|
108
|
+
f.write(lines.join)
|
109
|
+
end
|
110
|
+
rescue Errno::EACCES, IOError => exc
|
111
|
+
Util::bail! :error, "trying to save ~/.leaprc (#{exc})."
|
112
|
+
end
|
113
|
+
|
114
|
+
def leaprc_path
|
115
|
+
File.join(ENV['HOME'], '.leaprc')
|
116
|
+
end
|
117
|
+
|
68
118
|
def read_settings(file)
|
69
119
|
if File.exists? file
|
70
120
|
Util::log 2, :read, file
|
File without changes
|
File without changes
|
data/lib/leap_cli/log.rb
CHANGED
data/lib/leap_cli/logger.rb
CHANGED
@@ -84,6 +84,19 @@ module LeapCli
|
|
84
84
|
## FORMATTING
|
85
85
|
##
|
86
86
|
|
87
|
+
#
|
88
|
+
# options for formatters:
|
89
|
+
#
|
90
|
+
# :match => regexp for matching a log line
|
91
|
+
# :color => what color the line should be
|
92
|
+
# :style => what style the line should be
|
93
|
+
# :priority => what order the formatters are applied in. higher numbers first.
|
94
|
+
# :match_level => only apply filter at the specified log level
|
95
|
+
# :level => make this line visible at this log level or higher
|
96
|
+
# :replace => replace the matched text
|
97
|
+
# :exit => force the exit code to be this (does not interrupt program, just
|
98
|
+
# ensures a specific exit code when the program eventually exits)
|
99
|
+
#
|
87
100
|
@formatters = [
|
88
101
|
# TRACE
|
89
102
|
{ :match => /command finished/, :color => :white, :style => :dim, :match_level => 3, :priority => -10 },
|
@@ -138,8 +151,12 @@ module LeapCli
|
|
138
151
|
# TESTS
|
139
152
|
{ :match => /^PASS: /, :color => :green, :priority => -20},
|
140
153
|
{ :match => /^(FAIL|ERROR): /, :color => :red, :priority => -20},
|
141
|
-
{ :match => /^SKIP: /,
|
154
|
+
{ :match => /^(SKIP|WARN): /, :color => :yellow, :priority => -20},
|
155
|
+
{ :match => /\d+ tests: \d+ passes, \d+ skips, 0 warnings, 0 failures, 0 errors/, :color => :blue, :priority => -20},
|
142
156
|
|
157
|
+
# LOG SUPPRESSION
|
158
|
+
{ :match => /^warning: You cannot collect without storeconfigs being set/, :level => 2, :priority => 10},
|
159
|
+
{ :match => /^warning: You cannot collect exported resources without storeconfigs being set/, :level => 2, :priority => 10}
|
143
160
|
]
|
144
161
|
|
145
162
|
def self.sorted_formatters
|
@@ -11,7 +11,7 @@ require 'gli/commands/help_modules/arg_name_formatter'
|
|
11
11
|
module LeapCli
|
12
12
|
class MarkdownDocumentListener
|
13
13
|
|
14
|
-
def initialize(global_options,options,arguments)
|
14
|
+
def initialize(global_options,options,arguments,app)
|
15
15
|
@io = File.new(File.basename($0) + ".md",'w')
|
16
16
|
@nest = ''
|
17
17
|
@commands = [File.basename($0)]
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#
|
2
|
+
# This exists solely to prevent other gems we depend on from
|
3
|
+
# importing json/ext (e.g. require 'json').
|
4
|
+
#
|
5
|
+
# If json/ext is imported, json/pure cannot work, and we heavily
|
6
|
+
# rely on the specific behavior of json/pure.
|
7
|
+
#
|
8
|
+
# This trick only works if this directory is early in the
|
9
|
+
# include path.
|
10
|
+
#
|
11
|
+
require 'json/pure'
|
data/lib/leap_cli/path.rb
CHANGED
@@ -26,15 +26,29 @@ module LeapCli; module Path
|
|
26
26
|
end
|
27
27
|
|
28
28
|
#
|
29
|
-
#
|
29
|
+
# Tries to find a file somewhere.
|
30
|
+
# Path can be a named path or a relative path.
|
31
|
+
#
|
32
|
+
# relative paths are checked against
|
33
|
+
# provider/<path>
|
34
|
+
# provider/files/<path>
|
35
|
+
# provider_base/<path>
|
36
|
+
# provider_base/files/<path>
|
37
|
+
#
|
30
38
|
#
|
31
39
|
def self.find_file(arg)
|
32
40
|
[Path.provider, Path.provider_base].each do |base|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
41
|
+
if arg.is_a?(Symbol) || arg.is_a?(Array)
|
42
|
+
named_path(arg, base).tap {|path|
|
43
|
+
return path if File.exists?(path)
|
44
|
+
}
|
45
|
+
else
|
46
|
+
File.join(base, arg).tap {|path|
|
47
|
+
return path if File.exists?(path)
|
48
|
+
}
|
49
|
+
File.join(base, 'files', arg).tap {|path|
|
50
|
+
return path if File.exists?(path)
|
51
|
+
}
|
38
52
|
end
|
39
53
|
end
|
40
54
|
return nil
|
@@ -26,7 +26,7 @@ module LeapCli; module Remote; module LeapPlugin
|
|
26
26
|
#
|
27
27
|
def assert_initialized
|
28
28
|
begin
|
29
|
-
test_initialized_file = "test -f #{
|
29
|
+
test_initialized_file = "test -f #{Leap::Platform.init_path}"
|
30
30
|
check_required_packages = "! dpkg-query -W --showformat='${Status}\n' #{required_packages} 2>&1 | grep -q -E '(deinstall|no packages)'"
|
31
31
|
run "#{test_initialized_file} && #{check_required_packages} && echo ok"
|
32
32
|
rescue Capistrano::CommandError => exc
|
@@ -57,7 +57,7 @@ module LeapCli; module Remote; module LeapPlugin
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def mark_initialized
|
60
|
-
run "touch #{
|
60
|
+
run "touch #{Leap::Platform.init_path}"
|
61
61
|
end
|
62
62
|
|
63
63
|
#
|
@@ -6,7 +6,7 @@
|
|
6
6
|
module LeapCli; module Remote; module PuppetPlugin
|
7
7
|
|
8
8
|
def apply(options)
|
9
|
-
run "#{
|
9
|
+
run "#{Leap::Platform.leap_dir}/bin/puppet_command set_hostname apply #{flagize(options)}"
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
@@ -34,7 +34,7 @@ BAD_APT_GET_UPDATE = /(BADSIG|NO_PUBKEY|KEYEXPIRED|REVKEYSIG|NODATA)/
|
|
34
34
|
|
35
35
|
task :install_prerequisites, :max_hosts => MAX_HOSTS do
|
36
36
|
apt_get = "DEBIAN_FRONTEND=noninteractive apt-get -q -y -o DPkg::Options::=--force-confold"
|
37
|
-
leap.mkdirs
|
37
|
+
leap.mkdirs Leap::Platform.leap_dir
|
38
38
|
run "echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen"
|
39
39
|
leap.log :updating, "package list" do
|
40
40
|
run "apt-get update" do |channel, stream, data|
|
data/lib/leap_cli/ssh_key.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# A wrapper around OpenSSL::PKey::RSA instances to provide a better api for dealing with SSH keys.
|
3
3
|
#
|
4
|
+
# cipher 'ssh-ed25519' not supported yet because we are waiting for support in Net::SSH
|
4
5
|
#
|
5
6
|
|
6
7
|
require 'net/ssh'
|
@@ -13,6 +14,10 @@ module LeapCli
|
|
13
14
|
attr_accessor :filename
|
14
15
|
attr_accessor :comment
|
15
16
|
|
17
|
+
# supported ssh key types, in order of preference
|
18
|
+
SUPPORTED_TYPES = ['ssh-rsa', 'ecdsa-sha2-nistp256']
|
19
|
+
SUPPORTED_TYPES_RE = /(#{SUPPORTED_TYPES.join('|')})/
|
20
|
+
|
16
21
|
##
|
17
22
|
## CLASS METHODS
|
18
23
|
##
|
@@ -33,6 +38,7 @@ module LeapCli
|
|
33
38
|
end
|
34
39
|
end
|
35
40
|
return key
|
41
|
+
rescue StandardError => exc
|
36
42
|
end
|
37
43
|
|
38
44
|
def self.load_from_file(filename)
|
@@ -63,6 +69,61 @@ module LeapCli
|
|
63
69
|
public_key || private_key
|
64
70
|
end
|
65
71
|
|
72
|
+
#
|
73
|
+
# Picks one key out of an array of keys that we think is the "best",
|
74
|
+
# based on the order of preference in SUPPORTED_TYPES
|
75
|
+
#
|
76
|
+
# Currently, this does not take bitsize into account.
|
77
|
+
#
|
78
|
+
def self.pick_best_key(keys)
|
79
|
+
keys.select {|k|
|
80
|
+
SUPPORTED_TYPES.include?(k.type)
|
81
|
+
}.sort {|a,b|
|
82
|
+
SUPPORTED_TYPES.index(a.type) <=> SUPPORTED_TYPES.index(b.type)
|
83
|
+
}.first
|
84
|
+
end
|
85
|
+
|
86
|
+
#
|
87
|
+
# takes a string with one or more ssh keys, one key per line,
|
88
|
+
# and returns an array of SshKey objects.
|
89
|
+
#
|
90
|
+
# the lines should be in one of these formats:
|
91
|
+
#
|
92
|
+
# 1. <hostname> <key-type> <key>
|
93
|
+
# 2. <key-type> <key>
|
94
|
+
#
|
95
|
+
def self.parse_keys(string)
|
96
|
+
keys = []
|
97
|
+
lines = string.split("\n").grep(/^[^#]/)
|
98
|
+
lines.each do |line|
|
99
|
+
if line =~ / #{SshKey::SUPPORTED_TYPES_RE} /
|
100
|
+
# <hostname> <key-type> <key>
|
101
|
+
keys << line.split(' ')[1..2]
|
102
|
+
elsif line =~ /^#{SshKey::SUPPORTED_TYPES_RE} /
|
103
|
+
# <key-type> <key>
|
104
|
+
keys << line.split(' ')
|
105
|
+
end
|
106
|
+
end
|
107
|
+
return keys.map{|k| SshKey.load(k[1], k[0])}
|
108
|
+
end
|
109
|
+
|
110
|
+
#
|
111
|
+
# takes a string with one or more ssh keys, one key per line,
|
112
|
+
# and returns a string that specified the ssh key algorithms
|
113
|
+
# that are supported by the keys, in order of preference.
|
114
|
+
#
|
115
|
+
# eg: ecdsa-sha2-nistp256,ssh-rsa,ssh-ed25519
|
116
|
+
#
|
117
|
+
def self.supported_host_key_algorithms(string)
|
118
|
+
if string
|
119
|
+
self.parse_keys(string).map {|key|
|
120
|
+
key.type
|
121
|
+
}.join(',')
|
122
|
+
else
|
123
|
+
""
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
66
127
|
##
|
67
128
|
## INSTANCE METHODS
|
68
129
|
##
|
@@ -100,7 +161,8 @@ module LeapCli
|
|
100
161
|
end
|
101
162
|
|
102
163
|
def summary
|
103
|
-
"%s %s %s (%s)" % [self.type, self.bits, self.fingerprint, self.filename || self.comment || '']
|
164
|
+
#"%s %s %s (%s)" % [self.type, self.bits, self.fingerprint, self.filename || self.comment || '']
|
165
|
+
"%s %s %s" % [self.type, self.bits, self.fingerprint]
|
104
166
|
end
|
105
167
|
|
106
168
|
def to_s
|
@@ -78,10 +78,24 @@ module LeapCli; module Util; module RemoteCommand
|
|
78
78
|
:keys_only => false, # Don't you dare change this.
|
79
79
|
:global_known_hosts_file => path(:known_hosts),
|
80
80
|
:user_known_hosts_file => '/dev/null',
|
81
|
-
:paranoid => true
|
81
|
+
:paranoid => true,
|
82
|
+
:verbose => net_ssh_log_level
|
82
83
|
}
|
83
84
|
end
|
84
85
|
|
86
|
+
def net_ssh_log_level
|
87
|
+
if DEBUG
|
88
|
+
case LeapCli.log_level
|
89
|
+
when 1 then 3
|
90
|
+
when 2 then 2
|
91
|
+
when 3 then 1
|
92
|
+
else 0
|
93
|
+
end
|
94
|
+
else
|
95
|
+
nil
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
85
99
|
#
|
86
100
|
# For notes on advanced ways to set server-specific options, see
|
87
101
|
# http://railsware.com/blog/2011/11/02/advanced-server-definitions-in-capistrano/
|
@@ -106,7 +120,7 @@ module LeapCli; module Util; module RemoteCommand
|
|
106
120
|
@capistrano_enabled ||= begin
|
107
121
|
require 'capistrano'
|
108
122
|
require 'capistrano/cli'
|
109
|
-
require 'lib_ext/capistrano_connections'
|
123
|
+
require 'leap_cli/lib_ext/capistrano_connections'
|
110
124
|
require 'leap_cli/remote/leap_plugin'
|
111
125
|
require 'leap_cli/remote/puppet_plugin'
|
112
126
|
require 'leap_cli/remote/rsync_plugin'
|
@@ -135,6 +149,9 @@ module LeapCli; module Util; module RemoteCommand
|
|
135
149
|
opts[:verbose] = :error # suppress all the warnings about adding host keys to known_hosts, since it is not actually doing that.
|
136
150
|
end
|
137
151
|
end
|
152
|
+
if !node.supported_ssh_host_key_algorithms.empty?
|
153
|
+
opts[:host_key] = node.supported_ssh_host_key_algorithms
|
154
|
+
end
|
138
155
|
return opts
|
139
156
|
end
|
140
157
|
|
data/lib/leap_cli/util/secret.rb
CHANGED
data/lib/leap_cli/util/x509.rb
CHANGED
data/lib/leap_cli/util.rb
CHANGED
@@ -8,13 +8,21 @@ module LeapCli
|
|
8
8
|
module Util
|
9
9
|
extend self
|
10
10
|
|
11
|
+
@@exit_status = nil
|
12
|
+
|
11
13
|
##
|
12
14
|
## QUITTING
|
13
15
|
##
|
14
16
|
|
15
17
|
def exit_status(code=nil)
|
16
|
-
|
17
|
-
|
18
|
+
if !code.nil?
|
19
|
+
if code == 0 && @@exit_status.nil?
|
20
|
+
@@exit_status = 0
|
21
|
+
else
|
22
|
+
@@exit_status = code
|
23
|
+
end
|
24
|
+
end
|
25
|
+
@@exit_status
|
18
26
|
end
|
19
27
|
|
20
28
|
#
|
@@ -30,7 +38,7 @@ module LeapCli
|
|
30
38
|
#
|
31
39
|
def bail!(*message)
|
32
40
|
if block_given?
|
33
|
-
LeapCli.
|
41
|
+
LeapCli.set_log_level(3)
|
34
42
|
yield
|
35
43
|
elsif message
|
36
44
|
log 0, *message
|
data/lib/leap_cli/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module LeapCli
|
2
2
|
unless defined?(LeapCli::VERSION)
|
3
|
-
VERSION = '1.
|
4
|
-
COMPATIBLE_PLATFORM_VERSION = '0.
|
3
|
+
VERSION = '1.6.2'
|
4
|
+
COMPATIBLE_PLATFORM_VERSION = '0.6.0'..'1.99'
|
5
5
|
SUMMARY = 'Command line interface to the LEAP platform'
|
6
6
|
DESCRIPTION = 'The command "leap" can be used to manage a bevy of servers running the LEAP platform from the comfort of your own home.'
|
7
7
|
LOAD_PATHS = ['lib', 'vendor/certificate_authority/lib', 'vendor/rsync_command/lib']
|
data/lib/leap_cli.rb
CHANGED
@@ -1,20 +1,31 @@
|
|
1
|
-
module LeapCli
|
1
|
+
module LeapCli
|
2
|
+
module Commands; end # for commands in leap_cli/commands
|
3
|
+
module Macro; end # for macros in leap_platform/provider_base/lib/macros
|
4
|
+
end
|
2
5
|
|
3
6
|
$ruby_version = RUBY_VERSION.split('.').collect{ |i| i.to_i }.extend(Comparable)
|
4
7
|
|
5
|
-
|
8
|
+
# ensure lib/leap_cli/overrides has the highest priority
|
9
|
+
$:.unshift(File.expand_path('../leap_cli/override',__FILE__))
|
10
|
+
|
11
|
+
# for a few gems, things will break if using earlier versions.
|
12
|
+
# enforce the compatible versions here:
|
13
|
+
require 'rubygems'
|
14
|
+
gem 'net-ssh', '~> 2.7.0'
|
15
|
+
gem 'gli', '~> 2.12.0'
|
6
16
|
|
7
|
-
require '
|
8
|
-
require 'leap_cli/constants.rb'
|
9
|
-
require 'leap_cli/requirements.rb'
|
10
|
-
require 'leap_cli/exceptions.rb'
|
17
|
+
require 'leap/platform'
|
11
18
|
|
12
|
-
require 'leap_cli/
|
13
|
-
require '
|
14
|
-
|
15
|
-
require '
|
16
|
-
require 'core_ext/
|
17
|
-
require 'core_ext/
|
19
|
+
require 'leap_cli/version'
|
20
|
+
require 'leap_cli/exceptions'
|
21
|
+
|
22
|
+
require 'leap_cli/leapfile'
|
23
|
+
require 'leap_cli/core_ext/hash'
|
24
|
+
require 'leap_cli/core_ext/boolean'
|
25
|
+
require 'leap_cli/core_ext/nil'
|
26
|
+
require 'leap_cli/core_ext/string'
|
27
|
+
require 'leap_cli/core_ext/json'
|
28
|
+
require 'leap_cli/core_ext/yaml'
|
18
29
|
|
19
30
|
require 'leap_cli/log'
|
20
31
|
require 'leap_cli/path'
|
@@ -31,12 +42,11 @@ require 'leap_cli/config/tag'
|
|
31
42
|
require 'leap_cli/config/provider'
|
32
43
|
require 'leap_cli/config/secrets'
|
33
44
|
require 'leap_cli/config/object_list'
|
45
|
+
require 'leap_cli/config/filter'
|
34
46
|
require 'leap_cli/config/manager'
|
35
47
|
|
36
48
|
require 'leap_cli/markdown_document_listener'
|
37
49
|
|
38
|
-
module LeapCli::Commands; end
|
39
|
-
|
40
50
|
#
|
41
51
|
# allow everyone easy access to log() command.
|
42
52
|
#
|