From 017990467588ec81732d57c10607ed5403e1a986 Mon Sep 17 00:00:00 2001
From: Daniel Heule <hda@sfs.biz>
Date: Tue, 22 Mar 2016 11:01:19 +0100
Subject: [PATCH 1/2] bugfix for newer zypper (SLES12SP1) releases, different
 column numbers in output

---
 cdist/conf/type/__zypper_service/explorer/service_uri | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cdist/conf/type/__zypper_service/explorer/service_uri b/cdist/conf/type/__zypper_service/explorer/service_uri
index bcad4ec8..d57d2aa8 100644
--- a/cdist/conf/type/__zypper_service/explorer/service_uri
+++ b/cdist/conf/type/__zypper_service/explorer/service_uri
@@ -27,4 +27,4 @@ else
 fi
 # simpler command which works only on SLES11 SP3 or newer:
 # echo $(zypper ls -u -E | grep -E "\<$uri\>" | cut -d'|' -f 7)
-echo $(zypper ls -u | grep -E '^([^|]+\|){3,3} Yes' | grep -E "\<$uri\>" | cut -d'|' -f 7 )
+echo $(zypper ls -u | grep -E '^([^|]+\|){3,3} Yes' | grep -E "\<$uri\>" | awk '{print $NF}')

From d3a0bd20c0b14cb129f2bc7f0e55d2069bc5a5d3 Mon Sep 17 00:00:00 2001
From: Daniel Heule <hda@sfs.biz>
Date: Thu, 24 Mar 2016 10:58:14 +0100
Subject: [PATCH 2/2] replace egrep with awk functions

---
 cdist/conf/type/__zypper_service/explorer/service_uri | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/cdist/conf/type/__zypper_service/explorer/service_uri b/cdist/conf/type/__zypper_service/explorer/service_uri
index d57d2aa8..6eee47fb 100644
--- a/cdist/conf/type/__zypper_service/explorer/service_uri
+++ b/cdist/conf/type/__zypper_service/explorer/service_uri
@@ -25,6 +25,4 @@ if [ -f "$__object/parameter/uri" ]; then
 else
    uri="/$__object_id"
 fi
-# simpler command which works only on SLES11 SP3 or newer:
-# echo $(zypper ls -u -E | grep -E "\<$uri\>" | cut -d'|' -f 7)
-echo $(zypper ls -u | grep -E '^([^|]+\|){3,3} Yes' | grep -E "\<$uri\>" | awk '{print $NF}')
+echo $(zypper ls -u | awk 'BEGIN { FS = "[ ]+\\|[ ]+" } ; $4 == "Yes" && $NF == "'$uri'" {print $NF}')