From 77449a0c695faebeeb96117a382ec8190ec91d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Goinvic?= Date: Tue, 12 May 2026 07:44:17 +0000 Subject: [PATCH] Press enter to continue --- .../newsfragments/1293.misc.md | 1 + .../src/ess_migration_tool/__main__.py | 52 +++++++++---------- .../src/ess_migration_tool/utils.py | 7 ++- 3 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 packages/ess-migration-tool/newsfragments/1293.misc.md diff --git a/packages/ess-migration-tool/newsfragments/1293.misc.md b/packages/ess-migration-tool/newsfragments/1293.misc.md new file mode 100644 index 00000000..e6237b8c --- /dev/null +++ b/packages/ess-migration-tool/newsfragments/1293.misc.md @@ -0,0 +1 @@ +Change artifical delays in logs to "press enter to continue" interaction. diff --git a/packages/ess-migration-tool/src/ess_migration_tool/__main__.py b/packages/ess-migration-tool/src/ess_migration_tool/__main__.py index a9bd8f34..46cc46fb 100644 --- a/packages/ess-migration-tool/src/ess_migration_tool/__main__.py +++ b/packages/ess-migration-tool/src/ess_migration_tool/__main__.py @@ -20,7 +20,7 @@ from .mas import MAS_STRATEGY_NAME, parse_postgres_uri from .models import MigrationError from .outputs import generate_helm_values, write_outputs from .synapse import SYNAPSE_STRATEGY_NAME -from .utils import delay_next_steps, prompt_for_database_choice +from .utils import press_enter_to_continue, prompt_for_database_choice LOADING_STEP = "Loading and validating input files" MIGRATING_STEP = "Migrating configuration to ESS values" @@ -60,7 +60,7 @@ class ProgressReporter: self.current_step += 1 progress = self.current_step / len(self.all_steps) * 100 self.pretty_logger.info(f"šŸ“¦ Step {self.current_step}/{len(self.all_steps)} ({progress:.0f}%): {step_name}") - delay_next_steps(self.pretty_logger) + press_enter_to_continue(self.pretty_logger) def report_success(self, output_dir: str): """Report successful completion.""" @@ -281,7 +281,7 @@ Examples: ) # Display migration summary - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) pretty_logger.info("\nšŸ“Š MIGRATION SUMMARY") pretty_logger.info("=" * 60) @@ -308,7 +308,7 @@ Examples: pretty_logger.info("āœ… SUCCESSFULLY MIGRATED TO ESS:") for source_path, (source_file, target_path) in sorted(migration_mapping.items()): pretty_logger.info(f" • {source_file}: {source_path} → {target_path}") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) if engine.ess_config["synapse"].get("workers"): pretty_logger.info("šŸ“ Discovered and enabled the following Synapse workers") @@ -319,7 +319,7 @@ Examples: else: pretty_logger.info(" āœ… No workers found, using a single main Synapse process") if engine.discovered_secrets: - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) pretty_logger.info("šŸ” MIGRATED SECRETS:") for discovered_secret in engine.discovered_secrets: pretty_logger.info( @@ -328,7 +328,7 @@ Examples: ) if engine.init_by_ess_secrets: - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) pretty_logger.info("\nāš ļø ESS-INITIALIZED SECRETS:") pretty_logger.info("The following Synapse secrets will be auto-generated by ESS:") for secret in engine.init_by_ess_secrets: @@ -336,47 +336,47 @@ Examples: pretty_logger.info( "These secrets are not required for migration but will be created automatically during deployment." ) - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) # Show override warnings within the migration summary if engine.override_warnings: - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) pretty_logger.info("\nāš ļø ESS-MANAGED OVERRIDES FOUND:") pretty_logger.info(" These settings are managed by ESS and your values may be ignored:") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) for warning in engine.override_warnings: pretty_logger.info(f" • {warning}") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) pretty_logger.info("ā— ACTION REQUIRED:") pretty_logger.info(" Remove these settings from your additional configuration to avoid conflicts.") pretty_logger.info(" They are now automatically managed by the ESS Helm chart.") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) # Show underride warnings within the migration summary if engine.underride_warnings: - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) pretty_logger.info("\nā„¹ļø ESS DEFAULT CONFIGURATIONS FOUND:") pretty_logger.info(" These settings have ESS defaults that your values will override:") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) for warning in engine.underride_warnings: pretty_logger.info(f" • {warning}") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) # Show clean migration message if not engine.override_warnings and not engine.underride_warnings: - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) pretty_logger.info("šŸŽ‰ CLEAN MIGRATION: No unexpected overrides detected!") pretty_logger.info(" All configurations have been properly migrated to ESS.") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) # Show next steps for deployment pretty_logger.info("šŸš€ NEXT STEPS TO DEPLOY ELEMENT SERVER SUITE:") pretty_logger.info("=" * 60) - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) # Use incremental step numbering step_number = 1 @@ -406,7 +406,7 @@ Examples: f' helm upgrade --install --namespace "ess" ess ' f"oci://ghcr.io/element-hq/ess-helm/matrix-stack -f {values_path} --wait" ) - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) # Get the original media path from Synapse configuration synapse_input = engine.input_processor.input_for_strategy(SYNAPSE_STRATEGY_NAME) @@ -417,10 +417,10 @@ Examples: if original_media_path: pretty_logger.info(f"{step_number}. Copy media from your existing setup to ESS persistent volume:") pretty_logger.info(f" kubectl cp {original_media_path} ess-synapse-0:/media/media_store -n ess") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) pretty_logger.info("šŸ“š For more details on deployment and data migration, refer to the ESS documentation.") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) # Add database-specific instructions if not engine.global_options.use_existing_database: @@ -428,7 +428,7 @@ Examples: pretty_logger.info("=" * 60) pretty_logger.info("Since you chose to use ESS-managed Postgres, you'll need to import your") pretty_logger.info("existing database schema after deployment. Here are the steps:") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) # Get source database configuration from input files synapse_input = engine.input_processor.input_for_strategy(SYNAPSE_STRATEGY_NAME) @@ -465,7 +465,7 @@ Examples: pretty_logger.info( ' kubectl scale deploy -l "app.kubernetes.io/component=matrix-authentication" -n ess --replicas=0' ) - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) step_number += 1 @@ -477,7 +477,7 @@ Examples: if mas_input: pretty_logger.info(f" pg_dump -C -U {source_mas_user} -d {source_mas_db} > mas.sql") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) step_number += 1 # Step 3: Transform the dumps (only show if transformations are needed) @@ -511,7 +511,7 @@ Examples: if mas_input and source_mas_user != target_mas_user: pretty_logger.info(f" sed -i 's/OWNER TO.*{source_mas_user}/OWNER TO {target_mas_user}/' mas.sql") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) step_number += 1 # Step: Copy the dumps @@ -522,7 +522,7 @@ Examples: if mas_input: pretty_logger.info(" kubectl cp mas.sql ess-postgres-0:/tmp -n ess") - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) step_number += 1 # Step: Import the dumps @@ -553,7 +553,7 @@ Examples: ' kubectl scale deploy -l "app.kubernetes.io/component=matrix-authentication" -n ess --replicas=1' ) - delay_next_steps(pretty_logger) + press_enter_to_continue(pretty_logger) pretty_logger.info("=" * 60) diff --git a/packages/ess-migration-tool/src/ess_migration_tool/utils.py b/packages/ess-migration-tool/src/ess_migration_tool/utils.py index 3193ed6e..78594d97 100644 --- a/packages/ess-migration-tool/src/ess_migration_tool/utils.py +++ b/packages/ess-migration-tool/src/ess_migration_tool/utils.py @@ -5,8 +5,6 @@ import logging import os -import random -import time import urllib.parse from collections import defaultdict from collections.abc import Callable @@ -487,9 +485,10 @@ def prompt_for_database_choice(pretty_logger: logging.Logger) -> bool: return False -def delay_next_steps(pretty_logger: logging.Logger) -> None: +def press_enter_to_continue(pretty_logger: logging.Logger) -> None: if not is_quiet_mode(pretty_logger) and not os.environ.get("PYTEST_CURRENT_TEST"): - time.sleep(random.uniform(0.2, 1.5)) + pretty_logger.info(" Press Enter to continue...") + input() pretty_logger.info("")