Code review comment for lp:~jtv/maas/q-pkg-bug-1086239

Revision history for this message
Scott Moser (smoser) wrote :

I think there is a functional bug here. You are storing a value of CLUSTER_UUID in /etc/maas/maas_local_celeryconfig_cluster.py (line 86) formated like:
CLUSTER_UUID = '<value>'

However, reading that value will fail because you have a inconsistency between the regex given to sed and grep. Instead of outputing <value>, extract_cluster_uuid will output
  CLUSTER_UUID = '<value>'

The easiest solution I think is to just ditch the use of grep entirely and use 'sed -n'.

extract_cfg_value() {
   # extract the value for a variable named $1 from a
   # simplistic formatted shell or python file ($2)
   sed -n -e "s/^$1 *= *[\"']\{0,1\}\([^\"']*\).*/\1/p" "$2"
}
extract_cluster_uuid() { extract_cfg_value CLUSTER_UUID "$1"; }

review: Needs Fixing

« Back to merge proposal