|
|
@ -87,12 +87,24 @@ def run_complete(shell: Union[None, str]):
|
|
|
|
|
|
|
|
|
|
|
|
def run_config(
|
|
|
|
def run_config(
|
|
|
|
config_filename: str,
|
|
|
|
config_filename: str,
|
|
|
|
|
|
|
|
context: Union[None, str] = None,
|
|
|
|
baseurl: Union[None, str] = None,
|
|
|
|
baseurl: Union[None, str] = None,
|
|
|
|
username: Union[None, str] = None,
|
|
|
|
username: Union[None, str] = None,
|
|
|
|
password: Union[None, str] = None,
|
|
|
|
password: Union[None, str] = None,
|
|
|
|
):
|
|
|
|
):
|
|
|
|
config = {"baseurl": baseurl, "username": username, "password": password}
|
|
|
|
config = {"baseurl": baseurl, "username": username, "password": password}
|
|
|
|
needed = []
|
|
|
|
needed = []
|
|
|
|
|
|
|
|
if context:
|
|
|
|
|
|
|
|
symlink = f'{config_filename}-{context}'
|
|
|
|
|
|
|
|
found = os.path.isfile(symlink)
|
|
|
|
|
|
|
|
if os.path.islink(config_filename):
|
|
|
|
|
|
|
|
os.remove(config_filename)
|
|
|
|
|
|
|
|
elif os.path.isfile(config_filename):
|
|
|
|
|
|
|
|
os.rename(config_filename, symlink)
|
|
|
|
|
|
|
|
os.symlink(symlink, config_filename)
|
|
|
|
|
|
|
|
config_filename = symlink
|
|
|
|
|
|
|
|
if found:
|
|
|
|
|
|
|
|
return
|
|
|
|
if not baseurl:
|
|
|
|
if not baseurl:
|
|
|
|
needed.append("baseurl")
|
|
|
|
needed.append("baseurl")
|
|
|
|
if not username:
|
|
|
|
if not username:
|
|
|
@ -245,6 +257,7 @@ def main() -> int:
|
|
|
|
|
|
|
|
|
|
|
|
configcmd = subparsers.add_parser("config")
|
|
|
|
configcmd = subparsers.add_parser("config")
|
|
|
|
configcmd.add_argument("-b", "--baseurl")
|
|
|
|
configcmd.add_argument("-b", "--baseurl")
|
|
|
|
|
|
|
|
configcmd.add_argument("-c", "--context")
|
|
|
|
configcmd.add_argument("-p", "--password")
|
|
|
|
configcmd.add_argument("-p", "--password")
|
|
|
|
configcmd.add_argument("-u", "--username")
|
|
|
|
configcmd.add_argument("-u", "--username")
|
|
|
|
|
|
|
|
|
|
|
@ -288,7 +301,7 @@ def main() -> int:
|
|
|
|
mkdir(config_basepath)
|
|
|
|
mkdir(config_basepath)
|
|
|
|
|
|
|
|
|
|
|
|
if args.command == "config":
|
|
|
|
if args.command == "config":
|
|
|
|
run_config(config_filename, args.baseurl, args.username, args.password)
|
|
|
|
run_config(config_filename, args.context, args.baseurl, args.username, args.password)
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|
if not isfile(config_filename):
|
|
|
|
if not isfile(config_filename):
|
|
|
|