@@ -463,6 +463,23 @@ def checkWiseFile():
463463 shutil .copyfile (wiseExampleFile , wiseFile )
464464
465465
466+ def getNginxAuthMethod ():
467+ global args
468+ global dotenvImported
469+
470+ authCommonEnvFile = os .path .join (args .configDir , 'auth-common.env' )
471+ if args .authMode :
472+ nginxAuthMode = str (args .authMode ).lower ()
473+ else :
474+ nginxAuthMode = 'unknown'
475+ if os .path .isfile (authCommonEnvFile ):
476+ nginxAuthMode = str (
477+ dotenvImported .dotenv_values (authCommonEnvFile ).get ('NGINX_AUTH_MODE' , nginxAuthMode )
478+ ).lower ()
479+
480+ return nginxAuthMode
481+
482+
466483def malcolm_iso_services_op (start ):
467484 global args
468485 global orchMode
@@ -1381,12 +1398,16 @@ def start():
13811398 # make sure the auth files exist. if we are in an interactive shell and we're
13821399 # missing any of the auth files, prompt to create them now
13831400 if sys .__stdin__ .isatty () and (
1384- not MalcolmAuthFilesExist (configDir = args .configDir , run_profile = args .composeProfile )
1401+ not MalcolmAuthFilesExist (
1402+ configDir = args .configDir , run_profile = args .composeProfile , auth_method = getNginxAuthMethod ()
1403+ )
13851404 ):
13861405 authSetup ()
13871406
13881407 # still missing? sorry charlie
1389- if not MalcolmAuthFilesExist (configDir = args .configDir , run_profile = args .composeProfile ):
1408+ if not MalcolmAuthFilesExist (
1409+ configDir = args .configDir , run_profile = args .composeProfile , auth_method = getNginxAuthMethod ()
1410+ ):
13901411 raise Exception (
13911412 'Files relating to authentication and/or secrets are missing, please run ./scripts/auth_setup to generate them'
13921413 )
@@ -1655,15 +1676,8 @@ def authSetup():
16551676 authCommonEnvFile = os .path .join (args .configDir , 'auth-common.env' )
16561677 nginxEnvFile = os .path .join (args .configDir , 'nginx.env' )
16571678 openSearchEnvFile = os .path .join (args .configDir , 'opensearch.env' )
1679+ nginxAuthMode = getNginxAuthMethod ()
16581680
1659- if args .authMode :
1660- nginxAuthMode = str (args .authMode ).lower ()
1661- else :
1662- nginxAuthMode = 'unknown'
1663- if os .path .isfile (authCommonEnvFile ):
1664- nginxAuthMode = str (
1665- dotenvImported .dotenv_values (authCommonEnvFile ).get ('NGINX_AUTH_MODE' , nginxAuthMode )
1666- ).lower ()
16671681 netboxMode = ''
16681682 if os .path .isfile (netboxCommonEnvFile ):
16691683 netboxMode = str (dotenvImported .dotenv_values (netboxCommonEnvFile ).get ('NETBOX_MODE' , '' )).lower ()
0 commit comments