def safe_to_snap(client, repository=None, retry_interval=120, retry_count=3):
 if (not repository):
  raise MissingArgument('No value for "repository" provided')
 for count in range(1, (retry_count + 1)):
  in_progress = snapshot_in_progress(client, repository=repository)
  if in_progress:
   logger.info('Snapshot already in progress: {0}'.format(in_progress))
   logger.info('Pausing {0} seconds before retrying...'.format(retry_interval))
   time.sleep(retry_interval)
   logger.info('Retry {0} of {1}'.format(count, retry_count))
  else:
   return True
 return False

def safe_to_snap ( client , repository = None , retry_interval = 120 , retry_count = 3 ) : if ( not repository ) : raise MissingArgument ( 'No value for "repository" provided' ) for count in range ( 1 , ( retry_count + 1 ) ) : in_progress = snapshot_in_progress ( client , repository = repository ) if in_progress : logger . info ( 'Snapshot already in progress: {0}' . format ( in_progress ) ) logger . info ( 'Pausing {0} seconds before retrying...' . format ( retry_interval ) ) time . sleep ( retry_interval ) logger . info ( 'Retry {0} of {1}' . format ( count , retry_count ) ) else : return True return False
ensure there are no snapshots in progress .