<s> from __future__ import print_function <EOL> import os <EOL> import six <EOL> import sys <EOL> import pyrax <EOL> pyrax . set_setting ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> creds_file = os . path . expanduser ( "<STR_LIT>" ) <EOL> pyrax . set_credential_file ( creds_file ) <EOL> cdb = pyrax . cloud_databases <EOL> instances = cdb . list ( ) <EOL> if not instances : <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" ) <EOL> sys . exit ( ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> for pos , inst in enumerate ( instances ) : <EOL> print ( "<STR_LIT>" % ( pos , inst . name , <EOL> inst . flavor . name , inst . flavor . ram , inst . volume . size , inst . status ) ) <EOL> try : <EOL> sel = int ( six . moves . input ( <EOL> "<STR_LIT>" <EOL> ) ) <EOL> except ValueError : <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( ) <EOL> sys . exit ( ) <EOL> try : <EOL> inst = instances [ sel ] <EOL> except IndexError : <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( ) <EOL> sys . exit ( ) <EOL> prompt = "<STR_LIT>" <EOL> nm = six . moves . input ( prompt ) <EOL> db = inst . create_database ( nm ) <EOL> dbs = inst . list_databases ( ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" % nm ) <EOL> print ( "<STR_LIT>" % inst . name ) <EOL> for db in dbs : <EOL> print ( db . name ) <EOL> print ( ) </s>
