<s> from __future__ import print_function <EOL> import os <EOL> import sys <EOL> import pyrax <EOL> import pyrax . exceptions as exc <EOL> pyrax . set_setting ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> creds_file = os . path . expanduser ( "<STR_LIT>" ) <EOL> pyrax . set_credential_file ( creds_file ) <EOL> cbs = pyrax . cloud_blockstorage <EOL> vol_name = pyrax . utils . random_ascii ( length = <NUM_LIT:8> ) <EOL> vol = cbs . create ( name = "<STR_LIT>" , size = <NUM_LIT> , volume_type = "<STR_LIT>" ) <EOL> snap = vol . create_snapshot ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" , vol ) <EOL> print ( "<STR_LIT>" , snap ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" ) <EOL> try : <EOL> pyrax . utils . wait_until ( snap , "<STR_LIT:status>" , "<STR_LIT>" , attempts = <NUM_LIT:0> , verbose = True ) <EOL> except KeyboardInterrupt : <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> snap . delete ( ) <EOL> try : <EOL> vol . delete ( ) <EOL> except exc . VolumeNotAvailable : <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) </s>
