|
|
@ -66,8 +66,8 @@ authors:
|
|
|
|
- Jesse Keating <jesse.keating@rackspace.com>
|
|
|
|
- Jesse Keating <jesse.keating@rackspace.com>
|
|
|
|
- Paul Durivage <paul.durivage@rackspace.com>
|
|
|
|
- Paul Durivage <paul.durivage@rackspace.com>
|
|
|
|
notes:
|
|
|
|
notes:
|
|
|
|
- One environment variable needs to be set: RAX_CREDS_FILE.
|
|
|
|
- RAX_CREDS_FILE is an optional environment variable that points to a pyrax-compatible credentials file.
|
|
|
|
- RAX_CREDS_FILE points to a credentials file appropriate for pyrax.
|
|
|
|
- If RAX_CREDS_FILE is not supplied, rax.py will look for a credentials file at ~/.rackspace_cloud_credentials.
|
|
|
|
- See https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#authenticating
|
|
|
|
- See https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#authenticating
|
|
|
|
- RAX_REGION is an optional environment variable to narrow inventory search scope
|
|
|
|
- RAX_REGION is an optional environment variable to narrow inventory search scope
|
|
|
|
- RAX_REGION, if used, needs a value like ORD, DFW, SYD (a Rackspace datacenter) and optionally accepts a comma-separated list
|
|
|
|
- RAX_REGION, if used, needs a value like ORD, DFW, SYD (a Rackspace datacenter) and optionally accepts a comma-separated list
|
|
|
@ -181,14 +181,22 @@ def parse_args():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def setup():
|
|
|
|
def setup():
|
|
|
|
|
|
|
|
default_creds_file = os.path.expanduser('~/.rackspace_cloud_credentials')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Attempt to grab credentials from environment first
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
creds_file = os.environ['RAX_CREDS_FILE']
|
|
|
|
creds_file = os.environ['RAX_CREDS_FILE']
|
|
|
|
region = os.getenv('RAX_REGION')
|
|
|
|
|
|
|
|
except KeyError, e:
|
|
|
|
except KeyError, e:
|
|
|
|
sys.stderr.write('Unable to load environment '
|
|
|
|
# But if that fails, use the default location of ~/.rackspace_cloud_credentials
|
|
|
|
'variable %s\n' % e.message)
|
|
|
|
if os.path.isfile(default_creds_file):
|
|
|
|
|
|
|
|
creds_file = default_creds_file
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
sys.stderr.write('No value in environment variable %s and/or no '
|
|
|
|
|
|
|
|
'credentials file at %s\n'
|
|
|
|
|
|
|
|
% (e.message, default_creds_file))
|
|
|
|
sys.exit(1)
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
region = os.getenv('RAX_REGION')
|
|
|
|
pyrax.set_setting('identity_type', 'rackspace')
|
|
|
|
pyrax.set_setting('identity_type', 'rackspace')
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|