lib/bolt/config.rb in bolt-0.18.1 vs lib/bolt/config.rb in bolt-0.18.2

- old
+ new

@@ -14,15 +14,21 @@ winrm: Bolt::Transport::WinRM, pcp: Bolt::Transport::Orch, local: Bolt::Transport::Local }.freeze + class UnknownTransportError < Bolt::Error + def initialize(transport, uri = nil) + msg = uri.nil? ? "Unknown transport #{transport}" : "Unknown transport #{transport} found for #{uri}" + super(msg, 'bolt/unknown-transport') + end + end + Config = Struct.new( :concurrency, :format, :inventoryfile, - :log_level, :log, :modulepath, :puppetdb, :transport, :transports @@ -200,9 +206,13 @@ end end unless %w[human json].include? self[:format] raise Bolt::CLIError, "Unsupported format: '#{self[:format]}'" + end + + unless self[:transport].nil? || Bolt::TRANSPORTS.include?(self[:transport].to_sym) + raise UnknownTransportError, self[:transport] end TRANSPORTS.each do |transport, impl| impl.validate(self[:transports][transport]) end