def wait_for_snapshot_status(client, snapshot_id, status):
 body = client.show_snapshot(snapshot_id)['snapshot']
 snapshot_status = body['status']
 start = int(time.time())
 while (snapshot_status != status):
  time.sleep(client.build_interval)
  body = client.show_snapshot(snapshot_id)['snapshot']
  snapshot_status = body['status']
  if (snapshot_status == 'error'):
   raise exceptions.SnapshotBuildErrorException(snapshot_id=snapshot_id)
  if ((int(time.time()) - start) >= client.build_timeout):
   message = ('Snapshot %s failed to reach %s status (current %s) within the required time (%s s).' % (snapshot_id, status, snapshot_status, client.build_timeout))
   raise lib_exc.TimeoutException(message)

def wait_for_snapshot_status ( client , snapshot_id , status ) : body = client . show_snapshot ( snapshot_id ) [ 'snapshot' ] snapshot_status = body [ 'status' ] start = int ( time . time ( ) ) while ( snapshot_status != status ) : time . sleep ( client . build_interval ) body = client . show_snapshot ( snapshot_id ) [ 'snapshot' ] snapshot_status = body [ 'status' ] if ( snapshot_status == 'error' ) : raise exceptions . SnapshotBuildErrorException ( snapshot_id = snapshot_id ) if ( ( int ( time . time ( ) ) - start ) >= client . build_timeout ) : message = ( 'Snapshot %s failed to reach %s status (current %s) within the required time (%s s).' % ( snapshot_id , status , snapshot_status , client . build_timeout ) ) raise lib_exc . TimeoutException ( message )
waits for a snapshot to reach a given status .