def _call_helper()

in dnf/artifact-registry.py [0:0]


  def _call_helper(self, service_account_json=None, service_account_email=None,
                   debug=False):
    args = []
    # JSON has priority over email.
    if service_account_json:
      args.append('--service_account_json=' + service_account_json)
    elif service_account_email:
      args.append('--service_account_email=' + service_account_email)

    if debug:
      # Inherit stderr to see debug statements
      stderr = None
    else:
      stderr = DEVNULL

    try:
      cmd_result = run([token_cmd] + args,
                       check=True, stdout=PIPE, stderr=stderr)
    except CalledProcessError as e:
      self.error = True
      print('Error trying to obtain Google credentials:', e)
      return

    return cmd_result.stdout.decode('utf-8')