def _get_auth()

in gce_rescue/tasks/validations/authentication.py [0:0]


def _get_auth():
  global PROJECT
  try:
    credentials, adc_project = google.auth.default()
    if not adc_project and not PROJECT:
      msg = _info_no_project()
      print(msg, file=sys.stderr)
      sys.exit(1)
    if not PROJECT and adc_project:
      PROJECT = adc_project
    return credentials
  except google.auth.exceptions.DefaultCredentialsError:
    msg = _info_auth_cred()
    print(msg, file=sys.stderr)
    sys.exit(1)