From cf1ffe68666a019c51ba3550dad2e3b02ce4718f Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Wed, 27 Sep 2023 16:52:58 -0300 Subject: [PATCH] Charm-helpers sync Func-Test-Pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/1139 Change-Id: Id06e0e004133a157c447af31f3cb308eefa722d1 --- charmhelpers/contrib/openstack/context.py | 8 ++++---- .../contrib/openstack/templates/wsgi-openstack-api.conf | 2 +- .../openstack/templates/wsgi-openstack-metadata.conf | 2 +- charmhelpers/contrib/storage/linux/ceph.py | 8 ++++++-- charmhelpers/core/unitdata.py | 3 ++- charmhelpers/fetch/snap.py | 2 +- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/charmhelpers/contrib/openstack/context.py b/charmhelpers/contrib/openstack/context.py index 24a13d0..42f1503 100644 --- a/charmhelpers/contrib/openstack/context.py +++ b/charmhelpers/contrib/openstack/context.py @@ -1748,9 +1748,9 @@ def __init__(self, name=None, script=None, admin_script=None, def __call__(self): total_processes = _calculate_workers() - enable_wsgi_rotation = config('wsgi-rotation') - if enable_wsgi_rotation is None: - enable_wsgi_rotation = True + enable_wsgi_socket_rotation = config('wsgi-socket-rotation') + if enable_wsgi_socket_rotation is None: + enable_wsgi_socket_rotation = True ctxt = { "service_name": self.service_name, "user": self.user, @@ -1764,7 +1764,7 @@ def __call__(self): "public_processes": int(math.ceil(self.public_process_weight * total_processes)), "threads": 1, - "wsgi_rotation": enable_wsgi_rotation, + "wsgi_socket_rotation": enable_wsgi_socket_rotation, } return ctxt diff --git a/charmhelpers/contrib/openstack/templates/wsgi-openstack-api.conf b/charmhelpers/contrib/openstack/templates/wsgi-openstack-api.conf index 2cb735e..de5f603 100644 --- a/charmhelpers/contrib/openstack/templates/wsgi-openstack-api.conf +++ b/charmhelpers/contrib/openstack/templates/wsgi-openstack-api.conf @@ -12,7 +12,7 @@ Listen {{ admin_port }} Listen {{ public_port }} {% endif -%} -{% if wsgi_rotation -%} +{% if wsgi_socket_rotation -%} WSGISocketRotation On {% else -%} WSGISocketRotation Off diff --git a/charmhelpers/contrib/openstack/templates/wsgi-openstack-metadata.conf b/charmhelpers/contrib/openstack/templates/wsgi-openstack-metadata.conf index 2cb735e..de5f603 100644 --- a/charmhelpers/contrib/openstack/templates/wsgi-openstack-metadata.conf +++ b/charmhelpers/contrib/openstack/templates/wsgi-openstack-metadata.conf @@ -12,7 +12,7 @@ Listen {{ admin_port }} Listen {{ public_port }} {% endif -%} -{% if wsgi_rotation -%} +{% if wsgi_socket_rotation -%} WSGISocketRotation On {% else -%} WSGISocketRotation Off diff --git a/charmhelpers/contrib/storage/linux/ceph.py b/charmhelpers/contrib/storage/linux/ceph.py index 2e1fc1b..6ec67cb 100644 --- a/charmhelpers/contrib/storage/linux/ceph.py +++ b/charmhelpers/contrib/storage/linux/ceph.py @@ -158,15 +158,19 @@ def get_osd_settings(relation_name): return _order_dict_by_key(osd_settings) -def send_application_name(relid=None): +def send_application_name(relid=None, app_name=None): """Send the application name down the relation. :param relid: Relation id to set application name in. :type relid: str + :param app_name: Application name to send in the relation. + :type app_name: str """ + if app_name is None: + app_name = application_name() relation_set( relation_id=relid, - relation_settings={'application-name': application_name()}) + relation_settings={'application-name': app_name}) def send_osd_settings(): diff --git a/charmhelpers/core/unitdata.py b/charmhelpers/core/unitdata.py index dac757f..65153f1 100644 --- a/charmhelpers/core/unitdata.py +++ b/charmhelpers/core/unitdata.py @@ -529,7 +529,8 @@ def kv(): env_var = os.environ.get("CHARM_HELPERS_TESTMODE", "auto").lower() if env_var not in ["auto", "no", "yes"]: - logging.warning(f"Unknown value for CHARM_HELPERS_TESTMODE '{env_var}', assuming 'no'") + logging.warning("Unknown value for CHARM_HELPERS_TESTMODE '%s'" + ", assuming 'no'", env_var) env_var = "no" if env_var == "no": diff --git a/charmhelpers/fetch/snap.py b/charmhelpers/fetch/snap.py index 36d6bce..7ab7ce3 100644 --- a/charmhelpers/fetch/snap.py +++ b/charmhelpers/fetch/snap.py @@ -52,7 +52,7 @@ def _snap_exec(commands): :param commands: List commands :return: Integer exit code """ - assert type(commands) == list + assert isinstance(commands, list) retry_count = 0 return_code = None