Skip to content

Commit

Permalink
Merge pull request #7739 from atsareg/cs-shell-update
Browse files Browse the repository at this point in the history
[8.0] CS shell improvements
  • Loading branch information
fstagni authored Jul 31, 2024
2 parents 1b904ba + 733f9df commit ad92b5a
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/DIRAC/ConfigurationSystem/Client/CSShellCLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"""
Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit ad92b5a

Please sign in to comment.