diff --git a/lib/pavilion/commands/config.py b/lib/pavilion/commands/config.py index 1b40b2577..5caa27137 100644 --- a/lib/pavilion/commands/config.py +++ b/lib/pavilion/commands/config.py @@ -203,9 +203,8 @@ def create_config_dir(self, pav_cfg: config.PavConfig, path: Path, raise ConfigCmdError("Given label '{}' already exists in the pav config." .format(label)) - # This should fail if it already exists. try: - path.mkdir() + path.mkdir(parents=True, exist_ok=True) except OSError as err: raise ConfigCmdError("Could not create specified directory", err) @@ -247,7 +246,7 @@ def create_config_dir(self, pav_cfg: config.PavConfig, path: Path, for subdir in ('hosts', 'modes', 'os', 'plugins', 'collections', 'suites'): subdir = path/subdir try: - subdir.mkdir() + subdir.mkdir(exist_ok=True) except OSError as err: shutil.rmtree(path) raise ConfigCmdError("Could not make config subdir '{}'".format(subdir), err)