Skip to content

Instantly share code, notes, and snippets.

@kylog
Last active August 29, 2015 14:02
Show Gist options
  • Save kylog/d98dfc7e709c0878ac93 to your computer and use it in GitHub Desktop.
Save kylog/d98dfc7e709c0878ac93 to your computer and use it in GitHub Desktop.
vcloud one liners
listvm() { curl --url http://vcloud.delivery.puppetlabs.net/vm 2> /dev/null | ruby -e 'require "json"; JSON.parse(STDIN.read).each { |vm| puts vm }' }
getvm() { curl -d --url http://vcloud.delivery.puppetlabs.net/vm/$1 2> /dev/null | ruby -e 'require "json"; resp = JSON.parse(STDIN.read); puts resp["'$1'"]["hostname"]'}
sshvm() { ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa-acceptance root@$1 "${@:2}" }
rmvm() { curl -X DELETE --url http://vcloud.delivery.puppetlabs.net/vm/$1 }
@MikaelSmith
Copy link

vCloud API has changed so resp.keys[0] no longer works. You might try changing to
getvm() { curl -d --url http://vcloud.delivery.puppetlabs.net/vm/$1 2> /dev/null | ruby -e 'require "json"; resp = JSON.parse(STDIN.read); puts resp["'$1'"]["hostname"]'}

@kylog
Copy link
Author

kylog commented Sep 19, 2014

Thanks! Updated. Just ran into this myself.

@MikaelSmith
Copy link

I've also added
scpvm() { scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa-acceptance root@$1 $2 }
for when I need to copy files back from the VM. Use it as
scpvm hash:sourcepath target or scpvm qnox09vbsacexxf:~/logfile logfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment