def create_ssh_transport(machine_options)
      machine_ssh_options = machine_options['ssh_options']

      ##
      # Ssh Username
      username = machine_ssh_options['user'] || 'root'

      Chef::Log.debug("======================================>")
      Chef::Log.debug("create_ssh_transport - username: #{username}")
      Chef::Log.debug("======================================>")

      ##
      # Ssh Password
      ssh_pass = machine_ssh_options['password'] || false
      if ssh_pass
        ssh_pass_hash = Hash.new
        ssh_pass_hash = { 'password' => ssh_pass }
      else
        Chef::Log.info("NO PASSWORD")
      end

      ##
      # Ssh Key
      ssh_keys = []
      if machine_ssh_options['keys']
        if machine_ssh_options['keys'].kind_of?(Array)
          machine_ssh_options['keys'].each do |key|
            ssh_keys << key
          end
        elsif machine_ssh_options['keys'].kind_of?(String)
          ssh_keys << machine_ssh_options['keys']
        else
          ssh_keys = false
        end
      end

      if ssh_keys
        ssh_key_hash = Hash.new
        ssh_key_hash = { 'keys' => ssh_keys }
      end

      Chef::Log.info("======================================>")
      if ssh_pass
        Chef::Log.info("create_ssh_transport - ssh_pass: #{ssh_pass_hash.inspect}")
      elsif ssh_keys
        Chef::Log.info("create_ssh_transport - ssh_key: #{ssh_keys.inspect}")
      else
        Chef::Log.info("create_ssh_transport - no ssh_pass or ssh_key given")
      end
      Chef::Log.info("======================================>")

      raise "no ssh_pass or ssh_key given" unless ( ssh_pass || ssh_keys )

      machine_ssh_options = machine_ssh_options.merge!(ssh_pass_hash) if ssh_pass_hash
      machine_ssh_options = machine_ssh_options.merge!(ssh_key_hash) if ssh_key_hash

      ##
      # Valid Ssh Options
      valid_ssh_options = [
        :auth_methods, :bind_address, :compression, :compression_level, :config,
        :encryption, :forward_agent, :hmac, :host_key,
        :keepalive, :keepalive_interval, :kex, :keys, :key_data,
        :languages, :logger, :paranoid, :password, :port, :proxy,
        :rekey_blocks_limit,:rekey_limit, :rekey_packet_limit, :timeout, :verbose,
        :global_known_hosts_file, :user_known_hosts_file, :host_key_alias,
        :host_name, :user, :properties, :passphrase, :keys_only, :max_pkt_size,
        :max_win_size, :send_env, :use_agent
      ]

      ##
      # Ssh Options
      ssh_options = symbolize_keys(machine_ssh_options)

      # Validate Ssh Options
      ssh_options.each { |k,v| raise 'Invalid Shh Option' unless valid_ssh_options.include?(k) }

      Chef::Log.debug "======================================>"
      Chef::Log.debug "create_ssh_transport - ssh_options: #{ssh_options.inspect}"
      Chef::Log.debug "======================================>"

      # Now That We Validated Options, Lets Get Our Target
      @target_host = get_target_connection_method(machine_ssh_options)

      # Make Sure We Can Connect
      begin
        ssh = Net::SSH.start(@target_host, username, ssh_options)
        ssh.close
        Chef::Log.debug("======================================>")
        Chef::Log.debug("ABLE to Connect to #{@target_host} using #{username} and #{ssh_options.inspect}")
        Chef::Log.debug("======================================>")
      rescue
        Chef::Log.debug("======================================>")
        Chef::Log.debug("UNABLE to Connect to #{@target_host} using #{username} and #{ssh_options.inspect}")
        Chef::Log.debug("======================================>")
        raise "UNABLE to Connect to #{@target_host} using #{username} and #{ssh_options.inspect}"
      end

      ##
      # Ssh Additional Options
      options = {}

      #Enable pty by default
      options[:ssh_pty_enable] = true

      # If we not root use sudo
      if username != 'root'
        options[:prefix] = 'sudo '
      end

      Chef::Log.debug("======================================>")
      Chef::Log.debug("create_ssh_transport - options: #{options.inspect}")
      Chef::Log.debug("======================================>")

      ChefMetal::Transport::SSH.new(@target_host, username, ssh_options, options, config)

      # We Duped It So Now We Can Zero the Node Attr. So Not Saved On Server
      # provisioner_options['machine_options']['password'] =
      #   nil if provisioner_options['machine_options']['password']

      # provisioner_options['ssh_options']['password'] =
      #   nil if provisioner_options['ssh_options']['password']

    end
