diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2008-05-14 16:15:21 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2008-05-14 16:15:21 -0400 |
commit | 7b6922a1da2654874d14ba97340e95ab88eff202 (patch) | |
tree | 35a2b2c0a03a37b87c8e37d8a3956736fd5e4bad /cobbler | |
parent | 9d5b494aaac2d2b0be4b598d6049eb869ef4b49c (diff) | |
download | third_party-cobbler-7b6922a1da2654874d14ba97340e95ab88eff202.tar.gz third_party-cobbler-7b6922a1da2654874d14ba97340e95ab88eff202.tar.xz third_party-cobbler-7b6922a1da2654874d14ba97340e95ab88eff202.zip |
Added the ability to undefine a symbol that is defined in a parent object.
This means that if a kernel option is set for a profile, and you want it unset
in a child system, you can say --kopts='!foo' to undefine the foo. Similarly you
can add symbols and undefine others at the same time... --kopts='bar !foo baz=3' and
so on.
This is relatively fringe usage but was previously not possible.
Diffstat (limited to 'cobbler')
-rw-r--r-- | cobbler/utils.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cobbler/utils.py b/cobbler/utils.py index 007b96c..455a7e3 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -446,6 +446,24 @@ def __consolidate(node,results): else: results[field] = data_item + # now if we have any "!foo" results in the list, delete corresponding + # key entry "foo", and also the entry "!foo", allowing for removal + # of kernel options set in a distro later in a profile, etc. + + hash_removals(results,"kernel_options") + hash_removals(results,"ks_meta") + +def hash_removals(results,subkey): + if not results.has_key(subkey): + return + scan = results[subkey].keys() + for k in scan: + if k.startswith("!") and k != "!": + remove_me = k[1:] + if results[subkey].has_key(remove_me): + del results[subkey][remove_me] + del results[subkey][k] + def hash_to_string(hash): """ Convert a hash to a printable string. |