Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sweep:integration] CS shell improvements #7742

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading