BIND 10 trac2713, updated. 7f486337fadd80b4529e927bed9ed809f8658cdf [2713] Update manpage

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Feb 21 15:14:16 UTC 2013


The branch, trac2713 has been updated
       via  7f486337fadd80b4529e927bed9ed809f8658cdf (commit)
      from  cdb634f118607f9730c7218cc15773fb35a7309a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7f486337fadd80b4529e927bed9ed809f8658cdf
Author: Jelte Jansen <jelte at isc.org>
Date:   Thu Feb 21 16:13:52 2013 +0100

    [2713] Update manpage
    
    Also replaced 'action' with 'command' (the first argument)

-----------------------------------------------------------------------

Summary of changes:
 src/bin/usermgr/b10-cmdctl-usermgr.py.in         |   36 +++++++++----------
 src/bin/usermgr/b10-cmdctl-usermgr.xml           |   41 +++++++++++++---------
 src/bin/usermgr/tests/b10-cmdctl-usermgr_test.py |   12 +++----
 3 files changed, 49 insertions(+), 40 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/usermgr/b10-cmdctl-usermgr.py.in b/src/bin/usermgr/b10-cmdctl-usermgr.py.in
index 33b3101..5a0eb20 100644
--- a/src/bin/usermgr/b10-cmdctl-usermgr.py.in
+++ b/src/bin/usermgr/b10-cmdctl-usermgr.py.in
@@ -11,8 +11,8 @@
 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
 # INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
-# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN COMMAND OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS COMMAND, ARISING OUT OF OR IN CONNECTION
 # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 '''
@@ -36,8 +36,8 @@ DEFAULT_FILE = SYSCONFPATH + "/cmdctl-accounts.csv"
 
 # Actions that can be performed (used for argument parsing,
 # code paths, and output)
-ACTION_ADD = "add"
-ACTION_DELETE = "delete"
+COMMAND_ADD = "add"
+COMMAND_DELETE = "delete"
 
 # Non-zero return codes, used in tests
 BAD_ARGUMENTS = 1
@@ -124,18 +124,18 @@ class UserManager:
         self.user_info = new_user_info
         return True
 
-    def prompt_for_username(self, action):
+    def prompt_for_username(self, command):
         # Note, direct prints here are intentional
         while True :
-            name = input("Username to " + action + ": ")
+            name = input("Username to " + command + ": ")
             if name == "":
                 print("Error username can't be empty")
                 continue
 
-            if action == ACTION_ADD and self.username_exists(name):
+            if command == COMMAND_ADD and self.username_exists(name):
                  print("user already exists")
                  continue
-            elif action == ACTION_DELETE and not self.username_exists(name):
+            elif command == COMMAND_DELETE and not self.username_exists(name):
                  print("user does not exist")
                  continue
 
