mirror of
https://github.com/inspec/inspec
synced 2025-02-18 23:18:53 +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
|
# Resolve target configuration in URI-scheme into
|
||||||
# all respective fields and merge with existing configuration.
|
# all respective fields and merge with existing configuration.
|
||||||
# e.g. ssh://bob@remote => backend: ssh, user: bob, host: remote
|
# 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
|
conf = config.nil? ? {} : config.dup
|
||||||
|
|
||||||
|
# in case the user specified a key-file, register it that way
|
||||||
key = conf['key']
|
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?
|
return conf if conf['target'].to_s.empty?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue