def up(self):
    """ Starts an AppScale deployment with the configuration options from the
    AppScalefile in the current directory.

    Raises:
      AppScalefileException: If there is no AppScalefile in the current
      directory.
    """
    contents = self.read_appscalefile()

    # If running in a cluster environment, we first need to set up SSH keys
    contents_as_yaml = yaml.safe_load(contents)
    if not LocalState.ensure_appscalefile_is_up_to_date():
      contents = self.read_appscalefile()
      contents_as_yaml = yaml.safe_load(contents)

    if "ips_layout" in contents_as_yaml:
      ips_layout = base64.b64encode(yaml.dump(contents_as_yaml["ips_layout"]))

    if "disks" in contents_as_yaml:
      disks = base64.b64encode(yaml.dump(contents_as_yaml["disks"]))

    if "user_commands" in contents_as_yaml:
      user_commands = base64.b64encode(yaml.dump(
        contents_as_yaml["user_commands"]))

    if not "infrastructure" in contents_as_yaml:
      # Only run add-keypair if there is no ssh key present,
      # or if it doesn't log into all the machines specified.
      if not self.valid_ssh_key(contents_as_yaml):
        add_keypair_command = []
        if "keyname" in contents_as_yaml:
          add_keypair_command.append("--keyname")
          add_keypair_command.append(str(contents_as_yaml["keyname"]))

        add_keypair_command.append("--ips_layout")
        add_keypair_command.append(ips_layout)
        options = ParseArgs(add_keypair_command, "appscale-add-keypair").args
        AppScaleTools.add_keypair(options)

    # Construct a run-instances command from the file's contents
    command = []
    for key, value in contents_as_yaml.items():
      if key in ["EC2_ACCESS_KEY", "EC2_SECRET_KEY", "EC2_URL"]:
        os.environ[key] = value
        continue

      if value is True:
        command.append(str("--%s" % key))
      elif value is False:
        pass
      else:
        if key == "ips_layout":
          command.append("--ips_layout")
          command.append(ips_layout)
        elif key == "disks":
          command.append("--disks")
          command.append(disks)
        elif key == "user_commands":
          command.append("--user_commands")
          command.append(user_commands)
        else:
          command.append(str("--%s" % key))
          command.append(str("%s" % value))

    # Finally, call AppScaleTools.run_instances
    options = ParseArgs(command, "appscale-run-instances").args
    AppScaleTools.run_instances(options)
dataset/ETHPy150Open AppScale/appscale-tools/lib/appscale.py/AppScale.up/original