Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions osism/commands/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ def _prepare_task(
timeout,
task_timeout,
):
from celery import group
from osism.data.playbooks import MAP_ROLE2ENVIRONMENT, MAP_ROLE2RUNTIME
from osism.tasks import ansible, ceph, kolla, kubernetes

Expand Down Expand Up @@ -312,35 +311,14 @@ def _prepare_task(
t = kubernetes.run.si(
environment, role, arguments, auto_release_time=task_timeout
)
elif role == "loadbalancer-ng":
if sub:
environment = f"{environment}.{sub}"
g = group(
kolla.run.si(
environment, playbook, arguments, auto_release_time=task_timeout
)
for playbook in enums.LOADBALANCER_PLAYBOOKS
)
t = (
kolla.run.si(
environment,
"loadbalancer-ng",
arguments,
auto_release_time=task_timeout,
)
| g
)
elif environment == "kolla":
if sub:
environment = f"{environment}.{sub}"

if role.startswith("kolla-"):
role = role[6:]

if role in ["mariadb-ng", "rabbitmq-ng"]:
kolla_arguments = [f"-e kolla_action_ng={action}"] + arguments
else:
kolla_arguments = [f"-e kolla_action={action}"] + arguments
kolla_arguments = [f"-e kolla_action={action}"] + arguments

if (
role not in ["common"]
Expand Down
40 changes: 6 additions & 34 deletions osism/data/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,6 @@ def __init__(self, name, dependencies=None):
self.dependencies = dependencies or []


LOADBALANCER_PLAYBOOKS = [
"loadbalancer-aodh",
"loadbalancer-barbican",
"loadbalancer-blazar",
"loadbalancer-ceph-rgw",
"loadbalancer-cinder",
"loadbalancer-designate",
"loadbalancer-glance",
"loadbalancer-gnocchi",
"loadbalancer-grafana",
"loadbalancer-heat",
"loadbalancer-horizon",
"loadbalancer-ironic",
"loadbalancer-keystone",
"loadbalancer-magnum",
"loadbalancer-manila",
"loadbalancer-mariadb",
"loadbalancer-memcached",
"loadbalancer-neutron",
"loadbalancer-nova",
"loadbalancer-octavia",
"loadbalancer-opensearch",
"loadbalancer-placement",
"loadbalancer-prometheus",
"loadbalancer-rabbitmq",
"loadbalancer-skydive",
]

VALIDATE_PLAYBOOKS = {
"barbican-config": {
"runtime": "kolla-ansible",
Expand Down Expand Up @@ -158,7 +130,7 @@ def __init__(self, name, dependencies=None):
dependencies=[
Role("opensearch"),
Role(
"mariadb-ng",
"mariadb",
dependencies=[
Role("horizon"),
Role(
Expand Down Expand Up @@ -187,7 +159,7 @@ def __init__(self, name, dependencies=None):
Role("openvswitch", dependencies=[Role("ovn")]),
Role("memcached"),
Role("redis"),
Role("rabbitmq-ng"),
Role("rabbitmq"),
],
),
Role(
Expand Down Expand Up @@ -242,13 +214,13 @@ def __init__(self, name, dependencies=None):
dependencies=[
Role("letsencrypt"),
Role("opensearch"),
Role("mariadb-ng"),
Role("mariadb"),
],
),
Role("openvswitch", dependencies=[Role("ovn")]),
Role("memcached"),
Role("redis"),
Role("rabbitmq-ng"),
Role("rabbitmq"),
],
),
],
Expand Down Expand Up @@ -386,13 +358,13 @@ def __init__(self, name, dependencies=None):
dependencies=[
Role("letsencrypt"),
Role("opensearch"),
Role("mariadb-ng"),
Role("mariadb"),
],
),
Role("openvswitch", dependencies=[Role("ovn")]),
Role("memcached"),
Role("redis"),
Role("rabbitmq-ng"),
Role("rabbitmq"),
],
),
],
Expand Down
33 changes: 0 additions & 33 deletions tests/unit/data/test_enums.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

from osism.data.enums import (
LOADBALANCER_PLAYBOOKS,
MAP_ROLE2ROLE,
VALIDATE_PLAYBOOKS,
Role,
Expand Down Expand Up @@ -97,38 +96,6 @@ def test_role_accepts_nested_dependencies():
assert role.dependencies[0].dependencies[0].name == "nova"


# ---------------------------------------------------------------------------
# LOADBALANCER_PLAYBOOKS
# ---------------------------------------------------------------------------


def test_loadbalancer_playbooks_is_non_empty_list():
assert isinstance(LOADBALANCER_PLAYBOOKS, list)
assert LOADBALANCER_PLAYBOOKS


def test_loadbalancer_playbooks_entries_are_non_empty_strings():
for entry in LOADBALANCER_PLAYBOOKS:
assert isinstance(entry, str)
assert entry


def test_loadbalancer_playbooks_entries_share_prefix():
for entry in LOADBALANCER_PLAYBOOKS:
assert entry.startswith("loadbalancer-")


def test_loadbalancer_playbooks_entries_have_service_suffix():
for entry in LOADBALANCER_PLAYBOOKS:
suffix = entry.removeprefix("loadbalancer-")
assert suffix
assert not suffix.startswith("-")


def test_loadbalancer_playbooks_has_no_duplicates():
assert len(LOADBALANCER_PLAYBOOKS) == len(set(LOADBALANCER_PLAYBOOKS))


# ---------------------------------------------------------------------------
# VALIDATE_PLAYBOOKS
# ---------------------------------------------------------------------------
Expand Down