norad_spec_runner 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/norad_spec_runner/cli.rb +2 -0
- data/lib/norad_spec_runner/remote_task.rb +17 -2
- data/lib/norad_spec_runner/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b73ddcb59e0e2fce7fa32f4f00473aab8ba2bbc
|
4
|
+
data.tar.gz: 321f8f8c755bca498d18200fb311f034b36c26d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9900761058380e65ad9de155ffee4bfac7c5e93690eb93cb313069d9d3c7eac1cbff25f4ba0a0a376101b8a0bb95a51d14a31d92c981ea9ea6b2f862677b0168
|
7
|
+
data.tar.gz: d5aea3728b0147c55cd014c1487644ba9fc51d0b87c6738b7f7bc2589bad1bce9b97f13f439ce019405f75f2742df0fed28af997d8d53be78316370400b5b367
|
@@ -21,6 +21,8 @@ module NoradSpecRunner
|
|
21
21
|
method_option :port, :aliases => '-p', :desc => 'Port to connect on', :default => '22'
|
22
22
|
method_option :cisco_enable_pw, :desc => 'Password to enter Enable mode in Cisco IOS', :default => ''
|
23
23
|
method_option :detect_os, :desc => 'Whether or not to perform OS detection', :type => :boolean, :default => false
|
24
|
+
method_option :disable_sudo, :desc => 'Whether or not to use sudo', :type => :boolean, :default => true
|
25
|
+
method_option :tags, :desc => 'rspec --tag options', :default => '\'\''
|
24
26
|
|
25
27
|
def remote(encoded_key)
|
26
28
|
spectask = NoradSpecRunner::RemoteTask.new(encoded_key, options)
|
@@ -10,12 +10,13 @@ module NoradSpecRunner
|
|
10
10
|
class RemoteTask < Task
|
11
11
|
SSH_TIMEOUT = 10
|
12
12
|
|
13
|
-
attr_reader :host, :username, :sshkey, :ssh_port, :obj, :platform, :results_file, :cisco_enable_pw, :tests_parent_dir
|
13
|
+
attr_reader :host, :username, :sshkey, :ssh_port, :obj, :platform, :results_file, :cisco_enable_pw, :tests_parent_dir, :disable_sudo
|
14
14
|
|
15
15
|
def initialize(encoded_key, options)
|
16
16
|
@host = options.fetch(:host)
|
17
17
|
@sshkey = options.fetch(:sshkey)
|
18
18
|
@cisco_enable_pw = options.fetch(:cisco_enable_pw, '')
|
19
|
+
@disable_sudo = options.fetch(:disable_sudo, 'true')
|
19
20
|
# Decode the key and store
|
20
21
|
File.open(@sshkey, "w") do |f|
|
21
22
|
f.write Base64.decode64(encoded_key)
|
@@ -32,7 +33,7 @@ module NoradSpecRunner
|
|
32
33
|
|
33
34
|
@results_file = options.fetch(:results_file)
|
34
35
|
@obj.pattern = detect_os ? autodetect_test_pattern(tests) : tests
|
35
|
-
@obj.rspec_opts =
|
36
|
+
@obj.rspec_opts = build_rspec_opts(options)
|
36
37
|
end
|
37
38
|
|
38
39
|
def run
|
@@ -46,6 +47,7 @@ module NoradSpecRunner
|
|
46
47
|
ENV['AUDIT_SSHKEY'] = sshkey
|
47
48
|
ENV['AUDIT_SSH_PORT'] = ssh_port
|
48
49
|
ENV['AUDIT_CISCO_ENABLE_PASSWORD'] = cisco_enable_pw
|
50
|
+
ENV['AUDIT_DISABLE_SUDO'] = disable_sudo.to_s
|
49
51
|
|
50
52
|
# Capture STDERR for SSH related errors
|
51
53
|
STDERR.reopen(ftmp)
|
@@ -134,5 +136,18 @@ module NoradSpecRunner
|
|
134
136
|
write_error_to_results_file e.message
|
135
137
|
true
|
136
138
|
end
|
139
|
+
|
140
|
+
def build_rspec_opts(options)
|
141
|
+
rspec_opts = [ '--format json', "-o #{@results_file}"]
|
142
|
+
options.fetch(:tags).split(',').each do |tag|
|
143
|
+
rspec_opts << "--tag=#{tag}"
|
144
|
+
end
|
145
|
+
# --tag and --example do not work together so
|
146
|
+
# if there is a tag disable example option
|
147
|
+
if options.fetch(:tags) == ''
|
148
|
+
rspec_opts << "-e #{sub_tests}"
|
149
|
+
end
|
150
|
+
rspec_opts.join(' ')
|
151
|
+
end
|
137
152
|
end
|
138
153
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: norad_spec_runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Manifold
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-05-
|
13
|
+
date: 2017-05-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: serverspec
|