Skip to content

Instantly share code, notes, and snippets.

@dpetzel dpetzel/gist:5885644
Last active Dec 19, 2015

Embed
What would you like to do?
153: def ssh(ssh_args, cmd)
=> 154: binding.pry
155: env = "env"
156: if config[:http_proxy]
157: env << " http_proxy=#{config[:http_proxy]}"
158: end
159: if config[:https_proxy]
160: env << " https_proxy=#{config[:https_proxy]}"
161: end
162: if env != "env"
163: cmd = "#{env} #{cmd}"
164: end
165:
166: debug("[SSH] #{ssh_args[1]}@#{ssh_args[0]} (#{cmd})")
167: Net::SSH.start(*ssh_args) do |ssh|
168: exit_code = ssh_exec_with_exit!(ssh, cmd)
169:
170: if exit_code != 0
171: shorter_cmd = cmd.squeeze(" ").strip
172: raise ActionFailed,
173: "SSH exited (#{exit_code}) for command: [#{shorter_cmd}]"
174: end
175: end
176: rescue Net::SSH::Exception => ex
177: raise ActionFailed, ex.message
178: end
[1] pry(#<Kitchen::Driver::Vagrant>)> config
=> {:box=>"box_name",
:provider=>"myprovider",
:kitchen_root=>"C:/my/root",
:sudo=>true,
:port=>22,
:customize=>{:memory=>"256"},
:synced_folders=>{}}
@dpetzel

This comment has been minimized.

Copy link
Owner Author

commented Jun 28, 2013

.kitchen.yml has:

driver_plugin: vagrant
require_chef_omnibus: "10.26.0"
sudo: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.