From 733f9df86895dbc52a17280ce55ee1193e42d196 Mon Sep 17 00:00:00 2001 From: Andrei Tsaregorodtsev Date: Mon, 29 Jul 2024 22:54:20 +0200 Subject: [PATCH] feat: updated logic, added reload and sort commands --- .../ConfigurationSystem/Client/CSShellCLI.py | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/DIRAC/ConfigurationSystem/Client/CSShellCLI.py b/src/DIRAC/ConfigurationSystem/Client/CSShellCLI.py index c716158c4ac..f2c04055f38 100644 --- a/src/DIRAC/ConfigurationSystem/Client/CSShellCLI.py +++ b/src/DIRAC/ConfigurationSystem/Client/CSShellCLI.py @@ -63,6 +63,13 @@ def do_connect(self, line): self.update_prompt() print("done.") + def do_reload(self, _line): + """reload + Reload contents of the remote configuration""" + result = self.modificator.loadFromRemote() + if not result["OK"]: + print("Reload failed: ", result["Message"]) + def do_disconnect(self, _line): """Disconnect from CS""" if self.connected and self.dirty: @@ -154,6 +161,13 @@ def do_rmdir(self, line): complete_rmdir = complete_cd + def do_sort(self, line): + """sort + Sort sections alphabetically""" + if self.connected: + self.modificator.sortAlphabetically(self.root, ascending=True) + self.dirty = True + def do_rm(self, line): """rm Delete an option in the CS""" @@ -193,7 +207,12 @@ def do_commit(self, _line): """commit Commit the modifications to the CS""" if self.connected and self.dirty: - self.modificator.commit() + result = self.modificator.commit() + if not result["OK"]: + print("Commit failed: ", result["Message"]) + # Reload to allow further commits + self.do_reload("") + self.dirty = False def default(self, line): """Override [Cmd.default(line)] function."""