From b69ccf50652262bdebb2f9418b137b8e87bdb144 Mon Sep 17 00:00:00 2001 From: Clinton Wolfe Date: Mon, 7 Jan 2019 18:49:49 -0500 Subject: [PATCH] Dial it back a bit Signed-off-by: Clinton Wolfe --- lib/train.rb | 8 +++++--- lib/train/plugins/transport.rb | 6 ------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/train.rb b/lib/train.rb index 262ab9dc..17a7d044 100644 --- a/lib/train.rb +++ b/lib/train.rb @@ -62,8 +62,9 @@ def self.load_transport(transport_name) end # Legacy code to unpack a series of items from an incoming Hash - # Inspec::Config.unpack_train_credentials now handles this in most cases - def self.target_config(config) # TODO: deprecate + # Inspec::Config.unpack_train_credentials now handles this in most cases that InSpec needs + # If you need to unpack a URI, use upack_target_from_uri + def self.target_config(config = nil) conf = config.dup # Symbolize keys conf.keys.each do |key| @@ -100,7 +101,8 @@ def self.unpack_target_from_uri(uri_string, opts = {}) # rubocop: disable Metric # ensure path is nil, if its empty; e.g. required to reset defaults for winrm # TODO: move logic into winrm plugin creds[:path] = nil if !creds[:path].nil? && creds[:path].to_s.empty? - creds.compact! + # compat! is available in ruby 2.4+ + creds = creds.delete_if { |_, value| value_nil? } # return the updated config creds diff --git a/lib/train/plugins/transport.rb b/lib/train/plugins/transport.rb index 9e5ae33c..99506497 100644 --- a/lib/train/plugins/transport.rb +++ b/lib/train/plugins/transport.rb @@ -41,12 +41,6 @@ def self.name(name) Train::Plugins.registry[name] = self end - # Describe the defaults for the options this transport provides. - def self.credential_option_defaults - # TODO - {} - end - private # @return [Logger] logger for reporting information