diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2007-11-29 11:38:05 -0500 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2007-11-29 11:38:05 -0500 |
commit | 3b49fe8523285b77a7b7805bb3f2e2a4e29a6674 (patch) | |
tree | 751e0459e1e84336a5417e7cf1db766b2925f8ad /cobbler | |
parent | 7305a94610599e118c257b11806fa7bf104c4ced (diff) | |
download | third_party-cobbler-3b49fe8523285b77a7b7805bb3f2e2a4e29a6674.tar.gz third_party-cobbler-3b49fe8523285b77a7b7805bb3f2e2a4e29a6674.tar.xz third_party-cobbler-3b49fe8523285b77a7b7805bb3f2e2a4e29a6674.zip |
Make cobbler commands be more tolerant of casing and synonyms (delete vs remove). Also update docs on set_virt_size to indicate behavior in newer koan.
Diffstat (limited to 'cobbler')
-rw-r--r-- | cobbler/commands.py | 24 | ||||
-rw-r--r-- | cobbler/item_profile.py | 10 |
2 files changed, 25 insertions, 9 deletions
diff --git a/cobbler/commands.py b/cobbler/commands.py index bb801ae..5760b26 100644 --- a/cobbler/commands.py +++ b/cobbler/commands.py @@ -17,7 +17,7 @@ from cexceptions import * from rhpl.translate import _, N_, textdomain, utf8 import sys -HELP_FORMAT = "%-25s%s" +HELP_FORMAT = "%-20s%s" #============================================================= @@ -49,7 +49,7 @@ class FunctionLoader: # if no args given, show all loaded fns if len(args) == 1: return self.show_options() - called_name = args[1] + called_name = args[1].lower() # also show avail options if command name is bogus if not called_name in self.functions.keys(): @@ -70,12 +70,30 @@ class FunctionLoader: def old_school_remap(self,args): """ - Maps commands like: + Replaces commands with common synonyms that should also work + + Also maps commands like: # cobbler system report foo to cobbler report --name=foo to: # cobblerr system report --name=foo + for backwards compat and usability reasons """ + + # to do: handle synonyms + for ct in range(0,len(args)): + args[ct] = args[ct] + if args[ct].startswith("-"): + # stop synonym mapping after first option + break + # lowercase all args + args[ct] = args[ct].lower() + # delete means remove + # are there any other common synonyms? + if args[ct] == "delete": + args[ct] = "remove" + + # special handling for reports follows: if not "report" in args: return args ok = False diff --git a/cobbler/item_profile.py b/cobbler/item_profile.py index 594c5fb..b8aae59 100644 --- a/cobbler/item_profile.py +++ b/cobbler/item_profile.py @@ -205,12 +205,10 @@ class Profile(item.Item): def set_virt_file_size(self,num): """ For Virt only. - Specifies the size of the virt image in gigabytes. koan - may contain some logic to ignore 'illogical' values of this size, - though there are no guarantees. 0 tells koan to just - let it pick a semi-reasonable size. When in doubt, specify the - size you want. - """ + Specifies the size of the virt image in gigabytes. + Older versions of koan (x<0.6.3) interpret 0 as "don't care" + Newer versions (x>=0.6.4) interpret 0 as "no disks" + """ # num is a non-negative integer (0 means default) # can also be a comma seperated list -- for usage with multiple disks |