Blob Blame History Raw
From c0f9207b474ffa4c68151f6351434da51c49cb84 Mon Sep 17 00:00:00 2001
From: Martin Wilck <martin.wilck@ts.fujitsu.com>
Date: Mon, 18 Nov 2013 12:35:15 +0100
Subject: [PATCH] transform STP value from "yes/no" to "on/off" in
 redhat-put.xsl

https://bugzilla.redhat.com/show_bug.cgi?id=1060076
https://bugzilla.redhat.com/show_bug.cgi?id=1031053

Some tools (e.g. NetworkManager) use "yes"/"no" in config files
rather than "on/off". netcf needs to transform this in order to conform
with the schema.

(cherry picked from commit 048d13afcc91f4a16a80012aa34b9a024d95368e)
---
 AUTHORS                 |  1 +
 data/xml/redhat-put.xsl | 12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/AUTHORS b/AUTHORS
index 2512ac8..f38e939 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -20,3 +20,4 @@ Contributions by:
   Ed Maste         <emaste@freebsd.org>
   Hendrik Schwartke <hendrik@os-t.de>
   Satoru SATOH     <ssato@redhat.com>
+  Martin Wilck     <martin.wilck@ts.fujitsu.com>
diff --git a/data/xml/redhat-put.xsl b/data/xml/redhat-put.xsl
index 267d9cd..88e6d73 100644
--- a/data/xml/redhat-put.xsl
+++ b/data/xml/redhat-put.xsl
@@ -77,7 +77,17 @@
       <xsl:call-template name="interface-addressing"/>
       <bridge>
         <xsl:if test="node[@label = 'STP']">
-          <xsl:attribute name="stp"><xsl:value-of select="node[@label = 'STP']/@value"/></xsl:attribute>
+          <xsl:choose>
+            <xsl:when test="node[@label = 'STP']/@value = 'yes'">
+              <xsl:attribute name="stp">on</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="node[@label = 'STP']/@value = 'no'">
+              <xsl:attribute name="stp">off</xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="stp"><xsl:value-of select="node[@label = 'STP']/@value"/></xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose>
         </xsl:if>
         <xsl:if test="node[@label = 'DELAY']">
           <xsl:attribute name="delay"><xsl:value-of select="node[@label = 'DELAY']/@value"/></xsl:attribute>
-- 
1.8.3.1