inprovise 0.2.4 → 0.2.5
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.
- checksums.yaml +8 -8
- data/.codeclimate.yml +24 -0
- data/lib/inprovise/channel/ssh.rb +50 -33
- data/lib/inprovise/cli/group.rb +6 -6
- data/lib/inprovise/cli/node.rb +7 -7
- data/lib/inprovise/cli/provision.rb +12 -21
- data/lib/inprovise/cli.rb +8 -8
- data/lib/inprovise/cmd_channel.rb +3 -3
- data/lib/inprovise/cmd_helper.rb +17 -17
- data/lib/inprovise/control.rb +93 -90
- data/lib/inprovise/helper/cygwin.rb +5 -0
- data/lib/inprovise/helper/linux.rb +8 -3
- data/lib/inprovise/helper/windows.rb +4 -0
- data/lib/inprovise/node.rb +1 -1
- data/lib/inprovise/sniffer/linux.rb +4 -0
- data/lib/inprovise/sniffer/platform.rb +4 -0
- data/lib/inprovise/sniffer/windows.rb +4 -0
- data/lib/inprovise/template.rb +1 -1
- data/lib/inprovise/version.rb +1 -1
- data/test/helper_test.rb +189 -0
- data/test/script_runner_test.rb +209 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTQ5MmNkZGZjZmJlZjZhNmYxOWE0ZTM3Y2U1MWVjYWQ0ZGM2N2U5Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjUyY2E2M2M3MWY2OTQwZDY2ZTFhODRhMTM0OWU5ZWFhNTk0Y2MxYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTA0MjcyMGE0YWI3OWYxNzQ2MDEwYzBhZjEwMWFhYTY4ZGZjYTNlNzdiZmUy
|
10
|
+
ZGM0ZGFhNmUyMjAwMjdiMzYyZjY0YjA4YTYzOTNiMDY1OGE4ODdlYWE2YWU5
|
11
|
+
NTdjOGZlMDRjYmNmOWJjMGRiZjJiN2IwMmQ4YzBjZGExYzZjNDM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGExZGNlNzFmZGRmMDM4MjU4OTE0NWY2OGEyZDg3Y2M1OGZlZmVhZDYyZjg4
|
14
|
+
NjVjMGUyZWUzMjBiNGEyOWQ5OTRiMTFiMmQ5YTI0ZGY4NTk5ZjA3NjUzNzEx
|
15
|
+
MjE1N2RjMTQzM2I0ZWM0MDM2N2VkOGNhNzhiMGRkOTlkZTNlOTk=
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
engines:
|
2
|
+
duplication:
|
3
|
+
enabled: true
|
4
|
+
config:
|
5
|
+
languages:
|
6
|
+
- ruby
|
7
|
+
exclude_paths:
|
8
|
+
- "lib/inprovise/node.rb"
|
9
|
+
- "lib/inprovise/control.rb"
|
10
|
+
- "lib/inprovise/cli/provision.rb"
|
11
|
+
- "lib/inprovise/cli/node.rb"
|
12
|
+
- "lib/inprovise/cli/group.rb"
|
13
|
+
- "lib/inprovise/helper/linux.rb"
|
14
|
+
- "lib/inprovise/channel/ssh.rb"
|
15
|
+
rubocop:
|
16
|
+
enabled: true
|
17
|
+
checks:
|
18
|
+
Rubocop/Lint/RescueException:
|
19
|
+
enabled: false
|
20
|
+
Rubocop/Metrics/ClassLength:
|
21
|
+
enabled: false
|
22
|
+
ratings:
|
23
|
+
paths:
|
24
|
+
- "lib/**/*"
|
@@ -7,6 +7,8 @@ require 'net/ssh'
|
|
7
7
|
require 'net/sftp'
|
8
8
|
require 'digest/sha1'
|
9
9
|
|
10
|
+
# :nocov:
|
11
|
+
|
10
12
|
Inprovise::CmdChannel.define('ssh') do
|
11
13
|
|
12
14
|
def initialize(node)
|
@@ -45,34 +47,30 @@ Inprovise::CmdChannel.define('ssh') do
|
|
45
47
|
sftp.mkdir!(path)
|
46
48
|
end
|
47
49
|
|
48
|
-
def
|
49
|
-
@node.log.remote("SFTP.EXISTS?: #{path}") if Inprovise.verbosity > 1
|
50
|
+
def path_check(path, type=nil)
|
50
51
|
begin
|
51
|
-
sftp.stat!(path)
|
52
|
+
stat = sftp.stat!(path)
|
53
|
+
stat != nil && (type.nil? || stat.symbolic_type == type)
|
52
54
|
rescue Net::SFTP::StatusException => ex
|
53
55
|
raise ex unless ex.code == Net::SFTP::Response::FX_NO_SUCH_FILE
|
54
56
|
false
|
55
57
|
end
|
56
58
|
end
|
59
|
+
private :path_check
|
60
|
+
|
61
|
+
def exists?(path)
|
62
|
+
@node.log.remote("SFTP.EXISTS?: #{path}") if Inprovise.verbosity > 1
|
63
|
+
path_check(path)
|
64
|
+
end
|
57
65
|
|
58
66
|
def file?(path)
|
59
67
|
@node.log.remote("SFTP.FILE?: #{path}") if Inprovise.verbosity > 1
|
60
|
-
|
61
|
-
sftp.stat!(path).symbolic_type == :regular
|
62
|
-
rescue Net::SFTP::StatusException => ex
|
63
|
-
raise ex unless ex.code == Net::SFTP::Response::FX_NO_SUCH_FILE
|
64
|
-
false
|
65
|
-
end
|
68
|
+
path_check(path, :regular)
|
66
69
|
end
|
67
70
|
|
68
71
|
def directory?(path)
|
69
72
|
@node.log.remote("SFTP.DIRECTORY?: #{path}") if Inprovise.verbosity > 1
|
70
|
-
|
71
|
-
sftp.stat!(path).symbolic_type == :directory
|
72
|
-
rescue Net::SFTP::StatusException => ex
|
73
|
-
raise ex unless ex.code == Net::SFTP::Response::FX_NO_SUCH_FILE
|
74
|
-
false
|
75
|
-
end
|
73
|
+
path_check(path, :directory)
|
76
74
|
end
|
77
75
|
|
78
76
|
def content(path)
|
@@ -142,42 +140,58 @@ Inprovise::CmdChannel.define('ssh') do
|
|
142
140
|
log_bak = @node.log
|
143
141
|
begin
|
144
142
|
@node.log_to(Inprovise::Logger.new(@node, 'ssh[init]'))
|
145
|
-
|
146
|
-
|
147
|
-
set_permissions('./.ssh', 755) rescue run('chmod 0755 ./.ssh')
|
148
|
-
end
|
143
|
+
|
144
|
+
# load public key
|
149
145
|
pubkey = File.read(pubkey_path)
|
150
|
-
#
|
151
|
-
if
|
152
|
-
|
153
|
-
content('./.ssh/authorized_keys')
|
154
|
-
rescue
|
155
|
-
run('cat ./.ssh/authorized_keys')
|
156
|
-
end.split("\n")
|
157
|
-
return if auth_keys.any? { |key| key == pubkey }
|
158
|
-
end
|
146
|
+
# quit if already installed
|
147
|
+
return if check_pubkey(pubkey)
|
148
|
+
|
159
149
|
begin
|
160
|
-
|
161
|
-
|
162
|
-
|
150
|
+
# create .ssh dir if necessary
|
151
|
+
unless exists?('./.ssh')
|
152
|
+
mkdir('./.ssh')
|
153
|
+
set_permissions('./.ssh', 755)
|
163
154
|
end
|
155
|
+
@node.log.remote("SFTP.APPEND: #{pubkey_path} -> ./.ssh/authorized_keys") if Inprovise.verbosity > 0
|
156
|
+
sftp.file.open('./.ssh/authorized_keys', 'a') { |f| f.puts pubkey }
|
157
|
+
# make sure the key file has the right permissions
|
158
|
+
set_permissions('./.ssh/authorized_keys', 644)
|
164
159
|
rescue
|
165
160
|
# using the SFTP option failed, let's try a more basic approach
|
161
|
+
run('mkdir -p .ssh') # make sure the directory exists
|
162
|
+
run('chmod 0755 ./.ssh') # and has the right permissions
|
163
|
+
# upload pubkey file to remote temp file
|
166
164
|
upload_path = "inprovise-upload-#{Digest::SHA1.file(pubkey_path).hexdigest}"
|
167
165
|
upload(pubkey_path, upload_path)
|
166
|
+
# concatenate temp file to ssh file
|
168
167
|
run("cat #{upload_path} >> ./.ssh/authorized_keys")
|
168
|
+
# remove temp file
|
169
169
|
run("rm #{upload_path}")
|
170
|
+
# make sure the key file has the right permissions
|
171
|
+
run('chmod 0644 ./.ssh/authorized_keys')
|
170
172
|
end
|
171
|
-
set_permissions('./.ssh/authorized_keys', 644) rescue run('chmod 0644 ./.ssh/authorized_keys')
|
172
173
|
ensure
|
173
174
|
@node.log_to(log_bak)
|
174
175
|
end
|
175
176
|
end
|
176
177
|
|
178
|
+
def check_pubkey(pubkey)
|
179
|
+
# check if public key already configured
|
180
|
+
if exists?('./.ssh/authorized_keys')
|
181
|
+
auth_keys = begin
|
182
|
+
content('./.ssh/authorized_keys')
|
183
|
+
rescue
|
184
|
+
run('cat ./.ssh/authorized_keys')
|
185
|
+
end.split("\n")
|
186
|
+
return auth_keys.any? { |key| key == pubkey }
|
187
|
+
end
|
188
|
+
false
|
189
|
+
end
|
190
|
+
|
177
191
|
def execute(cmd, forcelog=false)
|
178
192
|
@node.log.remote("SSH: #{cmd}") if Inprovise.verbosity > 1 || forcelog
|
179
193
|
output = ''
|
180
|
-
connection.exec! cmd do |
|
194
|
+
connection.exec! cmd do |_channel, stream, data|
|
181
195
|
output << data if stream == :stdout
|
182
196
|
data.split("\n").each do |line|
|
183
197
|
@node.log.send(stream, line, forcelog)
|
@@ -200,3 +214,6 @@ Inprovise::CmdChannel.define('ssh') do
|
|
200
214
|
end
|
201
215
|
|
202
216
|
end
|
217
|
+
|
218
|
+
# :nocov:
|
219
|
+
|
data/lib/inprovise/cli/group.rb
CHANGED
@@ -15,7 +15,7 @@ class Inprovise::Cli
|
|
15
15
|
cgrp_add.flag [:t, :target], :arg_name => 'NAME', :multiple => true, :desc => 'Add a known target (node or group) to this new group.'
|
16
16
|
cgrp_add.flag [:c, :config], :arg_name => 'CFGKEY=CFGVAL', :multiple => true, :desc => 'Specify a configuration setting for the group.'
|
17
17
|
|
18
|
-
cgrp_add.action do |
|
18
|
+
cgrp_add.action do |_global,options,args|
|
19
19
|
raise ArgumentError, 'Missing or too many arguments!' unless args.size == 1
|
20
20
|
Inprovise::Controller.run(:add, options, :group, *args)
|
21
21
|
Inprovise::Controller.wait!
|
@@ -27,7 +27,7 @@ class Inprovise::Cli
|
|
27
27
|
cgrp.arg_name 'GROUP[ GROUP [...]]'
|
28
28
|
cgrp.command :remove do |cgrp_del|
|
29
29
|
|
30
|
-
cgrp_del.action do |
|
30
|
+
cgrp_del.action do |_global,options,args|
|
31
31
|
raise ArgumentError, 'Missing argument!' if args.empty?
|
32
32
|
Inprovise::Controller.run(:remove, options, :group, *args)
|
33
33
|
Inprovise::Controller.wait!
|
@@ -43,7 +43,7 @@ class Inprovise::Cli
|
|
43
43
|
cgrp_update.switch [:r, :reset], negatable: false, :desc => 'Reset configuration before update (default is to merge updates)'
|
44
44
|
cgrp_update.flag [:t, :target], :arg_name => 'NAME', :multiple => true, :desc => 'Add a known target (node or group) to the group(s)'
|
45
45
|
|
46
|
-
cgrp_update.action do |
|
46
|
+
cgrp_update.action do |_global,options,args|
|
47
47
|
raise ArgumentError, 'Missing argument!' if args.empty?
|
48
48
|
Inprovise::Controller.run(:update, options, :group, *args)
|
49
49
|
Inprovise::Controller.wait!
|
@@ -55,9 +55,9 @@ class Inprovise::Cli
|
|
55
55
|
cgrp.command :list do |cgrp_list|
|
56
56
|
cgrp_list.switch [:d, :details], negatable: false, :desc => 'Show group details'
|
57
57
|
|
58
|
-
cgrp_list.action do |
|
59
|
-
$stdout.puts
|
60
|
-
$stdout.puts
|
58
|
+
cgrp_list.action do |_global,options,args|
|
59
|
+
$stdout.puts ' INFRASTRUCTURE GROUPS'
|
60
|
+
$stdout.puts ' ====================='
|
61
61
|
if args.empty?
|
62
62
|
Inprovise::Infrastructure.list(Inprovise::Infrastructure::Group).each do |g|
|
63
63
|
Inprovise::Cli.show_target(g, options[:details])
|
data/lib/inprovise/cli/node.rb
CHANGED
@@ -18,7 +18,7 @@ class Inprovise::Cli
|
|
18
18
|
cnod_add.switch [:sniff], :default_value => true, :desc => 'Enable or disable running sniffers'
|
19
19
|
cnod_add.flag [:g, :group], :arg_name => 'GROUP', :multiple => true, :desc => 'Existing infrastructure group to add new node to.'
|
20
20
|
|
21
|
-
cnod_add.action do |
|
21
|
+
cnod_add.action do |_global,options,args|
|
22
22
|
raise ArgumentError, 'Missing or too many arguments!' unless args.size == 1
|
23
23
|
Inprovise::Controller.run(:add, options, :node, *args)
|
24
24
|
Inprovise::Controller.wait!
|
@@ -30,7 +30,7 @@ class Inprovise::Cli
|
|
30
30
|
cnod.arg_name 'NODE[ NODE [...]]'
|
31
31
|
cnod.command :remove do |cnod_del|
|
32
32
|
|
33
|
-
cnod_del.action do |
|
33
|
+
cnod_del.action do |_global,options,args|
|
34
34
|
raise ArgumentError, 'Missing argument!' if args.empty?
|
35
35
|
Inprovise::Controller.run(:remove, options, :node, *args)
|
36
36
|
Inprovise::Controller.wait!
|
@@ -48,7 +48,7 @@ class Inprovise::Cli
|
|
48
48
|
cnod_update.switch [:sniff], :default_value => true, :desc => 'Enable or disable running sniffers'
|
49
49
|
cnod_update.flag [:g, :group], :arg_name => 'GROUP', :multiple => true, :desc => 'Existing infrastructure group to add node(s) to.'
|
50
50
|
|
51
|
-
cnod_update.action do |
|
51
|
+
cnod_update.action do |_global,options,args|
|
52
52
|
raise ArgumentError, 'Missing argument!' if args.empty?
|
53
53
|
Inprovise::Controller.run(:update, options, :node, *args)
|
54
54
|
Inprovise::Controller.wait!
|
@@ -60,10 +60,10 @@ class Inprovise::Cli
|
|
60
60
|
cnod.command :list do |cnod_list|
|
61
61
|
cnod_list.switch [:d, :details], negatable: false, :desc => 'Show node details'
|
62
62
|
|
63
|
-
cnod_list.action do |
|
63
|
+
cnod_list.action do |_global,options,args|
|
64
64
|
$stdout.puts
|
65
|
-
$stdout.puts
|
66
|
-
$stdout.puts
|
65
|
+
$stdout.puts ' INFRASTRUCTURE NODES'
|
66
|
+
$stdout.puts ' ===================='
|
67
67
|
if args.empty?
|
68
68
|
Inprovise::Infrastructure.list(Inprovise::Infrastructure::Node).each do |n|
|
69
69
|
Inprovise::Cli.show_target(n, options[:details])
|
@@ -75,7 +75,7 @@ class Inprovise::Cli
|
|
75
75
|
when Inprovise::Infrastructure::Node
|
76
76
|
Inprovise::Cli.show_target(tgt, options[:details])
|
77
77
|
when Inprovise::Infrastructure::Group
|
78
|
-
$stdout.puts " #{tgt
|
78
|
+
$stdout.puts " #{tgt}"
|
79
79
|
$stdout.puts " #{'-' * tgt.to_s.size}"
|
80
80
|
tgt.targets.each {|n| Inprovise::Cli.show_target(n, options[:details]) }
|
81
81
|
$stdout.puts " #{'-' * tgt.to_s.size}"
|
@@ -5,15 +5,18 @@
|
|
5
5
|
|
6
6
|
class Inprovise::Cli
|
7
7
|
|
8
|
+
def self.setup_provisioning_cmd(cmd, &block)
|
9
|
+
cmd.desc 'Path to a provisioning scheme to load'
|
10
|
+
cmd.flag [:s,:scheme], :arg_name => 'FILE', :multiple => true, :default_value => Inprovise.default_scheme
|
11
|
+
cmd.flag [:c, :config], :arg_name => 'CFGKEY=CFGVAL', :multiple => true, :desc => 'Specify a configuration setting for the script execution'
|
12
|
+
cmd.action(&block)
|
13
|
+
end
|
14
|
+
|
8
15
|
desc 'Apply the given script/package to the specified infrastructure nodes and/or groups.'
|
9
16
|
arg_name 'SCRIPT TARGET[ TARGET[...]]'
|
10
17
|
command :apply do |capply|
|
11
18
|
|
12
|
-
capply
|
13
|
-
capply.flag [:s,:scheme], :arg_name => 'FILE', :multiple => true, :default_value => Inprovise.default_scheme
|
14
|
-
capply.flag [:c, :config], :arg_name => 'CFGKEY=CFGVAL', :multiple => true, :desc => 'Specify a configuration setting for the script execution'
|
15
|
-
|
16
|
-
capply.action do |global, options, args|
|
19
|
+
Inprovise::Cli.setup_provisioning_cmd(capply) do |_global, options, args|
|
17
20
|
raise ArgumentError, 'Missing arguments!' if args.empty?
|
18
21
|
raise ArgumentError, 'Missing targets!' if args.size < 2
|
19
22
|
Inprovise::Controller.run(:apply, options, *args)
|
@@ -25,11 +28,7 @@ class Inprovise::Cli
|
|
25
28
|
arg_name 'SCRIPT NAME[ NAME[...]]'
|
26
29
|
command :revert do |crevert|
|
27
30
|
|
28
|
-
crevert
|
29
|
-
crevert.flag [:s,:scheme], :arg_name => 'FILE', :multiple => true, :default_value => Inprovise.default_scheme
|
30
|
-
crevert.flag [:c, :config], :arg_name => 'CFGKEY=CFGVAL', :multiple => true, :desc => 'Specify a configuration setting for the script execution'
|
31
|
-
|
32
|
-
crevert.action do |global, options, args|
|
31
|
+
Inprovise::Cli.setup_provisioning_cmd(crevert) do |_global, options, args|
|
33
32
|
raise ArgumentError, 'Missing arguments!' if args.empty?
|
34
33
|
raise ArgumentError, 'Missing targets!' if args.size < 2
|
35
34
|
Inprovise::Controller.run(:revert, options, *args)
|
@@ -41,11 +40,7 @@ class Inprovise::Cli
|
|
41
40
|
arg_name 'SCRIPT NAME[ NAME[...]]'
|
42
41
|
command :validate do |cvalid|
|
43
42
|
|
44
|
-
cvalid
|
45
|
-
cvalid.flag [:s,:scheme], :arg_name => 'FILE', :multiple => true, :default_value => Inprovise.default_scheme
|
46
|
-
cvalid.flag [:c, :config], :arg_name => 'CFGKEY=CFGVAL', :multiple => true, :desc => 'Specify a configuration setting for the script execution'
|
47
|
-
|
48
|
-
cvalid.action do |global, options, args|
|
43
|
+
Inprovise::Cli.setup_provisioning_cmd(cvalid) do |_global, options, args|
|
49
44
|
raise ArgumentError, 'Missing arguments!' if args.empty?
|
50
45
|
raise ArgumentError, 'Missing targets!' if args.size < 2
|
51
46
|
Inprovise::Controller.run(:validate, options, *args)
|
@@ -57,11 +52,7 @@ class Inprovise::Cli
|
|
57
52
|
arg_name 'ACTION NAME[ NAME[...]]'
|
58
53
|
command :trigger do |ctrigger|
|
59
54
|
|
60
|
-
ctrigger
|
61
|
-
ctrigger.flag [:s,:scheme], :arg_name => 'FILE', :multiple => true, :default_value => Inprovise.default_scheme
|
62
|
-
ctrigger.flag [:c, :config], :arg_name => 'CFGKEY=CFGVAL', :multiple => true, :desc => 'Specify a configuration setting for the script execution'
|
63
|
-
|
64
|
-
ctrigger.action do |global, options, args|
|
55
|
+
Inprovise::Cli.setup_provisioning_cmd(ctrigger) do |_global, options, args|
|
65
56
|
raise ArgumentError, 'Missing arguments!' if args.empty?
|
66
57
|
raise ArgumentError, 'Missing targets!' if args.size < 2
|
67
58
|
Inprovise::Controller.run(:trigger, options, *args)
|
@@ -76,7 +67,7 @@ class Inprovise::Cli
|
|
76
67
|
clist.flag [:s,:scheme], :arg_name => 'FILE', :multiple => true, :default_value => Inprovise.default_scheme
|
77
68
|
clist.switch [:a, :all], negatable: false, :desc => 'List all scripts (with or without description)'
|
78
69
|
|
79
|
-
clist.action do |
|
70
|
+
clist.action do |_global, options, _args|
|
80
71
|
Inprovise::Controller.list_scripts(options)
|
81
72
|
end
|
82
73
|
end
|
data/lib/inprovise/cli.rb
CHANGED
@@ -42,7 +42,7 @@ class Inprovise::Cli
|
|
42
42
|
|
43
43
|
desc 'Initialize Inprovise project.'
|
44
44
|
command :init do |cinit|
|
45
|
-
cinit.action do |
|
45
|
+
cinit.action do |_global,_options,_args|
|
46
46
|
raise RuntimeError, 'Cannot initialize existing project directory.' if File.exists?(Inprovise::INFRA_FILE)
|
47
47
|
raise RuntimeError, "Default scheme #{Inprovise.default_scheme} already exists." if File.exists?(Inprovise.default_scheme)
|
48
48
|
begin
|
@@ -57,7 +57,7 @@ class Inprovise::Cli
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
pre do |global,command,
|
60
|
+
pre do |global,command,_options,_args|
|
61
61
|
# Pre logic here
|
62
62
|
# Return true to proceed; false to abort and not call the
|
63
63
|
# chosen command
|
@@ -79,11 +79,11 @@ class Inprovise::Cli
|
|
79
79
|
true
|
80
80
|
end
|
81
81
|
|
82
|
-
post do |global,command,options,args|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
end
|
82
|
+
# post do |global,command,options,args|
|
83
|
+
# # Post logic here
|
84
|
+
# # Use skips_post before a command to skip this
|
85
|
+
# # block on that command only
|
86
|
+
# end
|
87
87
|
|
88
88
|
on_error do |exception|
|
89
89
|
# Error logic here
|
@@ -96,7 +96,7 @@ class Inprovise::Cli
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def self.show_target(tgt, details=false)
|
99
|
-
$stdout.puts " #{tgt
|
99
|
+
$stdout.puts " #{tgt}"
|
100
100
|
if details
|
101
101
|
$stdout.puts " \t"+JSON.pretty_generate(tgt.config).split("\n").join("\n \t")
|
102
102
|
end
|
@@ -48,17 +48,17 @@ module Inprovise::CmdChannel
|
|
48
48
|
|
49
49
|
# command execution (MANDATORY)
|
50
50
|
|
51
|
-
def run(
|
51
|
+
def run(_command, _forcelog=false)
|
52
52
|
raise RuntimeError, 'UNIMPLEMENTED'
|
53
53
|
end
|
54
54
|
|
55
55
|
# MANDATORY file management routines
|
56
56
|
|
57
|
-
def upload(
|
57
|
+
def upload(_from, _to)
|
58
58
|
raise RuntimeError, 'UNIMPLEMENTED'
|
59
59
|
end
|
60
60
|
|
61
|
-
def download(
|
61
|
+
def download(_from, _to)
|
62
62
|
raise RuntimeError, 'UNIMPLEMENTED'
|
63
63
|
end
|
64
64
|
|
data/lib/inprovise/cmd_helper.rb
CHANGED
@@ -47,7 +47,7 @@ module Inprovise::CmdHelper
|
|
47
47
|
nil
|
48
48
|
end
|
49
49
|
|
50
|
-
def env_reference(
|
50
|
+
def env_reference(_varname)
|
51
51
|
nil
|
52
52
|
end
|
53
53
|
|
@@ -56,7 +56,7 @@ module Inprovise::CmdHelper
|
|
56
56
|
end
|
57
57
|
|
58
58
|
# *must* return previous value
|
59
|
-
def set_cwd(
|
59
|
+
def set_cwd(_path)
|
60
60
|
nil
|
61
61
|
end
|
62
62
|
|
@@ -83,7 +83,7 @@ module Inprovise::CmdHelper
|
|
83
83
|
|
84
84
|
# basic commands
|
85
85
|
|
86
|
-
def echo(
|
86
|
+
def echo(_arg)
|
87
87
|
nil
|
88
88
|
end
|
89
89
|
|
@@ -91,59 +91,59 @@ module Inprovise::CmdHelper
|
|
91
91
|
echo(env_reference(var))
|
92
92
|
end
|
93
93
|
|
94
|
-
def cat(
|
94
|
+
def cat(_path)
|
95
95
|
nil
|
96
96
|
end
|
97
97
|
|
98
|
-
def hash_for(
|
98
|
+
def hash_for(_path)
|
99
99
|
nil
|
100
100
|
end
|
101
101
|
|
102
|
-
def mkdir(
|
102
|
+
def mkdir(_path)
|
103
103
|
nil
|
104
104
|
end
|
105
105
|
|
106
|
-
def exists?(
|
106
|
+
def exists?(_path)
|
107
107
|
false
|
108
108
|
end
|
109
109
|
|
110
|
-
def file?(
|
110
|
+
def file?(_path)
|
111
111
|
false
|
112
112
|
end
|
113
113
|
|
114
|
-
def directory?(
|
114
|
+
def directory?(_path)
|
115
115
|
false
|
116
116
|
end
|
117
117
|
|
118
|
-
def copy(
|
118
|
+
def copy(_from, _to)
|
119
119
|
nil
|
120
120
|
end
|
121
121
|
|
122
|
-
def move(
|
122
|
+
def move(_from, _to)
|
123
123
|
nil
|
124
124
|
end
|
125
125
|
|
126
|
-
def delete(
|
126
|
+
def delete(_path)
|
127
127
|
nil
|
128
128
|
end
|
129
129
|
|
130
|
-
def permissions(
|
130
|
+
def permissions(_path)
|
131
131
|
0
|
132
132
|
end
|
133
133
|
|
134
|
-
def set_permissions(
|
134
|
+
def set_permissions(_path, _perm)
|
135
135
|
nil
|
136
136
|
end
|
137
137
|
|
138
|
-
def owner(
|
138
|
+
def owner(_path)
|
139
139
|
nil
|
140
140
|
end
|
141
141
|
|
142
|
-
def set_owner(
|
142
|
+
def set_owner(_path, _user, _group=nil)
|
143
143
|
nil
|
144
144
|
end
|
145
145
|
|
146
|
-
def binary_exists?(
|
146
|
+
def binary_exists?(_bin)
|
147
147
|
false
|
148
148
|
end
|
149
149
|
|