Commit Graph

9 Commits

Author SHA1 Message Date
Hervé Beraud d746757302 Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Note that https://github.com/openstack/charms.openstack is used during tests
and he need `mock`, unfortunatelly it doesn't declare `mock` in its
requirements so it retrieve mock from other charm project (cross dependency).
So we depend on charms.openstack first and when
Ib1ed5b598a52375e29e247db9ab4786df5b6d142 will be merged then CI
will pass without errors.

Depends-On: Ib1ed5b598a52375e29e247db9ab4786df5b6d142
Change-Id: If1ef6178116ed8f1ce8f0244d72246292cdf52e9
2021-12-15 10:07:32 +00:00
Billy Olsen 1bb6e20b34 Handle AddrFormatError when CIDR can't be found
The network space for the cluster space or the public space may have
addresses in a different subnet than the one that is currently assigned
to the unit. In this case, the attempt to look up the netmask results in
a value of None, which in turn causes charmhelpers to raise an
AddrFormatError when attempting to determine the CIDR.

Handle this case within the interface and return None for the respective
CIDR. This may cause some issues where the public or cluster CIDRs are
not resolvable, however the charm interface already expects to provide
None if the CIDR cannot be determined.

A better, however more invasive, change would be to change out the calls
in the ceph-mon charm to use the network_get calls rather than
network_get_primary_address. Per the documentation for the network
primitives, it appears that the cidr can still be empty and is likely to
still lead to the inability to resolve the CIDR locally.

This change will primarily focus on handling the inability to resolve a
CIDR locally, postponing the network_get transformation this late in the
cycle.

Closes-Bug: #1898299
Change-Id: If1538eb645577653cada770211fd445b76284fd3
2021-04-01 11:10:53 -07:00
Frode Nordahl 61c94148d9
Add support for handling of forwarded broker requests
Change-Id: I0d4ed457e1d59eabed3340f5dc7d8353d5d66f04
2020-11-06 10:11:09 +01:00
Frode Nordahl 2677eb3a2f Add ``public_network`` and ``cluster_network`` properties
Change-Id: Ia49f4921e772376763be178e11d7777676ccc8da
2019-03-06 15:24:45 +01:00
Frode Nordahl e7fb14440e Add ``refresh_pools``
Change-Id: I97bfb9a2c0e30998566aee56d4630af6baa36d45
2019-03-06 15:24:11 +01:00
Frode Nordahl 65415824d0
Avoid duplicate ``create-pool`` requests for same pool
Change-Id: I801843f81d5fbe9838142b8fba96d93bbdfc91e4
2019-03-06 15:20:37 +01:00
Frode Nordahl bced80a856
Fix ``mon_hosts`` unit test 2019-02-26 12:23:02 +01:00
Frode Nordahl b54d497d91 Add pool creation, fix individual key naming
Adds a pool creation function that works with Endpoint based interfaces.
2019-02-25 13:46:00 +03:00
Frode Nordahl d515ede351
Add ``ceph-rbd-mirror`` interface 2019-02-06 09:58:45 +01:00