Created
May 7, 2013 11:13
-
-
Save tomellis/5531894 to your computer and use it in GitHub Desktop.
Get IP out of Rackspace cloud
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 | |
import os | |
import sys | |
import logging | |
import pyrax | |
import pyrax.exceptions as exc | |
import exceptions | |
# Set loglevel | |
logging.basicConfig(level=logging.DEBUG) | |
# Authenticate to London Rackspace Cloud | |
conf = os.path.expanduser("creds") | |
pyrax.set_credential_file(conf, "LON") | |
# Set pointers to cloud services | |
cs = pyrax.cloudservers | |
def get_public_addr(): | |
servers = cs.servers.list() | |
for server in servers: | |
print "Name: %s\n ID: %s\n Public IP: %s\n" % (server.name, server.id, server.accessIPv4) | |
get_public_addr() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment