fixed a regression bug in config management

This commit is contained in:
Sam Schott 2019-11-12 17:57:56 +00:00
parent 0fdf46d19f
commit db3a2304d7
2 changed files with 9 additions and 3 deletions

View File

@ -13,6 +13,8 @@
changes to a file which is deleted locally while comparing file contents. changes to a file which is deleted locally while comparing file contents.
- Fixes an bug which could create multiple false "conflicting copies" of a file when the - Fixes an bug which could create multiple false "conflicting copies" of a file when the
user modifies the file while it is being uploaded. user modifies the file while it is being uploaded.
- Fixes a regression bug which would prevent the creation and selection of new configs for
different Dropbox accounts.
## v0.4.3 ## v0.4.3

View File

@ -101,6 +101,7 @@ def _check_and_set_config(ctx, param, value):
""" """
from maestral.sync.daemon import get_maestral_pid from maestral.sync.daemon import get_maestral_pid
from maestral.config.main import load_config
# check if valid config # check if valid config
if value not in list_configs() and not value == "maestral": if value not in list_configs() and not value == "maestral":
@ -109,6 +110,7 @@ def _check_and_set_config(ctx, param, value):
# set environment variable # set environment variable
os.environ["MAESTRAL_CONFIG"] = value os.environ["MAESTRAL_CONFIG"] = value
load_config(value)
# check if maestral is running and store the result for other commands to use # check if maestral is running and store the result for other commands to use
pid = get_maestral_pid(value) pid = get_maestral_pid(value)
@ -129,11 +131,11 @@ with_config_opt = click.option(
@click.group() @click.group()
@click.pass_context def main():
def main(ctx):
"""Maestral Dropbox Client for Linux and macOS.""" """Maestral Dropbox Client for Linux and macOS."""
check_for_updates() check_for_updates()
@main.group() @main.group()
def config(): def config():
"""Manage different Maestral configuration environments.""" """Manage different Maestral configuration environments."""
@ -720,6 +722,7 @@ def level(config_name: str, level_name: str, running: bool):
# ======================================================================================== # ========================================================================================
def list_configs(): def list_configs():
"""Lists all maestral configs"""
from maestral.config.base import get_conf_path from maestral.config.base import get_conf_path
configs = [] configs = []
for file in os.listdir(get_conf_path("maestral")): for file in os.listdir(get_conf_path("maestral")):
@ -733,10 +736,11 @@ def list_configs():
@click.argument("name") @click.argument("name")
def config_add(name: str): def config_add(name: str):
"""Set up and activate a fresh Maestral configuration.""" """Set up and activate a fresh Maestral configuration."""
os.environ["MAESTRAL_CONFIG"] = name
if name in list_configs(): if name in list_configs():
click.echo("Configuration '{}' already exists.".format(name)) click.echo("Configuration '{}' already exists.".format(name))
else: else:
from maestral.config.main import load_config
load_config(name)
from maestral.config.main import CONF from maestral.config.main import CONF
CONF.set("main", "default_dir_name", "Dropbox ({})".format(name.capitalize())) CONF.set("main", "default_dir_name", "Dropbox ({})".format(name.capitalize()))
click.echo("Created configuration '{}'.".format(name)) click.echo("Created configuration '{}'.".format(name))