diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2015-04-08 15:47:02 +0200 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2015-04-08 19:56:25 +0200 |
commit | ae8eec484f07a92cac7d5462769873ad6af980e3 (patch) | |
tree | e9bdfd70791c1f9f199e51469620456a9cbf031b /utils_cib.py | |
parent | f0858f39adcb99f349eef5b9ebd2ec5b29bdb4f5 (diff) | |
download | clufter-ae8eec484f07a92cac7d5462769873ad6af980e3.tar.gz clufter-ae8eec484f07a92cac7d5462769873ad6af980e3.tar.xz clufter-ae8eec484f07a92cac7d5462769873ad6af980e3.zip |
utils_cib: make rg2hb_xsl a bit more versatile
...avoid repeating the same argument if dst and src params are
identical, if src is not defined, it derives value of dst automatically.
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'utils_cib.py')
-rw-r--r-- | utils_cib.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/utils_cib.py b/utils_cib.py index 76a5012..b26c186 100644 --- a/utils_cib.py +++ b/utils_cib.py @@ -1,5 +1,5 @@ # -*- coding: UTF-8 -*- -# Copyright 2014 Red Hat, Inc. +# Copyright 2015 Red Hat, Inc. # Part of clufter project # Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt) """CIB helpers, mainly used in the filter definitions""" @@ -64,13 +64,17 @@ class ResourceSpec(object): return ret -def rg2hb_xsl(dst, src, req=False, op=False): +def rg2hb_xsl(dst, src=None, req=False, op=False): """Emit XSL snippet yielding nvpair-encoded HB RA parameter from RG one Parameters: + dst destination parameter (name in the nvpair) + src source parameter (if not provided, use dst ~ 1:1 match) req valid values: False, True, abs (use raw `src` instead) + op whether this is relevant for "operations" section """ assert req in (False, True, abs), "Invalid `req` param" + src = src or dst return (('''\ <xsl:if test="@{src}"> ''' if not req else '') + (('''\ |