Exemplo n.º 1
0
def runSoftwareWithLock(config, lock=False):
  """
    Use Slapgrid to compile current Software Release and wait until
    compilation is done
  """
  if sup_process.isRunning(config, 'slapgrid-sr'):
    return 1

  if not os.path.exists(config['software_root']):
    os.mkdir(config['software_root'])
  stopProxy(config)
  startProxy(config)
  # XXX Hackish and unreliable
  if os.path.exists(config['software_log']):
    os.remove(config['software_log'])
  if not updateProxy(config):
    return 1
  try:
    sup_process.runProcess(config, "slapgrid-sr")
    if lock:
      sup_process.waitForProcessEnd(config, "slapgrid-sr")
    #Saves the current compile software for re-use
    config_SR_folder(config)
    return sup_process.returnCode(config, "slapgrid-sr")
  except xmlrpclib.Fault:
    return 1
Exemplo n.º 2
0
def runInstanceWithLock(config, lock=False):
  """
    Use Slapgrid to deploy current Software Release and wait until
    deployment is done.
  """
  if sup_process.isRunning(config, 'slapgrid-cp'):
    return 1

  startProxy(config)
  # XXX Hackish and unreliable
  if os.path.exists(config['instance_log']):
    os.remove(config['instance_log'])
  if not (updateProxy(config) and requestInstance(config)):
    return 1
  try:
    sup_process.runProcess(config, "slapgrid-cp")
    if lock:
      sup_process.waitForProcessEnd(config, "slapgrid-cp")
    return sup_process.returnCode(config, "slapgrid-cp")
  except xmlrpclib.Fault:
    return 1