norad_cli 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/norad_cli/cli/sectest.rb +7 -1
- data/lib/norad_cli/support/sectest_container.rb +7 -1
- data/lib/norad_cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d75304010117d3484f9e1d7828b0d09335131d48
|
4
|
+
data.tar.gz: 7e79b1b5f11ffbf988248644102a1d1b6f13b52a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0c87d8f23fa01e5fcae0355bc5886d4c3e4e3e4a5822542ccd2adb895a78711857cf81df6e259696161b656db14b65dfffec84928ce1007c26356c7bc8dbc73
|
7
|
+
data.tar.gz: b60aa8a94481885057e0b8e9913c971197c3b2b6fb819f15655ee3b99b5a969b2e156ae7ef63693fe270743fa69f02dba693b2e4019fd9383b54e24e76595990
|
@@ -211,9 +211,12 @@ class Sectest < Thor
|
|
211
211
|
else
|
212
212
|
desc 'execute SECTESTNAME', 'Execute SECTESTNAME against an arbitrary target'
|
213
213
|
end
|
214
|
-
option :debug, aliases: '-d', type: :boolean, default: false, desc: 'Turn on debugging messages (e.g. Docker build logs to stdout)'
|
214
|
+
option :debug, aliases: '-d', type: :boolean, default: false, desc: 'Turn on debugging messages (e.g. Docker build logs to stdout, containers not removed!)'
|
215
215
|
option :format, aliases: '-f', type: :boolean, default: false, desc: 'Print the JSON results formatted'
|
216
216
|
def execute(sectest_name)
|
217
|
+
# Warn users if debugging is enabled
|
218
|
+
say('Warning: Debug enabled: containers must be removed manually', :yellow) && sleep(2) if options['debug']
|
219
|
+
|
217
220
|
# Ensure the results server is built by building the images specs (code reuse)
|
218
221
|
send('build:specs', sectest_name)
|
219
222
|
|
@@ -239,6 +242,9 @@ class Sectest < Thor
|
|
239
242
|
|
240
243
|
# Cleanup the sectest container
|
241
244
|
sectest_instance.shutdown
|
245
|
+
|
246
|
+
# Warn users if debugging is enabled
|
247
|
+
say('Warning: Debug enabled: containers must be removed manually', :yellow) if options['debug']
|
242
248
|
end
|
243
249
|
|
244
250
|
desc 'spec:image SECTESTNAME', 'Run the rspec tests for SECTESTNAME'
|
@@ -10,6 +10,7 @@ module NoradCli
|
|
10
10
|
attr_accessor :assessment_id
|
11
11
|
attr_accessor :sectest_image
|
12
12
|
attr_accessor :results_server
|
13
|
+
attr_accessor :debug
|
13
14
|
|
14
15
|
def initialize(sectest_name, registry, version, options)
|
15
16
|
# Generate a random assessment id
|
@@ -17,6 +18,9 @@ module NoradCli
|
|
17
18
|
|
18
19
|
@sectest_image = "#{registry}/#{sectest_name}:#{version}"
|
19
20
|
|
21
|
+
# Set whether debugging is configured
|
22
|
+
@debug = options[:debug]
|
23
|
+
|
20
24
|
# Create a results server
|
21
25
|
@results_server = NoradCli::ResultsServer.new('docker-images-test-results-server')
|
22
26
|
|
@@ -107,7 +111,9 @@ module NoradCli
|
|
107
111
|
def shutdown
|
108
112
|
# Stop the sectest image container and delete
|
109
113
|
@container.stop
|
110
|
-
|
114
|
+
|
115
|
+
# Delete the container only if not in debug mode
|
116
|
+
@container.delete(force: true) unless @debug
|
111
117
|
|
112
118
|
# Cleanup/Garbage collect the results server
|
113
119
|
@results_server.shutdown
|
data/lib/norad_cli/version.rb
CHANGED