Imaging scripts fail with variable substitution errors

  • 7007900
  • 15-Feb-2011
  • 27-Apr-2012

Environment

Novell ZENworks 11 Configuration Management Imaging

Situation

Imaging script fails with error similar to that shown below (from prebootlookup.log)
[11/24/10 2:24:15 PM] [I:gBWTD] Bundle type: Preboot Bundle
[11/24/10 2:24:15 PM] [I:gBWTD] The variable substitution for Script bundle failed on the non-registered device:
 
Imaging script contains variables that use braces, or "curly brackets""{}",e.g.,
  var=${ARRAY[$i]}

  if [ ${#WSNAME} -gt 15 ] ; then
 
The same scripts work with ZCM 10.x

Resolution

This is fixed in version 11.1 - see KB 7008746 "ZENworks Configuration Management 11.1 - update information and list of fixes" which can be found at https://www.novell.com/support

With this fix in place, use the format $|variable| to reference ZENworks variables: ${variable} will be left to the bash script to process


Workaround: ensure that "${" does not appear in the script, e.g.,
instead of
  var=${ARRAY[$i]}
use
  var1="\$"
  var2="{ARRAY[\$i]}
  var=`eval echo $var1$var2`
 

Additional Information

The problem arises because ZCM 11 can use ZCM variables in imaging scripts, and they use "${varname}" as the format, which conflicts with the similar structure in bash scripts.