Commit 38552c68 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Fix various bugs in snf-image-helper

* In decode-properties.py, use subprocess.Popen method instead of
  subprocess.check_output, which is introduced in python 2.7

* Fix a bug in snf-image-helper where decode-properties.py was not
  properly called

* Fix a bug in FixPartitionTable task
parent 7a474322
......@@ -46,10 +46,11 @@ def main():
for key, value in properties.items():
os.environ['SNF_IMAGE_PROPERTY_' + key] = value
output = StringIO(subprocess.check_output(['bash', '-c', 'set']))
p = subprocess.Popen(['bash', '-c', 'set'], stdout=subprocess.PIPE)
output = StringIO(p.communicate()[0]);
for line in iter(output):
if line.startswith('SNF_IMAGE_PROPERTY_'):
outfh.write(line)
outfh.write('export ' + line)
infh.close()
outfh.close()
......
......@@ -62,8 +62,8 @@ fi
if [ -n "$SNF_IMAGE_PROPERTIES" ]; then
properties=$(mktemp --tmpdir properties.XXXXXX)
add_cleanup rm "$properties"
echo "SNF_IMAGE_PROPERTIES" |
"@scriptsdir@/snf-decode-properties.py" > "$properties"
echo "$SNF_IMAGE_PROPERTIES" |
"@scriptsdir@/decode-properties.py" "$properties"
source "$properties"
else
log_error "SNF_IMAGE_PROPERTIES variable is missing"
......
......@@ -37,12 +37,17 @@ fi
new_pend=$(get_last_free_sector "$SNF_IMAGE_DEV")
#Extend the partition
if [ -z "$new_pend" ] ; then
# Nothing to do
exit 0
fi
# Extend the partition
$PARTED -s -m "$SNF_IMAGE_DEV" rm "$id"
$PARTED -s -m "$SNF_IMAGE_DEV" mkpart primary "$ptype" "$pstart" "$new_pend"
#inform the kernel about the changes
# Inform the kernel about the changes
partprobe "$SNF_IMAGE_DEV"
exit 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment