From 728aecbcacc76527051f5df0b4d578c9edab4f0f Mon Sep 17 00:00:00 2001 From: Jan Pokorný Date: Wed, 2 Sep 2015 23:33:56 +0200 Subject: utils_cib: also support deprecated params in rg2hb_xsl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Pokorný --- utils_cib.py | 18 ++++++++++++------ 1 file 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 (('''\ -''' if not req else '') + (('''\ +''' if not req else '') + ('''\ + WARNING: parameter/op {dst} (converted from {src}) is now deprecated +''' if deprecated else '') + (('''\