summaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/mic')
-rw-r--r--scripts/lib/mic/imager/baseimager.py28
-rw-r--r--scripts/lib/mic/imager/direct.py2
2 files changed, 7 insertions, 23 deletions
diff --git a/scripts/lib/mic/imager/baseimager.py b/scripts/lib/mic/imager/baseimager.py
index 7f32dd559e..23919d4cfa 100644
--- a/scripts/lib/mic/imager/baseimager.py
+++ b/scripts/lib/mic/imager/baseimager.py
@@ -109,12 +109,11 @@ class BaseImageCreator(object):
109 """ 109 """
110 pass 110 pass
111 111
112 def _unmount_instroot(self): 112 def _cleanup(self):
113 """Undo anything performed in _mount_instroot(). 113 """Undo anything performed in _create().
114 114
115 This is the hook where subclasses must undo anything which was done 115 This is the hook where subclasses must undo anything which was
116 in _mount_instroot(). For example, if a filesystem image was mounted 116 done in _create().
117 onto _instroot, it should be unmounted here.
118 117
119 There is no default implementation. 118 There is no default implementation.
120 119
@@ -161,23 +160,8 @@ class BaseImageCreator(object):
161 160
162 self._create() 161 self._create()
163 162
164 def unmount(self):
165 """Unmounts the target filesystem.
166
167 The ImageCreator class detaches the system from the install root, but
168 other subclasses may also detach the loopback mounted filesystem image
169 from the install root.
170
171 """
172 self._unmount_instroot()
173
174
175 def cleanup(self): 163 def cleanup(self):
176 """Unmounts the target filesystem and deletes temporary files. 164 """Undo anything performed in create().
177
178 This method calls unmount() and then deletes any temporary files and
179 directories that were created on the host system while building the
180 image.
181 165
182 Note, make sure to call this method once finished with the creator 166 Note, make sure to call this method once finished with the creator
183 instance in order to ensure no stale files are left on the host e.g.: 167 instance in order to ensure no stale files are left on the host e.g.:
@@ -192,7 +176,7 @@ class BaseImageCreator(object):
192 if not self.__builddir: 176 if not self.__builddir:
193 return 177 return
194 178
195 self.unmount() 179 self._cleanup()
196 180
197 shutil.rmtree(self.__builddir, ignore_errors = True) 181 shutil.rmtree(self.__builddir, ignore_errors = True)
198 self.__builddir = None 182 self.__builddir = None
diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index b96740d0f4..91f64d52cf 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -354,7 +354,7 @@ class DirectImageCreator(BaseImageCreator):
354 354
355 return (rootdev, root_part_uuid) 355 return (rootdev, root_part_uuid)
356 356
357 def _unmount_instroot(self): 357 def _cleanup(self):
358 if not self.__instimage is None: 358 if not self.__instimage is None:
359 try: 359 try:
360 self.__instimage.cleanup() 360 self.__instimage.cleanup()