def wait_started(name, path=None, timeout=300):
 if (not exists(name, path=path)):
  raise CommandExecutionError('Container {0} does does exists'.format(name))
 if (not (state(name, path=path) == 'running')):
  raise CommandExecutionError('Container {0} is not running'.format(name))
 ret = False
 if running_systemd(name, path=path):
  test_started = test_sd_started_state
  logger = log.error
 else:
  test_started = test_bare_started_state
  logger = log.debug
 now = time.time()
 expire = (now + timeout)
 now = time.time()
 started = test_started(name, path=path)
 while ((time.time() < expire) and (not started)):
  time.sleep(0.3)
  started = test_started(name, path=path)
 if (started is None):
  logger('Assuming {0} is started, although we failed to detect that is fully started correctly'.format(name))
  ret = True
 else:
  ret = started
 return ret

def wait_started ( name , path = None , timeout = 300 ) : if ( not exists ( name , path = path ) ) : raise CommandExecutionError ( 'Container {0} does does exists' . format ( name ) ) if ( not ( state ( name , path = path ) == 'running' ) ) : raise CommandExecutionError ( 'Container {0} is not running' . format ( name ) ) ret = False if running_systemd ( name , path = path ) : test_started = test_sd_started_state logger = log . error else : test_started = test_bare_started_state logger = log . debug now = time . time ( ) expire = ( now + timeout ) now = time . time ( ) started = test_started ( name , path = path ) while ( ( time . time ( ) < expire ) and ( not started ) ) : time . sleep ( 0.3 ) started = test_started ( name , path = path ) if ( started is None ) : logger ( 'Assuming {0} is started, although we failed to detect that is fully started correctly' . format ( name ) ) ret = True else : ret = started return ret
check that the system has fully inited this is actually very important for systemd based containers see URL path path to the container parent default: /var/lib/lxc .