From 16df5d0680f772d96e04128897c85a49760e0b15 Mon Sep 17 00:00:00 2001 From: Tee Ngo Date: Tue, 7 May 2019 18:12:44 -0400 Subject: [PATCH] Disable config_controller This commit disables the use of config_controller to configure the initial controller. To ease the transition to Ansible bootstrap, the --force option is provided. This option will be available for the duration of 1 week. After which time, the relevant code of config_controller will be removed. Tests performed: - Verify that config_controller --default, --config-file, and interactive cannot be used without --force - Verify that config_controller --default, --config-file, and interactive can be used with --force option - Verify that the invocations of other config_controller functionalities such as clone, backup, restore are unaffected by this change. Story: 2004695 Task: 30851 Depends-0n: I9fe72b87ea2edec0195f3fc0c2db4cb3bc008900 Change-Id: I1faab71ecc9fa1ea3c913b422156be6a7ade8cf5 Signed-off-by: Tee Ngo --- .../controllerconfig/controllerconfig/systemconfig.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/controllerconfig/controllerconfig/controllerconfig/systemconfig.py b/controllerconfig/controllerconfig/controllerconfig/systemconfig.py index d74c85c507..4226da5e37 100644 --- a/controllerconfig/controllerconfig/controllerconfig/systemconfig.py +++ b/controllerconfig/controllerconfig/controllerconfig/systemconfig.py @@ -306,6 +306,7 @@ def main(): do_clone = False do_non_interactive = False do_provision = False + force_config = False system_config_file = "/home/wrsroot/system_config" allow_ssh = False @@ -401,6 +402,8 @@ def main(): # This is a temporary flag for use during development. Once things # are stable, we will remove it and make kubernetes the default. options['kubernetes'] = True + elif sys.argv[arg] == "--force": + force_config = True else: print("Invalid option. Use --help for more information.") exit(1) @@ -459,6 +462,12 @@ def main(): assistant = ConfigAssistant(**options) assistant.provision(answerfile) else: + if not force_config: + print(textwrap.fill( + "Please use bootstrap playbook to configure the " + "first controller.", 80)) + exit(1) + if do_non_interactive: if not os.path.isfile(system_config_file): raise ConfigFail("Config file %s does not exist." %