def create_ssh_transport(machine_options)
      machine_ssh_options = machine_options['ssh_options']

      ##
      # Ssh Username
      username = machine_ssh_options['user'] || 'root'

      Chef::Log.debug("======================================>")
      Chef::Log.debug("create_ssh_transport - username: #{username}")
      Chef::Log.debug("======================================>")

      ##
      # Ssh Password
      ssh_pass = machine_ssh_options['password'] || false
      if ssh_pass
        ssh_pass_hash = Hash.new
        ssh_pass_hash = { 'password' => ssh_pass }
      else
        Chef::Log.info("NO PASSWORD")
      end

      ##
      # Ssh Key
      ssh_keys = []
      if machine_ssh_options['keys']
        if machine_ssh_options['keys'].kind_of?(Array)
          machine_ssh_options['keys'].each do |key|
            ssh_keys << key
          end
        elsif machine_ssh_options['keys'].kind_of?(String)
          ssh_keys << machine_ssh_options['keys']
        else
          ssh_keys = false
        end
      end

      if ssh_keys
        ssh_key_hash = Hash.new
        ssh_key_hash = { 'keys' => ssh_keys }
      end

      Chef::Log.info("======================================>")
      if ssh_pass
        Chef::Log.info("create_ssh_transport - ssh_pass: #{ssh_pass_hash.inspect}")
      elsif ssh_keys
        Chef::Log.info("create_ssh_transport - ssh_key: #{ssh_keys.inspect}")
      else
        Chef::Log.info("create_ssh_transport - no ssh_pass or ssh_key given")
      end
      Chef::Log.info("======================================>")

      raise "no ssh_pass or ssh_key given" unless ( ssh_pass || ssh_keys )

      machine_ssh_options = machine_ssh_options.merge!(ssh_pass_hash) if ssh_pass_hash
      machine_ssh_options = machine_ssh_options.merge!(ssh_key_hash) if ssh_key_hash

      ##
      # Valid Ssh Options
      valid_ssh_options = [
        :auth_methods, :bind_address, :compression, :compression_level, :config,
        :encryption, :forward_agent, :hmac, :host_key,
        :keepalive, :keepalive_interval, :kex, :keys, :key_data,
        :languages, :logger, :paranoid, :password, :port, :proxy,
        :rekey_blocks_limit,:rekey_limit, :rekey_packet_limit, :timeout, :verbose,
        :global_known_hosts_file, :user_known_hosts_file, :host_key_alias,
        :host_name, :user, :properties, :passphrase, :keys_only, :max_pkt_size,
        :max_win_size, :send_env, :use_agent
      ]

      ##
      # Ssh Options
      ssh_options = symbolize_keys(machine_ssh_options)

      # Validate Ssh Options
      ssh_options.each { |k,v| raise 'Invalid Shh Option' unless valid_ssh_options.include?(k) }

      Chef::Log.debug "======================================>"
      Chef::Log.debug "create_ssh_transport - ssh_options: #{ssh_options.inspect}"
      Chef::Log.debug "======================================>"

      # Now That We Validated Options, Lets Get Our Target
      @target_host = get_target_connection_method(machine_ssh_options)

      # Make Sure We Can Connect
      begin
        ssh = Net::SSH.start(@target_host, username, ssh_options)
        ssh.close
        Chef::Log.debug("======================================>")
        Chef::Log.debug("ABLE to Connect to #{@target_host} using #{username} and #{ssh_options.inspect}")
        Chef::Log.debug("======================================>")
      rescue
        Chef::Log.debug("======================================>")
        Chef::Log.debug("UNABLE to Connect to #{@target_host} using #{username} and #{ssh_options.inspect}")
        Chef::Log.debug("======================================>")
        raise "UNABLE to Connect to #{@target_host} using #{username} and #{ssh_options.inspect}"
      end

      ##
      # Ssh Additional Options
      options = {}

      #Enable pty by default
      options[:ssh_pty_enable] = true

      # If we not root use sudo
      if username != 'root'
        options[:prefix] = 'sudo '
      end

      Chef::Log.debug("======================================>")
      Chef::Log.debug("create_ssh_transport - options: #{options.inspect}")
      Chef::Log.debug("======================================>")

      ChefMetal::Transport::SSH.new(@target_host, username, ssh_options, options, config)

      # We Duped It So Now We Can Zero the Node Attr. So Not Saved On Server
      # provisioner_options['machine_options']['password'] =
      #   nil if provisioner_options['machine_options']['password']

      # provisioner_options['ssh_options']['password'] =
      #   nil if provisioner_options['ssh_options']['password']

    end
Setup Ssh