Opened 7 years ago

Closed 6 years ago

#3118 closed enhancement (wontfix)

Feature Request (with patch): bindctl - check on "quit" if pending changes exist

Reported by: cas Owned by:
Priority: medium Milestone: Remaining BIND10 tickets
Component: ~bind-ctl (obsolete) Version: bind10-old
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: Core Feature Depending on Ticket:
Estimated Difficulty: 3 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

Author: Carsten Strotmann <cas@…>
Date: Sat Aug 24 07:43:57 2013 +0200

Feature: bindctl - check on "quit" if pending changes exist, if there are pending changes, stop the termination of bindctl, print a warning and the list of pending changes

diff --git a/src/bin/bindctl/bindcmd.py b/src/bin/bindctl/bindcmd.py
index 03b5d6b..e0ed038 100644
--- a/src/bin/bindctl/bindcmd.py
+++ b/src/bin/bindctl/bindcmd.py
@@ -503,8 +503,13 @@ WARNING: The Python readline module isn't available, so some command line

     def onecmd(self, line):
         if line == 'EOF' or line.lower() == "quit":
-            self.conn.close()
-            return True
+            if (self.config_data.get_local_changes() == {}):
+               self.conn.close()
+               return True
+            else:
+               self._print("Aborting QUIT, there are uncomitted changes. Use 'config revert' if you want to delete the pending changes")
+               self._print(self.config_data.get_local_changes())
+               line = ''

         if line == 'h':
             line = 'help'

Subtickets

Change History (11)

comment:1 follow-up: Changed 7 years ago by vorner

I'm not sure we want this. We would at least need to check if we run from terminal. Otherwise, if a file with commands is fed to bindctl, it refuses to stop and bad things happen.

comment:2 in reply to: ↑ 1 Changed 7 years ago by cas

Replying to vorner:

I'm not sure we want this. We would at least need to check if we run from terminal. Otherwise, if a file with commands is fed to bindctl, it refuses to stop and bad things happen.

Valid point.

I see the default mode of operation for "bindctl" is the interactive mode.

Running a script should be made explicit (testing if run from terminal might be hard on non-Unix OS like Windows) with a "-q --quiet" and/or "-b --batch" command line argument. Such an command line argument would suppress all prompts (and can also suppress output not important for scripting, such as the "> prompt" or the login message.

comment:3 follow-up: Changed 7 years ago by vorner

Well, I don't really agree. Most of software I use can do such detection. I don't think it is OK to degrade usability for users just because some OS we might want to support in future doesn't support it.

I'm not against adding such option, but I'd still like to detect the condition automatically and not require doing so ‒ because, how many people read the manual before they try to pipe some commands to the interface?

comment:4 in reply to: ↑ 3 Changed 7 years ago by cas

Replying to vorner:

Well, I don't really agree. Most of software I use can do such detection. I don't think it is OK to degrade usability for users just because some OS we might want to support in future doesn't support it.

I'm not against adding such option, but I'd still like to detect the condition automatically and not require doing so ‒ because, how many people read the manual before they try to pipe some commands to the interface?

I do not have a strong opinion on this.

How about:

  • have a global state (variable) in bindctl that reflects the mode (batch or interactive on terminal)
  • have a command line switch where the state can be explicitly set by the user
  • if the state has not been set by the user, test and set the state on OS systems where it is possible to detect if the command runs on a terminal

comment:5 Changed 7 years ago by vorner

+1

comment:6 Changed 7 years ago by jreed

Related tickets are #264 and #718.

comment:7 Changed 7 years ago by muks

  • Estimated Difficulty changed from 0 to 3

comment:8 Changed 7 years ago by muks

  • Milestone New Tasks deleted

comment:9 Changed 7 years ago by muks

When dependencies are done, please update this ticket too.

comment:10 Changed 6 years ago by tomek

  • Milestone set to Remaining BIND10 tickets

comment:11 Changed 6 years ago by tomek

  • Resolution set to wontfix
  • Status changed from new to closed
  • Version set to old-bind10

This issue is related to bind10 code that is no longer part of Kea.

If you are interested in BIND10/Bundy framework or its DNS components,
please check http://bundy-dns.de.

Closing ticket.

Note: See TracTickets for help on using tickets.