Skip to content

Commit

Permalink
Updates for testing period for 23.10 release
Browse files Browse the repository at this point in the history
* charm-helpers sync for classic charms
* build.lock file for reactive charms
* ensure tox.ini is from release-tools
* Locked requirements using pip-compile:
  * existing (test-)requirements.txt ->
    (test-)requirements.in
  * pip-compile to *-py3[8|10].txt using python3.8
    and python3.10.
  * Updated tox.ini to use the appropriate merged
    requirements-*.txt files.
* Removal of lunar from metadata, charmcraft.yaml
  osci.yaml, tests.yaml and associated bundles.
* Locked libs and tests to stable/bobcat branches for:
  * charm-helpers
  * charms.openstack
  * zaza
  * zaza-openstack-tests

Change-Id: Ifaabafe641e50bd8ad172a6088042331741d49c8
  • Loading branch information
ajkavanagh authored and freyes committed Nov 2, 2023
1 parent e70f228 commit e2daae6
Show file tree
Hide file tree
Showing 24 changed files with 2,368 additions and 442 deletions.
2 changes: 2 additions & 0 deletions .gitreview
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
host=review.opendev.org
port=29418
project=openstack/charm-nova-compute.git

defaultbranch=stable/2023.2
7 changes: 0 additions & 7 deletions build-requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion charm-helpers-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
repo: https://github.com/juju/charm-helpers
repo: https://github.com/juju/charm-helpers@stable/bobcat
destination: hooks/charmhelpers
include:
- core
Expand Down
3 changes: 0 additions & 3 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ bases:
- name: ubuntu
channel: "22.04"
architectures: [amd64, s390x, ppc64el, arm64]
- name: ubuntu
channel: "23.04"
architectures: [amd64, s390x, ppc64el, arm64]
- name: ubuntu
channel: "23.10"
architectures: [amd64, s390x, ppc64el, arm64]
33 changes: 21 additions & 12 deletions hooks/charmhelpers/contrib/openstack/cert_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,18 +414,27 @@ def get_requests_for_local_unit(relation_name=None):
is_legacy_request = set(sent).intersection(legacy_keys)
for unit in related_units(rid):
data = relation_get(rid=rid, unit=unit)
if data.get(raw_certs_key):
bundles.append({
'ca': data['ca'],
'chain': data.get('chain'),
'certs': json.loads(data[raw_certs_key])})
elif is_legacy_request:
bundles.append({
'ca': data['ca'],
'chain': data.get('chain'),
'certs': {sent['common_name']:
{'cert': data.get(local_name + '.server.cert'),
'key': data.get(local_name + '.server.key')}}})
# Note: Bug#2028683 - data may not be available if the certificates
# relation hasn't been populated by the providing charm. If no 'ca'
# in the data then don't attempt the bundle at all.
if data.get('ca'):
if data.get(raw_certs_key):
bundles.append({
'ca': data['ca'],
'chain': data.get('chain'),
'certs': json.loads(data[raw_certs_key])
})
elif is_legacy_request:
bundles.append({
'ca': data['ca'],
'chain': data.get('chain'),
'certs': {
sent['common_name']: {
'cert': data.get(local_name + '.server.cert'),
'key': data.get(local_name + '.server.key')
}
}
})

return bundles

Expand Down
8 changes: 4 additions & 4 deletions hooks/charmhelpers/contrib/openstack/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Listen {{ admin_port }}
Listen {{ public_port }}
{% endif -%}

{% if wsgi_rotation -%}
{% if wsgi_socket_rotation -%}
WSGISocketRotation On
{% else -%}
WSGISocketRotation Off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Listen {{ admin_port }}
Listen {{ public_port }}
{% endif -%}

{% if wsgi_rotation -%}
{% if wsgi_socket_rotation -%}
WSGISocketRotation On
{% else -%}
WSGISocketRotation Off
Expand Down
1 change: 0 additions & 1 deletion hooks/charmhelpers/contrib/openstack/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,6 @@ def _do_install():
return openstack_release().get('OPENSTACK_CODENAME')


@cached
def openstack_release():
"""Return /etc/os-release in a dict."""
d = {}
Expand Down
8 changes: 6 additions & 2 deletions hooks/charmhelpers/contrib/storage/linux/ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
39 changes: 38 additions & 1 deletion hooks/charmhelpers/core/unitdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def config_changed():
import datetime
import itertools
import json
import logging
import os
import pprint
import sqlite3
Expand Down Expand Up @@ -521,6 +522,42 @@ class DeltaSet(Record):

def kv():
global _KV

# If we are running unit tests, it is useful to go into memory-backed KV store to
# avoid concurrency issues when running multiple tests. This is not a
# problem when juju is running normally.

env_var = os.environ.get("CHARM_HELPERS_TESTMODE", "auto").lower()
if env_var not in ["auto", "no", "yes"]:
logging.warning("Unknown value for CHARM_HELPERS_TESTMODE '%s'"
", assuming 'no'", env_var)
env_var = "no"

if env_var == "no":
in_memory_db = False
elif env_var == "yes":
in_memory_db = True
elif env_var == "auto":
# If UNIT_STATE_DB is set, respect this request
if "UNIT_STATE_DB" in os.environ:
in_memory_db = False
# Autodetect normal juju execution by looking for juju variables
elif "JUJU_CHARM_DIR" in os.environ or "JUJU_UNIT_NAME" in os.environ:
in_memory_db = False
else:
# We are probably running in unit test mode
logging.warning("Auto-detected unit test environment for KV store.")
in_memory_db = True
else:
# Help the linter realise that in_memory_db is always set
raise Exception("Cannot reach this line")

if _KV is None:
_KV = Storage()
if in_memory_db:
_KV = Storage(":memory:")
else:
_KV = Storage()
else:
if in_memory_db and _KV.db_path != ":memory:":
logging.warning("Running with in_memory_db and KV is not set to :memory:")
return _KV
2 changes: 1 addition & 1 deletion hooks/charmhelpers/fetch/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit e2daae6

Please sign in to comment.