8 Commits

Author SHA1 Message Date
Guillaume Boutry
8c674de50e
[ops-sunbeam] Implement mypy linter
Implement mypy in the most non-breaking way possible. There's still some
changes of behavior that crept in, merely due to incorrect edge case
handling.

Charm libraries are generally well typed, include py.typed marker for
all of the libraries, to allow mypy analyzing their usage.

Change-Id: I7bda1913fa08dd4954a606526272ac80b45197cc
Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
2024-08-13 18:56:33 +02:00
Samuel Allan
539f36817f
[tempest-k8s] Fix error on remove-application
Previously on application remove,
tempest-k8s charm would error at the relation-broken hook,
causing the removal to fail:

```
tempest/0*                   error        idle       10.1.169.40         hook failed: "identity-ops-relation-broken"
```

with traceback:

```
  File "/var/lib/juju/agents/unit-tempest-0/charm/src/handlers.py", line 609, in _on_provider_goneaway
    self.charm.set_tempest_ready(False)
  File "/var/lib/juju/agents/unit-tempest-0/charm/./src/charm.py", line 283, in set_tempest_ready
    self.peers.set_unit_data({TEMPEST_READY_KEY: "true" if ready else ""})
  File "/var/lib/juju/agents/unit-tempest-0/charm/lib/ops_sunbeam/relation_handlers.py", line 625, in set_unit_data
    self.interface.set_unit_data(settings)
  File "/var/lib/juju/agents/unit-tempest-0/charm/lib/ops_sunbeam/interfaces.py", line 150, in set_unit_data
    self.peers_rel.data[self.model.unit][k] = v
AttributeError: 'NoneType' object has no attribute 'data'
```

This fixes the issue for tempest (and potentially if similar issues
are present on other sunbeam charms),
by checking if peels_rel exists because trying to interact with it.

Change-Id: I5e01c1dba719a63160f0452282d57b9eae14b41b
2024-05-15 14:32:46 +02:00
Liam Young
9d918cdae1 Add include_local_unit option to get_all_unit_values
Currently `get_all_unit_values` will return the values set by
remote units. The new `include_local_unit` option will add the
value that the local unit has set to the list.

Change-Id: I9c75535c7b71af7585bbb31dda86035f5216c08e
2023-02-17 07:31:43 +00:00
James Page
b6a52354c5 peer interface: filter None values
If a remote unit has not provided a value for a given key don't
append to the values list - this results in Python None being
added to the list which causes issues in consuming templates
and code.

Change-Id: If5985105714566cddf5bba9fe639097b1c44c1dc
2022-12-12 12:02:23 +00:00
Liam Young
004e885760 Add linters and formatting
Change-Id: Ib16bd1fac4b9dfc21b98c9ba1201305733d2598b
2022-11-03 12:26:01 +00:00
Samuel Walladge
c0a56f4928 Fix return types hints on get_app_data methods
Change-Id: I696ec38f2bba9963150a0450efefe24d37795e6f
2022-09-23 11:39:11 +09:30
Hemanth Nakkina
a43f830495 cleanup on migration to opendev
Remove references to old repo
Add .gitreview
Add .zuul.yaml

Change-Id: I66f0effc29d68564c01aaa0018786c9e04153552
2022-08-04 13:28:10 +05:30
Hemanth Nakkina
1866f094fb rename package names and code cleanup
Following changes are done as part of this patch
* Rename package name to ops_sunbeam
* Rename shared_code/aso_charm to shared_code/sunbeam_charm
* Modify rest of scripts as per above changes
* Code cleanup
2022-07-18 10:02:40 +05:30