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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8860651242fcd0bf3b1705504a70f600823d6aac
4
- data.tar.gz: 21aa5ac57a4b9a8c76ead029a59d4e6d57b9762d
3
+ metadata.gz: d75304010117d3484f9e1d7828b0d09335131d48
4
+ data.tar.gz: 7e79b1b5f11ffbf988248644102a1d1b6f13b52a
5
5
  SHA512:
6
- metadata.gz: cd71776227fa2fe192b53349624b8f09d4f2843554b0146d48c172c1a8339692e6fc338d00ac022032e71539a26f552dbc2935be61eb135cbbc413329c5989c9
7
- data.tar.gz: b05c1f5a97cb2bca7a72239e04f99fb4d74e0a35f6a20a8a095baabb0217d99dd7b3e3694df6af78c48beabdf606f327bc3d12e42c29fa505c56ca4a6cdd0fe7
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
- @container.delete(force: true)
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module NoradCli
3
- VERSION = '0.1.16'
3
+ VERSION = '0.1.17'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norad_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Hitchcock