@@ -160,15 +160,15 @@ class UserManager:
         Returns False if there is a problem, True if everything seems OK.
         """
         if len(self.args) < 1:
-            self.print("Error: must specify an action")
+            self.print("Error: no command specified")
             return False
         if len(self.args) > 3:
             self.print("Error: extraneous arguments")
             return False
-        if self.args[0] not in [ ACTION_ADD, ACTION_DELETE ]:
-            self.print("Error: action must be either add or delete")
+        if self.args[0] not in [ COMMAND_ADD, COMMAND_DELETE ]:
+            self.print("Error: command must be either add or delete")
             return False
-        if self.args[0] == ACTION_DELETE and len(self.args) > 2:
+        if self.args[0] == COMMAND_DELETE and len(self.args) > 2:
             self.print("Error: delete only needs username, not a password")
             return False
         return True
@@ -181,14 +181,14 @@ class UserManager:
             self.print("Using accounts file: " + self.options.output_file)
             self.read_user_info()
 
-            action = self.args[0]
+            command = self.args[0]
 
             if len(self.args) > 1:
                 username = self.args[1]
             else:
-                username = self.prompt_for_username(action)
+                username = self.prompt_for_username(command)
 
-            if action == ACTION_ADD:
+            if command == COMMAND_ADD:
                 if len(self.args) > 2:
                     password = self.args[2]
                 else:
@@ -196,7 +196,7 @@ class UserManager:
                 if not self.add_user(username, password):
                     print("Error: username exists")
                     return USER_EXISTS
-            elif action == ACTION_DELETE:
+            elif command == COMMAND_DELETE:
                 if not self.delete_user(username):
                     print("Error: username does not exist")
                     return USER_DOES_NOT_EXIST
@@ -219,9 +219,9 @@ def set_options(parser):
                      )
 
 def main():
-    usage = "usage: %prog [options] <action> [username] [password]\n\n"\
+    usage = "usage: %prog [options] <command> [username] [password]\n\n"\
             "Arguments:\n"\
-            "  action\t\teither 'add' or 'delete'\n"\
+            "  command\t\teither 'add' or 'delete'\n"\
             "  username\t\tthe username to add or delete\n"\
             "  password\t\tthe password to set for the added user\n"\
             "\n"\
diff --git a/src/bin/usermgr/b10-cmdctl-usermgr.xml b/src/bin/usermgr/b10-cmdctl-usermgr.xml
index 529a8db..e05c994 100644
--- a/src/bin/usermgr/b10-cmdctl-usermgr.xml
+++ b/src/bin/usermgr/b10-cmdctl-usermgr.xml
@@ -12,8 +12,8 @@
  - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  - AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN COMMAND OF CONTRACT, NEGLIGENCE
+ - OR OTHER TORTIOUS COMMAND, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  - PERFORMANCE OF THIS SOFTWARE.
 -->
 
@@ -47,10 +47,12 @@
 
       <arg><option>-f <replaceable>filename</replaceable></option></arg>
       <arg><option>-h</option></arg>
-      <arg><option>-v</option></arg>
-      <arg><option>--file <replaceable>filename</replaceable></option></arg>
+      <arg><option>--file=<replaceable>filename</replaceable></option></arg>
       <arg><option>--help</option></arg>
       <arg><option>--version</option></arg>
+      <arg choice="plain"><replaceable>command</replaceable></arg>
+      <arg><option>username</option></arg>
+      <arg><option>password</option></arg>
 
     </cmdsynopsis>
   </refsynopsisdiv>
@@ -58,24 +60,22 @@
   <refsect1>
     <title>DESCRIPTION</title>
     <para>The <command>b10-cmdctl-usermgr</command> tool may be used
-      to add accounts with passwords for the
+      to add and remove accounts with passwords for the
       <citerefentry><refentrytitle>b10-cmdctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>
       daemon.
     </para>
 
     <para>
       By default, the accounts are saved in the
-      <filename>cmdctl-accounts.csv</filename> file in the current directory,
-      unless the <option>--filename</option> switch is used.
-      The entry is appended to the file.
-<!-- TODO: default should have full path? -->
+      <filename>cmdctl-accounts.csv</filename> file in the system config
+      directory, unless the <option>--filename</option> switch is used.
+      The entry is appended to or removed from the file.
     </para>
 
     <para>
-      The tool can't remove or replace existing entries.
+      The tool can't replace existing entries, but this can easily be
+      accomplished by removing the entry and adding a new one.
     </para>
-<!-- TODO: the tool can't remove or replace existing entries -->
-
   </refsect1>
 
   <refsect1>
@@ -83,6 +83,16 @@
 
     <para>The arguments are as follows:</para>
 
+    <para>
+      command is either 'add' or 'delete', respectively to add or delete users.
+    </para>
+
+    <para>
+      If a username and password are given (or just a username in case of
+      deletion), these are used. Otherwise, the tool shall prompt for a
+      username and/or password.
+    </para>
+
     <variablelist>
 
       <varlistentry>
@@ -97,14 +107,13 @@
         <term><option>-f <replaceable>filename</replaceable></option></term>
         <term><option>--file <replaceable>filename</replaceable></option></term>
         <listitem><para>
-          Define the filename to append the account to. The default
-          is <filename>cmdctl-accounts.csv</filename> in the current directory.
-<!-- TODO: default should have full path? -->
+          Define the filename to append the account to. The default is
+          <filename>cmdctl-accounts.csv</filename> in the system config
+          directory.
         </para></listitem>
       </varlistentry>
 
       <varlistentry>
-        <term><option>-v</option></term>
         <term><option>--version</option></term>
         <listitem><para>
           Report the version and exit.
diff --git a/src/bin/usermgr/tests/b10-cmdctl-usermgr_test.py b/src/bin/usermgr/tests/b10-cmdctl-usermgr_test.py
index 1bbbe81..145d897 100644
--- a/src/bin/usermgr/tests/b10-cmdctl-usermgr_test.py
+++ b/src/bin/usermgr/tests/b10-cmdctl-usermgr_test.py
@@ -9,8 +9,8 @@
 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
 # INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
-# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN COMMAND OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS COMMAND, ARISING OUT OF OR IN CONNECTION
 # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 import csv
@@ -91,10 +91,10 @@ class TestUserMgr(unittest.TestCase):
 
     def test_help(self):
         self.run_check(0,
-'''Usage: b10-cmdctl-usermgr [options] <action> [username] [password]
+'''Usage: b10-cmdctl-usermgr [options] <command> [username] [password]
 
 Arguments:
-  action		either 'add' or 'delete'
+  command		either 'add' or 'delete'
   username		the username to add or delete
   password		the password to set for the added user
 
@@ -205,11 +205,11 @@ Options:
         Assorted tests with bad command-line arguments
         """
         self.run_check(1,
-                       'Error: must specify an action\n',
+                       'Error: no command specified\n',
                        '',
                        [ self.TOOL ])
         self.run_check(1,
-                       'Error: action must be either add or delete\n',
+                       'Error: command must be either add or delete\n',
                        '',
                        [ self.TOOL, 'foo' ])
         self.run_check(1,



More information about the bind10-changes mailing list