Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix known issues in refresh command #66

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 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
6 changes: 4 additions & 2 deletions anvil-python/anvil/commands/haproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def __init__(
deployment_preseed: dict[Any, Any] | None = None,
accept_defaults: bool = False,
refresh: bool = False,
verb: str = "Deploy",
):
super().__init__(
client,
Expand All @@ -124,8 +125,8 @@ def __init__(
APPLICATION,
model,
"haproxy-plan",
"Deploy HAProxy",
"Deploying HAProxy",
f"{verb.capitalize()} HAProxy",
f"{verb.capitalize()}ing HAProxy",
refresh,
)
self.preseed = deployment_preseed or {}
Expand Down Expand Up @@ -323,5 +324,6 @@ def haproxy_upgrade_steps(
model,
deployment_preseed=preseed,
refresh=True,
verb="Refresh",
),
]
7 changes: 4 additions & 3 deletions anvil-python/anvil/commands/maas_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(
jhelper: JujuHelper,
model: str,
refresh: bool = False,
verb: str = "Deploy",
):
super().__init__(
client,
Expand All @@ -56,8 +57,8 @@ def __init__(
APPLICATION,
model,
"maas-agent-plan",
"Deploy MAAS Agent",
"Deploying MAAS Agent",
f"{verb.capitalize()} MAAS Agent",
f"{verb.capitalize()}ing MAAS Agent",
refresh,
)

Expand Down Expand Up @@ -134,6 +135,6 @@ def maas_agent_upgrade_steps(
return [
TerraformInitStep(manifest.get_tfhelper("maas-agent-plan")),
DeployMAASAgentApplicationStep(
client, manifest, jhelper, model, refresh=True
client, manifest, jhelper, model, refresh=True, verb="Refresh"
),
]
7 changes: 4 additions & 3 deletions anvil-python/anvil/commands/maas_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def __init__(
jhelper: JujuHelper,
model: str,
refresh: bool = False,
verb: str = "Deploy",
):
super().__init__(
client,
Expand All @@ -58,8 +59,8 @@ def __init__(
APPLICATION,
model,
"maas-region-plan",
"Deploy MAAS Region",
"Deploying MAAS Region",
f"{verb.capitalize()} MAAS Region",
f"{verb.capitalize()} MAAS Region",
refresh,
)

Expand Down Expand Up @@ -150,6 +151,6 @@ def maas_region_upgrade_steps(
return [
TerraformInitStep(manifest.get_tfhelper("maas-region-plan")),
DeployMAASRegionApplicationStep(
client, manifest, jhelper, model, refresh=True
client, manifest, jhelper, model, refresh=True, verb="Refresh"
),
]
6 changes: 4 additions & 2 deletions anvil-python/anvil/commands/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def postgresql_upgrade_steps(
model,
deployment_preseed=preseed,
refresh=True,
verb="Refresh",
),
]

Expand Down Expand Up @@ -123,6 +124,7 @@ def __init__(
deployment_preseed: dict[Any, Any] | None = None,
accept_defaults: bool = False,
refresh: bool = False,
verb: str = "Deploy",
):
super().__init__(
client,
Expand All @@ -132,8 +134,8 @@ def __init__(
APPLICATION,
model,
"postgresql-plan",
"Deploy PostgreSQL",
"Deploying PostgreSQL",
f"{verb.capitalize()} PostgreSQL",
f"{verb.capitalize()}ing PostgreSQL",
refresh,
)

Expand Down
66 changes: 38 additions & 28 deletions anvil-python/anvil/commands/upgrades/inter_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,32 +245,42 @@ def get_plan(self) -> list[BaseStep]:

Return the steps to complete this upgrade.
"""
plan = [
UpgradeHAProxyCharm(
self.client,
self.jhelper,
self.manifest,
self.deployment.infrastructure_model,
),
UpgradePostgreSQLCharm(
self.client,
self.jhelper,
self.manifest,
self.deployment.infrastructure_model,
),
# TODO: Don't allow updating MAAS until upgrade path sorted
# UpgradeMAASAgentCharm(
# self.client,
# self.jhelper,
# self.manifest,
# self.deployment.infrastructure_model,
# ),
# UpgradeMAASRegionCharm(
# self.client,
# self.jhelper,
# self.manifest,
# self.deployment.infrastructure_model,
# ),
UpgradePlugins(self.deployment, upgrade_release=True),
]
plan: list[BaseStep] = []
if self.client.cluster.list_nodes_by_role("haproxy"):
plan.append(
UpgradeHAProxyCharm(
self.client,
self.jhelper,
self.manifest,
self.deployment.infrastructure_model,
)
)
if self.client.cluster.list_nodes_by_role("database"):
skatsaounis marked this conversation as resolved.
Show resolved Hide resolved
plan.append(
UpgradePostgreSQLCharm(
self.client,
self.jhelper,
self.manifest,
self.deployment.infrastructure_model,
)
)
if self.client.cluster.list_nodes_by_role("agent"):
plan.append(
UpgradeMAASAgentCharm(
self.client,
self.jhelper,
self.manifest,
self.deployment.infrastructure_model,
)
)
if self.client.cluster.list_nodes_by_role("region"):
plan.append(
UpgradeMAASRegionCharm(
self.client,
self.jhelper,
self.manifest,
self.deployment.infrastructure_model,
)
)
plan.append(UpgradePlugins(self.deployment, upgrade_release=True))
return plan
64 changes: 34 additions & 30 deletions anvil-python/anvil/commands/upgrades/intra_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,40 +158,44 @@ def get_plan(self) -> list[BaseStep]:
plan: list[BaseStep] = []
plan.append(LatestInChannel(self.jhelper, self.manifest))

plan.extend(
haproxy_upgrade_steps(
self.client,
self.manifest,
self.jhelper,
self.deployment.infrastructure_model,
self.preseed,
if self.client.cluster.list_nodes_by_role("haproxy"):
plan.extend(
haproxy_upgrade_steps(
self.client,
self.manifest,
self.jhelper,
self.deployment.infrastructure_model,
self.preseed,
)
)
)
plan.extend(
postgresql_upgrade_steps(
self.client,
self.manifest,
self.jhelper,
self.deployment.infrastructure_model,
self.preseed,
if self.client.cluster.list_nodes_by_role("database"):
skatsaounis marked this conversation as resolved.
Show resolved Hide resolved
plan.extend(
postgresql_upgrade_steps(
self.client,
self.manifest,
self.jhelper,
self.deployment.infrastructure_model,
self.preseed,
)
)
)
plan.extend(
maas_region_upgrade_steps(
self.client,
self.manifest,
self.jhelper,
self.deployment.infrastructure_model,
if self.client.cluster.list_nodes_by_role("agent"):
plan.extend(
maas_agent_upgrade_steps(
self.client,
self.manifest,
self.jhelper,
self.deployment.infrastructure_model,
)
)
)
plan.extend(
maas_agent_upgrade_steps(
self.client,
self.manifest,
self.jhelper,
self.deployment.infrastructure_model,
if self.client.cluster.list_nodes_by_role("region"):
plan.extend(
maas_region_upgrade_steps(
self.client,
self.manifest,
self.jhelper,
self.deployment.infrastructure_model,
)
)
)

plan.append(UpgradePlugins(self.deployment, upgrade_release=False))

Expand Down
Loading