mirror of
https://github.com/inspec/inspec
synced 2024-09-21 15:02:01 +00:00
Check added for automate server 2 for server presence
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
This commit is contained in:
parent
dcb99872ff
commit
6ce9c04232
2 changed files with 18 additions and 1 deletions
|
@ -24,7 +24,11 @@ module InspecPlugins
|
|||
# the username of the account is used that is logged in
|
||||
def self.profiles(config, profile_filter = nil) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength
|
||||
owner = config["owner"] || config["user"]
|
||||
url = "#{config["server"]}/compliance/profiles/search"
|
||||
if is_automate2_server?(config)
|
||||
url = "#{config["server"]}/compliance/profiles/search"
|
||||
else
|
||||
raise ServerConfigurationMissing
|
||||
end
|
||||
|
||||
headers = get_headers(config)
|
||||
if profile_filter
|
||||
|
@ -210,6 +214,10 @@ module InspecPlugins
|
|||
|
||||
config["version"]["version"]
|
||||
end
|
||||
|
||||
def self.is_automate2_server?(config)
|
||||
config["server_type"] == "automate2"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -208,4 +208,13 @@ describe InspecPlugins::Compliance::API do
|
|||
_(InspecPlugins::Compliance::API.exist?(config, "admin/missing-in-action")).must_equal false
|
||||
end
|
||||
end
|
||||
|
||||
describe "when the config has a automate2 server_type" do
|
||||
it "automate server 2 is? methods return correctly" do
|
||||
config = InspecPlugins::Compliance::Configuration.new
|
||||
config.clean
|
||||
config["server_type"] = "automate2"
|
||||
_(InspecPlugins::Compliance::API.is_automate2_server?(config)).must_equal true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue