canonical / jhack

Chock-full of Juju hackery.
Apache License 2.0
48 stars 23 forks source link

Can't get relation databag in a CMR #88

Closed gboutry closed 12 months ago

gboutry commented 1 year ago

I'm trying to get the content of a CMR relationship with jhack, and can't seem to be able to: When I try to, I get this error, which seems quite clear to me:

jhack show-relation cinder-ceph:ceph microceph:ceph
RuntimeError: No relation found with endpoints 'cinder-ceph:ceph' -> 'microceph:ceph' in model '<the current model>'. 'cinder-ceph' not found in model '<the current model>'; 
are you trying to show a CMR? If so, you need to 
pass `-m <the model where 'cinder-ceph' lives>`

But then:

jhack show-relation -m openstack cinder-ceph:ceph microceph:ceph
KeyError: 'microceph'

Looks like jhack is trying to get the status of microceph in the current model

│ ╭────────────── locals ───────────────╮                                                          │
│ │       endpoint = 'microceph:ceph'   │                                                          │
│ │          model = 'openstack'        │                                                          │
│ │ other_endpoint = 'cinder-ceph:ceph' │                                                          │
│ ╰─────────────────────────────────────╯                                                          │
│                                                                                                  │
│ /snap/jhack/225/lib/python3.8/site-packages/jhack/utils/show_relation.py:260 in                  │
│ get_metadata_from_status                                                                         │
│                                                                                                  │
│    257 ):                                                                                        │
│    258 │   status = _juju_status(model=model, json=True)                                         │
│    259 │   # machine status json output apparently has no 'scale'... -_-                         │
│ ❱  260 │   app_status = status["applications"][endpoint.app_name]

Versions:

juju                  3.2.0          23190  3.2/stable          canonical✓  -
jhack                 0.3.18.3       225    latest/edge         ppasotti    -