summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-09-02 23:33:56 +0200
committerJan Pokorný <jpokorny@redhat.com>2015-09-02 23:54:28 +0200
commit728aecbcacc76527051f5df0b4d578c9edab4f0f (patch)
treee9262976a5b6150ab71c4a70d203aaf2fcfb6ca1
parentb4284610f4d5d107cbcc7876cd45ce396904716a (diff)
downloadclufter-728aecbcacc76527051f5df0b4d578c9edab4f0f.tar.gz
clufter-728aecbcacc76527051f5df0b4d578c9edab4f0f.tar.xz
clufter-728aecbcacc76527051f5df0b4d578c9edab4f0f.zip
utils_cib: also support deprecated params in rg2hb_xsl
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--utils_cib.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/utils_cib.py b/utils_cib.py
index aae3d26..9a744f3 100644
--- a/utils_cib.py
+++ b/utils_cib.py
@@ -72,16 +72,22 @@ 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
+ 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),
+ or Warning (deprecated paramater, implies False
+ and emitted warning [thus the literal object])
+ op whether this is relevant for "operations" section
"""
- assert req in (False, True, abs), "Invalid `req` param"
+ assert req in (False, True, abs, Warning), "Invalid `req` param"
src = src or dst
+ deprecated, req = (True, False) if req is Warning else (False, req)
return (('''\
<xsl:if test="@{src}">
-''' if not req else '') + (('''\
+''' if not req else '') + ('''\
+ <xsl:message
+ >WARNING: parameter/op {dst} (converted from {src}) is now deprecated</xsl:message>
+''' if deprecated else '') + (('''\
<!-- {dst} ~ {src} -->
<nvpair id="{{concat($Prefix, '-ATTRS-{dst}')}}"
name="{dst}"