mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
Merge pull request #60 from chef/cli--key
Merged change 2101f59e-fbad-4209-85a3-473a950b084a From review branch cli--key into master Signed-off-by: chartmann <chartmann@chef.io>
This commit is contained in:
commit
ba8f1ec098
2 changed files with 8 additions and 2 deletions
|
@ -55,7 +55,7 @@ class VulcanoCLI < Thor
|
|||
desc: 'The login user for a remote scan.'
|
||||
option :password, type: :string, default: nil,
|
||||
desc: 'Login password for a remote scan, if required.'
|
||||
option :key_file, type: :string, default: nil,
|
||||
option :key, type: :string, default: nil,
|
||||
desc: 'Login key or certificate file for a remote scan.'
|
||||
option :disable_sudo, type: :boolean, default: false,
|
||||
desc: 'To not run remote scans via sudo.'
|
||||
|
|
|
@ -12,9 +12,15 @@ 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']
|
||||
if !key.nil? and File.file?(key)
|
||||
conf['key_file'] = key
|
||||
end
|
||||
|
||||
return conf if conf['target'].to_s.empty?
|
||||
|
||||
uri = URI.parse(conf['target'].to_s)
|
||||
|
|
Loading…
Reference in a new issue