From: Jelte Jansen Date: Thu, 21 Feb 2013 15:13:52 +0000 (+0100) Subject: [2713] Update manpage X-Git-Tag: bind10-1.1.0beta1-release~68^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f486337fadd80b4529e927bed9ed809f8658cdf;p=thirdparty%2Fkea.git [2713] Update manpage Also replaced 'action' with 'command' (the first argument) --- diff --git a/src/bin/usermgr/b10-cmdctl-usermgr.py.in b/src/bin/usermgr/b10-cmdctl-usermgr.py.in index 33b31014c8..5a0eb20d3c 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] [username] [password]\n\n"\ + usage = "usage: %prog [options] [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 529a8db4b7..e05c994454 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 @@ - - + + command + + @@ -58,24 +60,22 @@ DESCRIPTION The b10-cmdctl-usermgr tool may be used - to add accounts with passwords for the + to add and remove accounts with passwords for the b10-cmdctl8 daemon. By default, the accounts are saved in the - cmdctl-accounts.csv file in the current directory, - unless the switch is used. - The entry is appended to the file. - + cmdctl-accounts.csv file in the system config + directory, unless the switch is used. + The entry is appended to or removed from the file. - 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. - - @@ -83,6 +83,16 @@ The arguments are as follows: + + command is either 'add' or 'delete', respectively to add or delete users. + + + + 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. + + @@ -97,14 +107,13 @@ - Define the filename to append the account to. The default - is cmdctl-accounts.csv in the current directory. - + Define the filename to append the account to. The default is + cmdctl-accounts.csv in the system config + directory. - 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 1bbbe81a7b..145d897a86 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] [username] [password] +'''Usage: b10-cmdctl-usermgr [options] [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,