Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPU blows up on relation broken (ops 2.10) #301

Closed
PietroPasotti opened this issue Mar 1, 2024 · 0 comments · Fixed by #302
Closed

IPU blows up on relation broken (ops 2.10) #301

PietroPasotti opened this issue Mar 1, 2024 · 0 comments · Fixed by #302

Comments

@PietroPasotti
Copy link
Collaborator

Bug Description

on destroying an ingress-per-unit-relation, the charm errors out because self.relation is None in IPU lib wrapper.

To Reproduce

juju deploy cos-lite --trust
juju remove-application traefik

Environment

                juju info v0.1                    
──────────────┬────────────────────────────────┐  
 jhack        │ 0.3.32                         │  
 python       │ 3.10.12 (/bin/python3)         │  
 juju-* snaps │                                │  
juju agent version   |  3.1.6   |
 microk8s     │ MicroK8s v1.29.2 revision 6591 │  
 lxd          │ 5.20                           │  
 multipass    │ 1.13.1                         │  
 multipassd   │ 1.13.1                         │  
 os           │ Ubuntu 22.04.4 LTS             │  
 kernel       │ Linux 6.5.0-21-generic x86_64  │  
──────────────┴────────────────────────────────┘  

Relevant log output

unit-prometheus-0: 13:31:02 ERROR unit.prometheus/0.juju-log ingress:7: Uncaught exception while in charm code:                              
Traceback (most recent call last):                                                                                                           
  File "./src/charm.py", line 1074, in <module>                                                                                              
    main(PrometheusCharm)                                                                                                                    
  File "/var/lib/juju/agents/unit-prometheus-0/charm/venv/ops/main.py", line 456, in main                                                    
    _emit_charm_event(charm, dispatcher.event_name)                                                                                          
  File "/var/lib/juju/agents/unit-prometheus-0/charm/venv/ops/main.py", line 144, in _emit_charm_event                                       
    event_to_emit.emit(*args, **kwargs)                                                                                                      
  File "/var/lib/juju/agents/unit-prometheus-0/charm/venv/ops/framework.py", line 352, in emit                                               
    framework._emit(event)                                                                                                                   
  File "/var/lib/juju/agents/unit-prometheus-0/charm/venv/ops/framework.py", line 865, in _emit                                              
    self._reemit(event_path)                                                                                                                 
  File "/var/lib/juju/agents/unit-prometheus-0/charm/venv/ops/framework.py", line 955, in _reemit                                            
    custom_handler(event)                                                                                                                    
  File "/var/lib/juju/agents/unit-prometheus-0/charm/lib/charms/traefik_k8s/v1/ingress_per_unit.py", line 753, in _handle_relation           
    self.on.revoked_for_unit.emit(self.relation)  # type: ignore                                                                             
  File "/var/lib/juju/agents/unit-prometheus-0/charm/venv/ops/framework.py", line 352, in emit                                               
    framework._emit(event)                                                                                                                   
  File "/var/lib/juju/agents/unit-prometheus-0/charm/venv/ops/framework.py", line 860, in _emit                                              
    self.save_snapshot(event)                                                                                                                
  File "/var/lib/juju/agents/unit-prometheus-0/charm/venv/ops/framework.py", line 729, in save_snapshot                                      
    data = value.snapshot()                                                                                                                  
  File "/var/lib/juju/agents/unit-prometheus-0/charm/venv/ops/charm.py", line 471, in snapshot                                               
    'relation_name': self.relation.name,                                                                                                     
AttributeError: 'NoneType' object has no attribute 'name'

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant