mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
simplify key assignment in conf
This commit is contained in:
parent
5825b4d6d4
commit
7d27b62794
1 changed files with 5 additions and 2 deletions
|
@ -12,11 +12,14 @@ module Vulcano
|
|||
# Resolve target configuration in URI-scheme into
|
||||
# all respective fields and merge with existing configuration.
|
||||
# e.g. ssh://bob@remote => backend: ssh, user: bob, host: remote
|
||||
def self.target_config(config = nil)
|
||||
def self.target_config(config = nil) # rubocop:disable Metrics/AbcSize
|
||||
conf = config.nil? ? {} : config.dup
|
||||
|
||||
# in case the user specified a key-file, register it that way
|
||||
key = conf['key']
|
||||
conf['key_file'] = key if !key.nil? and File.file?(key)
|
||||
if !key.nil? and File.file?(key)
|
||||
conf['key_file'] = key
|
||||
end
|
||||
|
||||
return conf if conf['target'].to_s.empty?
|
||||
|
||||
|
|
Loading…
Reference in a new issue