Created
April 22, 2014 18:16
-
-
Save hatchetation/11189097 to your computer and use it in GitHub Desktop.
A minimal example of using pyrax to get an interactive shell for interacting with Rackspace openstack servers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from os import environ | |
from IPython import embed | |
import pyrax | |
if environ['OS_PASSWORD'] and environ['OS_USERNAME']: | |
pyrax.set_environment(environ['OS_USERNAME']) | |
pyrax.set_credentials(environ['OS_USERNAME'], environ['OS_PASSWORD']) | |
cs = pyrax.cloudservers | |
servers = cs.list() | |
if __name__ == '__main__': | |
print "Pyrax client is available in `cs`, servers in `servers`." | |
embed() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment