diff --git a/shpc/client/config.py b/shpc/client/config.py index 0e275dea8..164ee2295 100644 --- a/shpc/client/config.py +++ b/shpc/client/config.py @@ -10,8 +10,6 @@ def main(args, parser, extra, subparser): from shpc.main import get_client - cli = get_client(quiet=args.quiet, settings_file=args.settings_file) - # If nothing provided, show help if not args.params: print(subparser.format_help()) @@ -20,6 +18,11 @@ def main(args, parser, extra, subparser): # The first "param" is either set of get command = args.params.pop(0) + validate = True if not command == "edit" else False + cli = get_client( + quiet=args.quiet, settings_file=args.settings_file, validate=validate + ) + # For each new setting, update and save! if command == "edit": return cli.settings.edit() diff --git a/shpc/main/__init__.py b/shpc/main/__init__.py index 95c5f86b8..12c60c861 100644 --- a/shpc/main/__init__.py +++ b/shpc/main/__init__.py @@ -21,9 +21,10 @@ def get_client(quiet=False, **kwargs): """ # The name of the module module = kwargs.get("module") + validate = kwargs.get("validate", True) # Load user settings to add to client, and container technology - settings = Settings(kwargs.get("settings_file")) + settings = Settings(kwargs.get("settings_file"), validate) container = kwargs.get("container_tech") or settings.container_tech # Use the user provided module OR the default diff --git a/shpc/main/modules/templates/docker.tcl b/shpc/main/modules/templates/docker.tcl index 24c3faac6..a950cfe5e 100644 --- a/shpc/main/modules/templates/docker.tcl +++ b/shpc/main/modules/templates/docker.tcl @@ -19,7 +19,7 @@ proc ModulesHelp { } { puts stderr " - {|module_name|}-shell:" puts stderr " {{ command }} run -i{% if tty %}t{% endif %} -u `id -u`:`id -g` --rm --entrypoint {{ shell }}{% if envfile %} --env-file {{ module_dir }}/{{ envfile }}{% endif %} {% if bindpaths %}-v {{ bindpaths }} {% endif %} -v . -w . " puts stderr " - {|module_name|}-exec:" - puts stderr " {{ command }} run -i{% if tty %}t{% endif %} -u `id -u`:`id -g` --rm --entrypoint {{ shell }}{% if envfile %} --env-file {{ module_dir }}/{{ envfile }}{% endif %} {% if bindpaths %}-v {{ bindpaths }} {% endif %} -v . -w . $*" + puts stderr " {{ command }} run -i{% if tty %}t{% endif %} -u `id -u`:`id -g` --rm --entrypoint \"\" {% if envfile %} --env-file {{ module_dir }}/{{ envfile }}{% endif %} {% if bindpaths %}-v {{ bindpaths }} {% endif %} -v . -w . $*" puts stderr " - {|module_name|}-inspect:" puts stderr " {{ command }} inspect " {% if aliases %}{% for alias in aliases %} puts stderr " - {{ alias.name }}:" diff --git a/shpc/main/settings.py b/shpc/main/settings.py index 72033aa8a..cf5fa73af 100644 --- a/shpc/main/settings.py +++ b/shpc/main/settings.py @@ -141,12 +141,13 @@ class Settings(SettingsBase): a dictionary-like class with extra functions. """ - def __init__(self, settings_file): + def __init__(self, settings_file, validate=True): """ Create a new settings object, which requires a settings file to load """ self.load(settings_file) - self.validate() + if validate: + self.validate() # Set an updated time, in case it's written back to file self._settings["updated_at"] = datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")