Major improvement in OSM charms
- Adapt all new operator charms to use the same pattern. They are all
using now this library that encapsulates the common logic for all
charms: https://github.com/davigar15/ops-lib-charmed-osm. That will be
eventually moved to gitlab, when it has a PyPI repository available
- Add unit tests to all charms
- Modify installer and bundles to point to the new charms
- Improve the build.sh script for building the charms
Change-Id: I0896ceb082d1b6a76b3560c07482a4135a220a3f
Signed-off-by: David Garcia <david.garcia@canonical.com>
diff --git a/installers/charm/mon/src/pod_spec.py b/installers/charm/mon/src/pod_spec.py
index 1c50565..dcadfc0 100644
--- a/installers/charm/mon/src/pod_spec.py
+++ b/installers/charm/mon/src/pod_spec.py
@@ -36,15 +36,18 @@
relation_data (Dict[str, Any]): relation data.
"""
config_validators = {
- "openstack_default_granularity": lambda value, _: isinstance(value, int)
- and value > 0,
+ "openstack_default_granularity": lambda value, _: (
+ isinstance(value, int) and value > 0
+ ),
"global_request_timeout": lambda value, _: isinstance(value, int) and value > 0,
- "log_level": lambda value, _: isinstance(value, str)
- and value in ("INFO", "DEBUG"),
+ "log_level": lambda value, _: (
+ isinstance(value, str) and value in ("INFO", "DEBUG")
+ ),
"collector_interval": lambda value, _: isinstance(value, int) and value > 0,
"evaluator_interval": lambda value, _: isinstance(value, int) and value > 0,
- "database_commonkey": lambda value, _: isinstance(value, str)
- and len(value) > 0,
+ "database_commonkey": lambda value, _: (
+ isinstance(value, str) and len(value) > 0
+ ),
"vca_host": lambda value, _: isinstance(value, str) and len(value) > 0,
"vca_user": lambda value, _: isinstance(value, str) and len(value) > 0,
"vca_password": lambda value, _: isinstance(value, str) and len(value) > 0,
@@ -53,8 +56,9 @@
relation_validators = {
"message_host": lambda value, _: isinstance(value, str) and len(value) > 0,
"message_port": lambda value, _: isinstance(value, int) and value > 0,
- "database_uri": lambda value, _: isinstance(value, str)
- and value.startswith("mongodb://"),
+ "database_uri": lambda value, _: (
+ isinstance(value, str) and value.startswith("mongodb://")
+ ),
"prometheus_host": lambda value, _: isinstance(value, str) and len(value) > 0,
"prometheus_port": lambda value, _: isinstance(value, int) and value > 0,
}