Skip to content

Commit

Permalink
sweep: DIRACGrid#7739 CS shell improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
atsareg authored and web-flow committed Jul 31, 2024
1 parent f970e38 commit e115418
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 e115418

Please sign in to comment.