MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / eject

Method eject

src/astroprint/externaldrive/linux.py:195–217  ·  view source on GitHub ↗
(self, mountPath)

Source from the content-addressed store, hash-verified

193 self.stopThread = True
194
195 def eject(self, mountPath):
196
197 retries = 5
198 timeout = 3
199
200 ejected = False
201
202 for i in (0,retries):
203 if self._umountPartition(mountPath):
204 ejected = True
205 else:
206 time.sleep(timeout)
207
208 if ejected:
209 self._eventManager.fire( Events.EXTERNAL_DRIVE_EJECTED, {
210 "mount_path": mountPath
211 })
212 return {'result': True}
213
214 return {
215 'result': False,
216 'error': "Unable to eject"
217 }

Callers

nothing calls this directly

Calls 2

_umountPartitionMethod · 0.95
fireMethod · 0.80

Tested by

no test coverage detected