mirror of
https://github.com/inspec/inspec
synced 2024-11-13 00:17:08 +00:00
Fix the A2 vendoring with depends on the A2 server. (#3022)
Signed-off-by: Jared Quick <jquick@chef.io>
This commit is contained in:
parent
92bb4fd3ee
commit
dabb1aa142
2 changed files with 16 additions and 0 deletions
|
@ -96,6 +96,12 @@ module Compliance
|
||||||
%r{^#{@config['server']}/owners/(?<owner>[^/]+)/compliance/(?<id>[^/]+)/tar$}
|
%r{^#{@config['server']}/owners/(?<owner>[^/]+)/compliance/(?<id>[^/]+)/tar$}
|
||||||
end.match(@target)
|
end.match(@target)
|
||||||
|
|
||||||
|
if Compliance::API.is_automate2_server?(@config)
|
||||||
|
m = {}
|
||||||
|
m[:owner] = @config['profile'][0]
|
||||||
|
m[:id] = @config['profile'][1]
|
||||||
|
end
|
||||||
|
|
||||||
raise 'Unable to determine compliance profile name. This can be caused by ' \
|
raise 'Unable to determine compliance profile name. This can be caused by ' \
|
||||||
'an incorrect server in your configuration. Try to login to compliance ' \
|
'an incorrect server in your configuration. Try to login to compliance ' \
|
||||||
'via the `inspec compliance login` command.' if m.nil?
|
'via the `inspec compliance login` command.' if m.nil?
|
||||||
|
|
|
@ -3,6 +3,16 @@ require 'helper'
|
||||||
describe Compliance::Fetcher do
|
describe Compliance::Fetcher do
|
||||||
let(:config) { { 'server' => 'myserver' } }
|
let(:config) { { 'server' => 'myserver' } }
|
||||||
|
|
||||||
|
describe 'when the server is an automate2 server' do
|
||||||
|
before { Compliance::API.expects(:is_automate2_server?).with(config).returns(true) }
|
||||||
|
|
||||||
|
it 'returns the correct owner and profile name' do
|
||||||
|
config['profile'] = ['admin', 'ssh-baseline', nil]
|
||||||
|
fetcher = Compliance::Fetcher.new('myserver/profile', config)
|
||||||
|
fetcher.send(:compliance_profile_name).must_equal 'admin/ssh-baseline'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'when the server is an automate server pre-0.8.0' do
|
describe 'when the server is an automate server pre-0.8.0' do
|
||||||
before { Compliance::API.expects(:is_automate_server_pre_080?).with(config).returns(true) }
|
before { Compliance::API.expects(:is_automate_server_pre_080?).with(config).returns(true) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue