File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5959_CLI_INSTANCE_PASSWORD : str | None = None
6060
6161
62- def SNowInstance ():
62+ def SNowInstance (snow_credentials : tuple [ str , str ] | None = None ):
6363 """
64- Wrapper around the standard SNowInstance that always uses CLI-provided credentials.
64+ Wrapper around the standard SNowInstance that prefers explicit credentials.
6565 """
66- if not _CLI_INSTANCE_URL or not _CLI_INSTANCE_PASSWORD :
67- raise RuntimeError ("Installer requires --instance-url and --instance-password arguments." )
66+ if not _CLI_INSTANCE_URL :
67+ raise RuntimeError ("Installer requires --instance-url to create a SNowInstance." )
68+
69+ resolved_url = _CLI_INSTANCE_URL
70+ resolved_creds = snow_credentials
71+
72+ if resolved_creds is None :
73+ if not _CLI_INSTANCE_PASSWORD :
74+ raise RuntimeError (
75+ "Installer requires --instance-password (or explicit credentials) to create a SNowInstance."
76+ )
77+ resolved_creds = ("admin" , _CLI_INSTANCE_PASSWORD )
78+
6879 return _BaseSNowInstance (
69- snow_url = _CLI_INSTANCE_URL ,
70- snow_credentials = ( "admin" , _CLI_INSTANCE_PASSWORD ) ,
80+ snow_url = resolved_url ,
81+ snow_credentials = resolved_creds ,
7182 )
7283
7384
You can’t perform that action at this time.
0 commit comments