foreman_scap_client 0.4.0 → 0.4.1

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: 2e702d979ef4efb30e81f353704aa35d9329cdcb
4
- data.tar.gz: 8637950187141f8c7b9a7ab74b8396da710d31e1
3
+ metadata.gz: 2e1d9a1c7773947e69aa15ba2d18c1a41ce91497
4
+ data.tar.gz: 570dac9c4894772bd88aded4a18904162a3a5cd5
5
5
  SHA512:
6
- metadata.gz: 616bb33708a3d3f2ca6644812ffc392126074d79a04e4dd7746a2a76b263dd8b4277fd8229f1ed6709f2791fdfbf415fef721750934ee579c3e180934be73a91
7
- data.tar.gz: a66ed283164da3cf15c2fa32b1fd168d007ddafa6d10a0750fca694c394717185d1cd4e1fec3a7da8d77811a9e5feb6316adf8f0f71ff68bb545b0bd7ad9f047
6
+ metadata.gz: 5f6caeccc03830952518b504013a010415907cbcf9596988e344a251f60478804a90652a4b0844fc0bceef9aa209dbf8c41f87c93ff8fe9c4e3192ead1edb03c
7
+ data.tar.gz: bc5b475cda32769f35cc91e612074d4854e83fb78d0eb6cf4d06af5ce97fa4b568ad1eb8952786f206a57b994464f284e6c6856efb39fe5a9384fd9e9fb36ed9
@@ -1,3 +1,4 @@
1
+ require 'rubygems' if RUBY_VERSION.start_with? '1.8'
1
2
  require 'yaml'
2
3
  require 'tmpdir'
3
4
  require 'net/http'
@@ -28,6 +29,10 @@ module ForemanScapClient
28
29
 
29
30
  private
30
31
 
32
+ def warn_proxy_not_supported
33
+ puts 'Configuration for HTTP(S) proxy found but not supported for ruby 1.8' if http_proxy_uri
34
+ end
35
+
31
36
  def load_config
32
37
  @config ||= YAML.load_file(CONFIG_FILE)
33
38
  ensure_policy_exist
@@ -40,6 +45,15 @@ module ForemanScapClient
40
45
 
41
46
  def scan
42
47
  puts "DEBUG: running: " + scan_command
48
+
49
+ if RUBY_VERSION.start_with? '1.8'
50
+ legacy_run_scan
51
+ else
52
+ run_scan
53
+ end
54
+ end
55
+
56
+ def run_scan
43
57
  stdout_str, error_str, result = Open3.capture3(scan_command_env_vars, scan_command)
44
58
  if result.success? || result.exitstatus == 2
45
59
  @report = results_path
@@ -51,6 +65,19 @@ module ForemanScapClient
51
65
  end
52
66
  end
53
67
 
68
+ def legacy_run_scan
69
+ warn_proxy_not_supported
70
+ result = `#{scan_command}`
71
+
72
+ if $?.success? || $?.exitstatus == 2
73
+ @report = results_path
74
+ else
75
+ puts 'Scan failed'
76
+ puts result
77
+ exit(2)
78
+ end
79
+ end
80
+
54
81
  def scan_command_env_vars
55
82
  if http_proxy_uri
56
83
  {
@@ -96,7 +123,7 @@ module ForemanScapClient
96
123
  end
97
124
 
98
125
  def bzip_command
99
- "/usr/bin/bzip2 #{results_path}"
126
+ "/usr/bin/env bzip2 #{results_path}"
100
127
  end
101
128
 
102
129
  def bzip
@@ -1,3 +1,3 @@
1
1
  module ForemanScapClient
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_scap_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Hulan
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-10-12 00:00:00.000000000 Z
13
+ date: 2019-01-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  requirements:
80
- - "/usr/bin/bzip2"
80
+ - bzip2
81
81
  rubyforge_project:
82
82
  rubygems_version: 2.6.8
83
83
  signing_key: