summaryrefslogtreecommitdiff
path: root/morphlib/exts/openstack.write
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/exts/openstack.write')
-rwxr-xr-xmorphlib/exts/openstack.write6
1 files changed, 1 insertions, 5 deletions
diff --git a/morphlib/exts/openstack.write b/morphlib/exts/openstack.write
index 516fe367..b1941d3c 100755
--- a/morphlib/exts/openstack.write
+++ b/morphlib/exts/openstack.write
@@ -79,8 +79,7 @@ class OpenStackWriteExtension(morphlib.writeexts.WriteExtension):
def set_extlinux_root_to_virtio(self, raw_disk):
'''Re-configures extlinux to use virtio disks'''
self.status(msg='Updating extlinux.conf')
- mp = self.mount(raw_disk)
- try:
+ with self.mount(raw_disk) as mp:
path = os.path.join(mp, 'extlinux.conf')
with open(path) as f:
@@ -91,9 +90,6 @@ class OpenStackWriteExtension(morphlib.writeexts.WriteExtension):
with open(path, "w") as f:
f.write(extlinux_conf)
- finally:
- self.unmount(mp)
-
def get_openstack_parameters(self):
'''Get the environment variables needed.