def get_existing_firestore()

in solutions_builder/copier_extensions/sb_helpers.py [0:0]


def get_existing_firestore(project_id):
  """
    Get boolean whether to initialize Firestore.
    """
  print_indent(f"(Retrieving Firestore databases list...)")
  command = f"gcloud alpha firestore databases list --format='value(databases[0].name)' --project='{project_id}' --quiet"

  try:
    database_name = exec_gcloud_output(command)
    return database_name

  except subprocess.CalledProcessError as e:
    print_indent(
      f"Unable to retrieve default Firestore database name for '{project_id}'. GCP project '{project_id}' may not exist on GCP yet.\n")
    return ""