From ba1303d98445ef439e93fa30d72ec6cf62fef986 Mon Sep 17 00:00:00 2001 From: Gabriel Cocenza Date: Wed, 16 Aug 2023 10:58:24 -0300 Subject: [PATCH] Add application version on HA Cluster charm Closes-Bug: #2031438 Change-Id: I4dab721ebe42d4c43c09a98204ce8113892aa817 (cherry picked from commit aa557b85b7b391d9651b34d638542f3e1e302d96) --- hooks/utils.py | 6 ++++++ test-requirements.txt | 2 ++ 2 files changed, 8 insertions(+) diff --git a/hooks/utils.py b/hooks/utils.py index 508815a..2d043dc 100644 --- a/hooks/utils.py +++ b/hooks/utils.py @@ -33,6 +33,7 @@ from charmhelpers.core.strutils import ( bool_from_string, ) from charmhelpers.core.hookenv import ( + application_version_set, local_unit, log, TRACE, @@ -77,6 +78,7 @@ from charmhelpers.fetch import ( apt_install, add_source, apt_update, + get_upstream_version, ) from charmhelpers.contrib.hahelpers.cluster import ( peer_ips, @@ -114,6 +116,8 @@ SYSTEMD_OVERRIDES_FILE = '{}/overrides.conf' MAAS_DNS_CONF_DIR = '/etc/maas_dns' STONITH_CONFIGURED = 'stonith-configured' +VERSION_PACKAGE = "pacemaker" + class MAASConfigIncomplete(Exception): pass @@ -1374,6 +1378,8 @@ def assess_status_helper(): return ("blocked", "Resource: {} not running".format(resource)) + application_version_set(get_upstream_version(VERSION_PACKAGE)) + return status, message diff --git a/test-requirements.txt b/test-requirements.txt index 227ba85..6e428a2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -19,6 +19,8 @@ mock>=1.2,<4.0.0; python_version < '3.6' mock>=1.2; python_version >= '3.6' stestr>=2.2.0 +# stestr requires voluptuous which dropped support for python 3.6 +voluptuous<=0.14.0 # Dependency of stestr. Workaround for # https://github.com/mtreinish/stestr/issues/145