Suppress a reglookup warning
authorNikos Skalkotos <skalkoto@grnet.gr>
Wed, 3 Oct 2012 08:52:00 +0000 (11:52 +0300)
committerNikos Skalkotos <skalkoto@grnet.gr>
Wed, 3 Oct 2012 13:56:23 +0000 (16:56 +0300)
Hundred of warnings like this: `WARN: While quoting value for
'<registry_key>', warning returned: Data could not be interpreted,
quoting raw buffer.' are outputed when reglookup reads the registry
of a Windows 2012 system.

snf-image-helper/tasks/40DisableRemoteDesktopConnections.in

index f905dc7..be964da 100644 (file)
@@ -48,8 +48,12 @@ if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" != "windows" ]; then
     exit 0
 fi
 
+# Supress a specific reglookup warning messages. In Windows 2012, although the
+# command works correct, it polluts the output with hundreds of warning
+# messages about not being able to interprete registry key values.
+RGLKP_WRNG="^WARN: While quoting value for '.\+', warning returned: Data could not be interpreted, quoting raw buffer."
 hive="$SNF_IMAGE_TARGET/Windows/System32/config/SYSTEM"
-current=$($REGLOOKUP "$hive" | grep ^/Select/Current | cut -d, -f3)
+current=$($REGLOOKUP "$hive" 2> >(grep -v "$RGLKP_WRNG" >&2) | grep ^/Select/Current | cut -d, -f3)
 
 # Change the key value.
 # For a stupid reason chntpw returns 2!