GCP integrator charm doesn't support oauth2 credential type

Bug #2016215 reported by Harry Pidcock
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Google Cloud Platform Integrator Charm
Triaged
Medium
Unassigned

Bug Description

When using the GCP integrator charm with "oauth2" creds we get the following error

unit-gcp-integrator-0: 05:09:32 ERROR unit.gcp-integrator/0.juju-log Hook error:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-gcp-integrator-0/.venv/lib/python3.10/site-packages/charms/reactive/__init__.py", line 74, in main
    bus.dispatch(restricted=restricted_mode)
  File "/var/lib/juju/agents/unit-gcp-integrator-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 390, in dispatch
    _invoke(other_handlers)
  File "/var/lib/juju/agents/unit-gcp-integrator-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 359, in _invoke
    handler.invoke()
  File "/var/lib/juju/agents/unit-gcp-integrator-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 181, in invoke
    self._action(*args)
  File "/var/lib/juju/agents/unit-gcp-integrator-0/charm/reactive/gcp.py", line 40, in get_creds
    toggle_flag("charm.gcp.creds.set", layer.gcp.get_credentials())
  File "/var/lib/juju/agents/unit-gcp-integrator-0/charm/lib/charms/layer/gcp.py", line 55, in get_credentials
    creds_data = creds["credential"]["attributes"]["file"]
KeyError: 'file'

$ juju-exec "credential-get"
type: gce
name: google
region: us-east1
endpoint: https://www.googleapis.com
identityendpoint: ""
storageendpoint: ""
credential:
  authtype: oauth2
  attributes:
    client-email: <email address hidden>
    client-id: 123456789-snip.apps.googleusercontent.com
    private-key: |
      -----BEGIN PRIVATE KEY-----
      MIIC...8=
      -----END PRIVATE KEY-----
    project-id: snippy-snip-1234
  redacted: []
cacertificates: []
skiptlsverify: false
iscontrollercloud: true

$ cat .local/share/juju/credentials.yaml
credentials:
  google:
    credentials:
      auth-type: oauth2
      project-id: snippy-snip-1234
      private-key: |
        -----BEGIN PRIVATE KEY-----
        MIIC...8=
        -----END PRIVATE KEY-----
      client-email: <email address hidden>
      client-id: 123456789-snip.apps.googleusercontent.com

Obviously there is no problem with jsonfile creds.

George Kraft (cynerva)
Changed in charm-gcp-integrator:
importance: Undecided → Medium
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.