Commit a191a409 authored by dobli's avatar dobli
Browse files

fix to properly use default custom path

parent 63783648
...@@ -1336,10 +1336,6 @@ def init_config_dirs_command(args): ...@@ -1336,10 +1336,6 @@ def init_config_dirs_command(args):
:args: parsed commandline arguments :args: parsed commandline arguments
""" """
if hasattr(args, 'custom_dir'):
global custom_path
custom_path = args.custom_dir
# generate basic config folder # generate basic config folder
generate_config_folders() generate_config_folders()
...@@ -1403,11 +1399,6 @@ def interactive_command(args): ...@@ -1403,11 +1399,6 @@ def interactive_command(args):
def main_menu(args): def main_menu(args):
""" Display main menu """ Display main menu
""" """
# Base directory for configs
if hasattr(args, 'custom_dir'):
global custom_path
custom_path = args.custom_dir
# Main menu prompts selection contains function # Main menu prompts selection contains function
choice = qust.select('Public Building Manager - Main Menu', choice = qust.select('Public Building Manager - Main Menu',
choices=load_main_entires(), style=st).ask() choices=load_main_entires(), style=st).ask()
...@@ -1455,11 +1446,6 @@ def init_menu(args): ...@@ -1455,11 +1446,6 @@ def init_menu(args):
:args: Passed commandline arguments :args: Passed commandline arguments
""" """
# Base directory for configs
if hasattr(args, 'custom_dir'):
global custom_path
custom_path = args.custom_dir
# Prompts # Prompts
stack_name = qust.text('Choose a name for your setup', style=st).ask() stack_name = qust.text('Choose a name for your setup', style=st).ask()
hosts = qust.checkbox('What docker machines will be used?', hosts = qust.checkbox('What docker machines will be used?',
...@@ -1563,11 +1549,6 @@ def user_menu(args): ...@@ -1563,11 +1549,6 @@ def user_menu(args):
:args: Passed commandline arguments :args: Passed commandline arguments
""" """
# Base directory for configs
if hasattr(args, 'custom_dir'):
global custom_path
custom_path = args.custom_dir
# Ask for action # Ask for action
choice = qust.select("What do you want to do?", choices=[ choice = qust.select("What do you want to do?", choices=[
'Add a new user', 'Modify existing user', 'Exit'], 'Add a new user', 'Modify existing user', 'Exit'],
...@@ -1647,11 +1628,6 @@ def service_menu(args): ...@@ -1647,11 +1628,6 @@ def service_menu(args):
:args: Passed commandline arguments :args: Passed commandline arguments
""" """
# Base directory for configs
if hasattr(args, 'custom_dir'):
global custom_path
custom_path = args.custom_dir
# Ask for action # Ask for action
choice = qust.select("What do you want to do?", choices=[ choice = qust.select("What do you want to do?", choices=[
'Re-/Start docker stack', 'Stop docker stack', 'Re-/Start docker stack', 'Stop docker stack',
...@@ -1715,11 +1691,6 @@ def device_menu(args): ...@@ -1715,11 +1691,6 @@ def device_menu(args):
:args: Arguments form commandline :args: Arguments form commandline
""" """
# Base directory for configs
if hasattr(args, 'custom_dir'):
global custom_path
custom_path = args.custom_dir
# Check if device scripts are installed # Check if device scripts are installed
bin_path = '/usr/bin/enable-swarm-device' bin_path = '/usr/bin/enable-swarm-device'
...@@ -1799,11 +1770,6 @@ def backup_menu(args): ...@@ -1799,11 +1770,6 @@ def backup_menu(args):
:args: Passed commandline arguments :args: Passed commandline arguments
""" """
# Base directory for configs
if hasattr(args, 'custom_dir'):
global custom_path
custom_path = args.custom_dir
# Ask for action # Ask for action
choice = qust.select("What do you want to do?", choices=[ choice = qust.select("What do you want to do?", choices=[
'Execute backup', 'Restore backup', 'Exit'], 'Execute backup', 'Restore backup', 'Exit'],
...@@ -1948,6 +1914,10 @@ if __name__ == '__main__': ...@@ -1948,6 +1914,10 @@ if __name__ == '__main__':
# Parse arguments into args dict # Parse arguments into args dict
args = parser.parse_args() args = parser.parse_args()
# Check if custom config dir is used
if args.config_dir:
custom_path = args.config_dir
# when no subcommand is defined show interactive menu # when no subcommand is defined show interactive menu
try: try:
args.func(args) args.func(args)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment