From c34146056836affb751484a2e86fee97313d4101 Mon Sep 17 00:00:00 2001 From: Jack Lloyd-Walters Date: Tue, 27 Aug 2024 15:10:32 +0100 Subject: [PATCH] Squashed commit of the following: commit fa28f11e53d4a4d016b89dc779b899d58e1bf73f Author: Stamatis Katsaounis Date: Tue Aug 27 12:34:30 2024 +0300 fix: do not ask question on skipped steps (#53) commit 9f853906d25d5cc9659e83d08f013121cb720a4b Author: Stamatis Katsaounis Date: Tue Aug 27 06:29:28 2024 +0300 fix: set bootstrapped flag (#52) --- anvil-python/anvil/commands/haproxy.py | 8 ++++++-- anvil-python/anvil/commands/postgresql.py | 6 +++++- anvil-python/anvil/provider/local/commands.py | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/anvil-python/anvil/commands/haproxy.py b/anvil-python/anvil/commands/haproxy.py index 2617ffe..e35d29d 100644 --- a/anvil-python/anvil/commands/haproxy.py +++ b/anvil-python/anvil/commands/haproxy.py @@ -21,7 +21,7 @@ from sunbeam.clusterd.client import Client from sunbeam.commands.terraform import TerraformInitStep from sunbeam.jobs import questions -from sunbeam.jobs.common import BaseStep +from sunbeam.jobs.common import BaseStep, ResultType from sunbeam.jobs.juju import JujuHelper from sunbeam.jobs.steps import ( AddMachineUnitsStep, @@ -106,7 +106,11 @@ def has_prompts(self) -> bool: if self.refresh: return False - return True + skip_result = self.is_skip() + if skip_result.result_type == ResultType.SKIPPED: + return False + else: + return True def prompt(self, console: Console | None = None) -> None: variables = questions.load_answers( diff --git a/anvil-python/anvil/commands/postgresql.py b/anvil-python/anvil/commands/postgresql.py index 89eb1b4..219edbc 100644 --- a/anvil-python/anvil/commands/postgresql.py +++ b/anvil-python/anvil/commands/postgresql.py @@ -182,7 +182,11 @@ def has_prompts(self) -> bool: if self.refresh: return False - return True + skip_result = self.is_skip() + if skip_result.result_type == ResultType.SKIPPED: + return False + else: + return True class ReapplyPostgreSQLTerraformPlanStep(DeployMachineApplicationStep): diff --git a/anvil-python/anvil/provider/local/commands.py b/anvil-python/anvil/provider/local/commands.py index 99680b0..b4629ad 100644 --- a/anvil-python/anvil/provider/local/commands.py +++ b/anvil-python/anvil/provider/local/commands.py @@ -22,6 +22,7 @@ from rich.table import Table from snaphelpers import Snap from sunbeam import utils +from sunbeam.commands.bootstrap_state import SetBootstrapped from sunbeam.commands.clusterd import ( ClusterAddJujuUserStep, ClusterAddNodeStep, @@ -306,6 +307,8 @@ def bootstrap( fqdn, ) ) + + plan4.append(SetBootstrapped(client)) run_plan(plan4, console) click.echo(f"Node has been bootstrapped with roles: {pretty_roles}")