Ejemplo n.º 1
0
def deploy_apps(app_paths):
    """ Deploys all apps that reside in /opt/appscale/apps.

  Args:
    app_paths: A list of the full paths of the apps to be deployed.
  Returns:
    True on success, False otherwise.
  """
    secret = appscale_info.get_secret()
    acc = AppControllerClient(appscale_info.get_headnode_ip(), secret)

    # Wait for Cassandra to come up after a restore.
    time.sleep(15)

    for app_path in app_paths:
        # Extract app ID.
        app_id = app_path[app_path.rfind('/') + 1:app_path.find('.')]
        if not app_id:
            logging.error(
                "Malformed source code archive. Cannot complete "
                "application recovery for '{}'. Aborting...".format(app_path))
            return False

        file_suffix = re.search("\.(.*)\Z", app_path).group(1)

        logging.warning("Restoring app '{}', from '{}'".format(
            app_id, app_path))

        acc.upload_app(app_path, file_suffix)

    return True
Ejemplo n.º 2
0
def deploy_apps(app_paths):
    """ Deploys all apps that reside in /opt/appscale/apps.

  Args:
    app_paths: A list of the full paths of the apps to be deployed.
  Returns:
    True on success, False otherwise.
  """
    uaserver = SOAPpy.SOAPProxy('https://{0}:{1}'.format(
        appscale_info.get_db_master_ip(), UA_SERVER_PORT))

    acc = AppControllerClient(appscale_info.get_login_ip(),
                              appscale_info.get_secret())

    # Wait for Cassandra to come up after a restore.
    time.sleep(15)

    for app_path in app_paths:
        # Extract app ID.
        app_id = app_path[app_path.rfind('/') + 1:app_path.find('.')]
        if not app_id:
            logging.error(
                "Malformed source code archive. Cannot complete "
                "application recovery for '{}'. Aborting...".format(app_path))
            return False

        # Retrieve app admin via uaserver.
        app_data = uaserver.get_app_data(app_id, appscale_info.get_secret())

        app_admin_re = re.search("\napp_owner:(.+)\n", app_data)
        if app_admin_re:
            app_admin = app_admin_re.group(1)
        else:
            logging.error(
                "Missing application data. Cannot complete application "
                "recovery for '{}'. Aborting...".format(app_id))
            return False

        file_suffix = re.search("\.(.*)\Z", app_path).group(1)

        logging.warning(
            "Restoring app '{}', from '{}', with owner '{}'.".format(
                app_id, app_path, app_admin))

        acc.upload_app(app_path, file_suffix, app_admin)

    return True
Ejemplo n.º 3
0
def get_appcontroller_client():
    """ Returns an AppControllerClient instance for this deployment. """
    head_node_ip_file = '/etc/appscale/head_node_ip'
    head_node = read_file_contents(head_node_ip_file).rstrip('\n')

    secret_file = '/etc/appscale/secret.key'
    secret = read_file_contents(secret_file)

    return AppControllerClient(head_node, secret)
Ejemplo n.º 4
0
def deploy_apps(app_paths):
  """ Deploys all apps that reside in /opt/appscale/apps.

  Args:
    app_paths: A list of the full paths of the apps to be deployed.
  Returns:
    True on success, False otherwise.
  """
  uaserver = SOAPpy.SOAPProxy('https://{0}:{1}'.format(
    appscale_info.get_db_master_ip(), UA_SERVER_PORT))

  acc = AppControllerClient(appscale_info.get_login_ip(),
    appscale_info.get_secret())

  # Wait for Cassandra to come up after a restore.
  time.sleep(15)

  for app_path in app_paths:
    # Extract app ID.
    app_id = app_path[app_path.rfind('/')+1:app_path.find('.')]
    if not app_id:
      logging.error("Malformed source code archive. Cannot complete "
        "application recovery for '{}'. Aborting...".format(app_path))
      return False

    # Retrieve app admin via uaserver.
    app_data = uaserver.get_app_data(app_id, appscale_info.get_secret())

    app_admin_re = re.search("\napp_owner:(.+)\n", app_data)
    if app_admin_re:
      app_admin = app_admin_re.group(1)
    else:
      logging.error("Missing application data. Cannot complete application "
        "recovery for '{}'. Aborting...".format(app_id))
      return False

    file_suffix = re.search("\.(.*)\Z", app_path).group(1)

    logging.warning("Restoring app '{}', from '{}', with owner '{}'.".
      format(app_id, app_path, app_admin))

    acc.upload_app(app_path, file_suffix, app_admin)

  return True
Ejemplo n.º 5
0
def get_appcontroller_client():
    """ Returns an AppControllerClient instance for this deployment. """
    raw_ips = file_io.read('/etc/appscale/load_balancer_ips')
    ips = raw_ips.split('\n')
    head_node = ips[0]

    secret_file = '/etc/appscale/secret.key'
    secret = read_file_contents(secret_file)

    return AppControllerClient(head_node, secret)
  def get_appcontroller_client(self):
    """ Retrieves our saved AppController connection, creating a new one if none
    currently exist.

    Returns:
      An AppControllerClient, representing a connection to the AppController.
    """
    if self.appcontroller is None:
      self.appcontroller = AppControllerClient(MY_PUBLIC_IP, GLOBAL_SECRET_KEY)
    return self.appcontroller
Ejemplo n.º 7
0
  def get_appcontroller_client(self, server_ip=MY_PUBLIC_IP):
    """ Retrieves our saved AppController connection, creating a new one if none
    currently exist.

    Args:
      server_ip: An IP address specifying which machine to make AppController
        calls to.
    Returns:
      An AppControllerClient, representing a connection to the AppController.
    """
    if self.appcontroller is None:
      self.appcontroller = AppControllerClient(server_ip, GLOBAL_SECRET_KEY)
    return self.appcontroller