Пример #1
0
def download_config_files(stage, debug=False):
  stage_file_path = shared.get_stage_file(stage.stage_name)
  service_account_file_path = shared.get_service_account_file(stage)
  command = "cloudshell download-files \
    \"{stage_file}\" \
    \"{service_account_file}\"".format(
      stage_file=stage_file_path,
      service_account_file=service_account_file_path)
  shared.execute_command("Download configuration files", command, debug=debug)
Пример #2
0
def create_service_account_key_if_needed(stage, debug=False):
  if shared.check_service_account_file(stage):
    click.echo("     Service account key already exists.")
    return

  service_account_file = shared.get_service_account_file(stage)
  gcloud_command = "$GOOGLE_CLOUD_SDK/bin/gcloud --quiet"
  command = "{gcloud_bin} iam service-accounts keys create \"{service_account_file}\" \
    --iam-account=\"{project_id}@appspot.gserviceaccount.com\" \
    --key-file-type='json' \
    --project={project_id}".format(
      gcloud_bin=gcloud_command,
      project_id=stage.project_id_gae,
      service_account_file=service_account_file)
  shared.execute_command("Create the service account key", command, debug=debug)