hammer_cli_foreman_openscap 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/hammer_cli_foreman_openscap/commands.rb +4 -3
- data/lib/hammer_cli_foreman_openscap/policy.rb +16 -0
- data/lib/hammer_cli_foreman_openscap/version.rb +1 -1
- data/test/compliance_resource_mock.rb +9 -2
- data/test/functional/scap_content_test.rb +2 -2
- data/test/functional/tailoring_file_test.rb +3 -5
- data/test/test_helper.rb +1 -1
- metadata +16 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 678b37b57981936274fec62371d7f0b29e087bd4675e78f2ac80673e4291efb1
|
4
|
+
data.tar.gz: 7951dae03743b2ca635500e61fe7d6197995050f06085ea993cc41c0959e4c8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 605ff8f09fee4a99649fc1ab3354c1827697334b9bb5b3f80c9fbc491974b0e1be0672f85ae746db0ec5d9fe5e68bd543c5446ef8903c39f872b87d7a9e9ad8c
|
7
|
+
data.tar.gz: d2c0b22b4e4f79d229afaee49f30d0378f9ca71169a3414472da1d7db1a23cc36371dee3c073567e1b44ec640ba9a5603995ab624d43e16bcd58ad8e93ff83f1
|
@@ -50,10 +50,11 @@ module HammerCLIForemanOpenscap
|
|
50
50
|
option("--scap-file", "SCAP_FILE", description, opts, &block)
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
54
|
-
|
53
|
+
def method_options(params)
|
54
|
+
opts = super params
|
55
|
+
opts[resource.singular_name]['original_filename'] ||= self.class.declared_options.find { |opt| opt.attribute_name == "option_scap_file" }
|
55
56
|
.value_formatter.original_filename
|
56
|
-
|
57
|
+
opts
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
@@ -52,6 +52,22 @@ module HammerCLIForemanOpenscap
|
|
52
52
|
build_options
|
53
53
|
end
|
54
54
|
|
55
|
+
class HostsCommand < HammerCLIForeman::AssociatedListSearchCommand
|
56
|
+
command_name 'hosts'
|
57
|
+
search_resource :hosts
|
58
|
+
|
59
|
+
def self.search_options_mapping
|
60
|
+
{
|
61
|
+
'id' => 'compliance_policy_id',
|
62
|
+
'name' => 'compliance_policy'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
output HammerCLIForeman::Host::ListCommand.output_definition
|
67
|
+
|
68
|
+
build_options
|
69
|
+
end
|
70
|
+
|
55
71
|
autoload_subcommands
|
56
72
|
end
|
57
73
|
end
|
@@ -4,12 +4,19 @@
|
|
4
4
|
def self.arf
|
5
5
|
{
|
6
6
|
:id => 1,
|
7
|
-
:host =>
|
7
|
+
:host => {
|
8
|
+
:name => "somewhere.example.com"
|
9
|
+
},
|
8
10
|
:reported_at => "1916-06-08",
|
9
11
|
:passed => 24,
|
10
12
|
:failed => 25,
|
11
13
|
:othered => 26,
|
12
|
-
:
|
14
|
+
:openscap_proxy_name => {
|
15
|
+
:name => "scap_proxy.example.com"
|
16
|
+
},
|
17
|
+
:policy => {
|
18
|
+
:name => "strict policy"
|
19
|
+
}
|
13
20
|
}
|
14
21
|
end
|
15
22
|
|
@@ -12,9 +12,9 @@ describe 'scap content' do
|
|
12
12
|
expected_result = CommandExpectation.new
|
13
13
|
expected_result.expected_err =
|
14
14
|
['Could not download the SCAP content file:',
|
15
|
-
' Error: Option --path is required',
|
15
|
+
' Error: Option --path is required.',
|
16
16
|
' ',
|
17
|
-
" See: 'hammer scap-content download --help'",
|
17
|
+
" See: 'hammer scap-content download --help'.",
|
18
18
|
''].join("\n")
|
19
19
|
|
20
20
|
expected_result.expected_exit_code = HammerCLI::EX_USAGE
|
@@ -11,9 +11,7 @@ describe 'tailoring file' do
|
|
11
11
|
|
12
12
|
expected_result = CommandExpectation.new
|
13
13
|
expected_result.expected_err =
|
14
|
-
|
15
|
-
" Missing arguments for 'tailoring_file[scap_file]'",
|
16
|
-
''].join("\n")
|
14
|
+
"Failed to create Tailoring file:\n Missing arguments for '--scap-file'.\n"
|
17
15
|
expected_result.expected_exit_code = HammerCLI::EX_USAGE
|
18
16
|
|
19
17
|
api_expects_no_call
|
@@ -45,9 +43,9 @@ describe 'tailoring file' do
|
|
45
43
|
expected_result = CommandExpectation.new
|
46
44
|
expected_result.expected_err =
|
47
45
|
['Could not download the Tailoring file:',
|
48
|
-
' Error: Option --path is required',
|
46
|
+
' Error: Option --path is required.',
|
49
47
|
' ',
|
50
|
-
" See: 'hammer tailoring-file download --help'",
|
48
|
+
" See: 'hammer tailoring-file download --help'.",
|
51
49
|
''].join("\n")
|
52
50
|
|
53
51
|
expected_result.expected_exit_code = HammerCLI::EX_USAGE
|
data/test/test_helper.rb
CHANGED
@@ -4,7 +4,7 @@ FOREMAN_OPENSCAP_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'])
|
|
4
4
|
require 'minitest/autorun'
|
5
5
|
require 'minitest/spec'
|
6
6
|
require "minitest-spec-context"
|
7
|
-
require "mocha/
|
7
|
+
require "mocha/minitest"
|
8
8
|
require 'hammer_cli'
|
9
9
|
|
10
10
|
if HammerCLI.context[:api_connection]
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hammer_cli_foreman_openscap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Foreman team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hammer_cli_foreman
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.19'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.19'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0
|
32
|
+
version: '3.0'
|
27
33
|
description:
|
28
34
|
email:
|
29
35
|
executables: []
|
@@ -96,22 +102,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
102
|
version: '0'
|
97
103
|
requirements: []
|
98
104
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.6.
|
105
|
+
rubygems_version: 2.7.6.2
|
100
106
|
signing_key:
|
101
107
|
specification_version: 4
|
102
108
|
summary: Foreman OpenSCAP commands for Hammer
|
103
109
|
test_files:
|
104
|
-
- test/compliance_resource_mock.rb
|
105
110
|
- test/data/1.11/foreman_api.json
|
106
111
|
- test/data/1.14/foreman_api.json
|
107
112
|
- test/data/1.15/foreman_api.json
|
108
113
|
- test/data/tailoring.xml
|
114
|
+
- test/functional/test_helper.rb
|
109
115
|
- test/functional/scap_content_test.rb
|
110
116
|
- test/functional/tailoring_file_test.rb
|
111
|
-
- test/functional/test_helper.rb
|
112
|
-
- test/test_helper.rb
|
113
117
|
- test/unit/arf_report_test.rb
|
114
118
|
- test/unit/policy_test.rb
|
115
119
|
- test/unit/scap_content_test.rb
|
116
120
|
- test/unit/tailoring_file_test.rb
|
117
121
|
- test/unit/test_helper.rb
|
122
|
+
- test/compliance_resource_mock.rb
|
123
|
+
- test/test_helper.rb
|