diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2007-11-27 17:16:27 -0500 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2007-11-27 17:16:27 -0500 |
commit | cb02309cc41fbae69e3ff3efcb3e3feb763189ff (patch) | |
tree | 2d0efcd9120408d75c376e2b663bc3eb29a6e11e /cobbler/modules/cli_system.py | |
parent | 035fa440a9b40b079d81a5cb1b46114cdabd0462 (diff) | |
download | third_party-cobbler-cb02309cc41fbae69e3ff3efcb3e3feb763189ff.tar.gz third_party-cobbler-cb02309cc41fbae69e3ff3efcb3e3feb763189ff.tar.xz third_party-cobbler-cb02309cc41fbae69e3ff3efcb3e3feb763189ff.zip |
Changes to make "cobbler ___ report [___]" and "cobbler ___ list" work like they used to, which means adding a few subcommands, abstracting away the list logic, and writing some minor code to make the trailing names look like --name=x to please optparse.
Diffstat (limited to 'cobbler/modules/cli_system.py')
-rw-r--r-- | cobbler/modules/cli_system.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/cobbler/modules/cli_system.py b/cobbler/modules/cli_system.py index 1e39669..dc7e6bc 100644 --- a/cobbler/modules/cli_system.py +++ b/cobbler/modules/cli_system.py @@ -27,17 +27,17 @@ import cexceptions class SystemFunction(commands.CobblerFunction): def help_me(self): - return commands.HELP_FORMAT % ("cobbler system","<add|edit|copy|rename|remove> [ARGS|--help]") + return commands.HELP_FORMAT % ("cobbler system","<add|edit|copy|list|rename|remove|report> [ARGS|--help]") def command_name(self): return "system" def subcommands(self): - return [ "add", "edit", "copy", "rename", "remove" ] - + return [ "add", "edit", "copy", "rename", "remove", "report", "list" ] def add_options(self, p, args): - if not "remove" in args: + + if not self.matches_args(args,["remove","report","list"]): p.add_option("--dhcp-tag", dest="dhcp_tag", help="for use in advanced DHCP configurations") p.add_option("--gateway", dest="gateway", help="for static IP / templating usage") p.add_option("--hostname", dest="hostname", help="ex: server.example.org") @@ -46,12 +46,16 @@ class SystemFunction(commands.CobblerFunction): p.add_option("--kopts", dest="kopts", help="ex: 'noipv6'") p.add_option("--ksmeta", dest="ksmeta", help="ex: 'blippy=7'") p.add_option("--mac", dest="mac", help="ex: 'AA:BB:CC:DD:EE:FF', (RECOMMENDED)") + p.add_option("--name", dest="name", help="a name for the system (REQUIRED)") - if not "remove" in args: + + if not self.matches_args(args,["remove","report","list"]): p.add_option("--netboot-enabled", dest="netboot_enabled", help="PXE on (1) or off (0)") - if "copy" in args or "rename" in args: + + if self.matches_args(args,["copy","rename"]): p.add_option("--newname", dest="newname", help="for use with copy/edit") - if not "remove" in args: + + if not self.matches_args(args,["remove","report","list"]): p.add_option("--profile", dest="profile", help="name of cobbler profile (REQUIRED)") p.add_option("--server-override", dest="server_override", help="overrides server value in settings file") p.add_option("--subnet", dest="subnet", help="for static IP / templating usage") |