Eject drive & script fix

master
c.soylu 2 years ago
parent 51428ec602
commit c541e78394

@ -39,9 +39,7 @@ if meta_data_path != "False":
for mac in macs:
name = get_name_by_mac(mac)
activate_dhcp(name, family)
sys.exit(1001)
else:
sys.exit(0)

@ -1,10 +1,13 @@
import os
import shutil
import ctypes
import sys
def remove_drive():
drive_letter = os.popen('wmic logicaldisk where VolumeName="config-2" get Caption | findstr /I ":"').read()
if drive_letter:
LOG.debug('Eject metadata drive: %s', str(drive_letter).rstrip())
ctypes.windll.WINMM.mciSendStringW(u"open " + str(drive_letter).rstrip() + " type cdaudio alias d_drive", None, 0, None)
ctypes.windll.WINMM.mciSendStringW(u"set d_drive door open", None, 0, None)
remove_drive()
sys.exit(0)
Loading…
Cancel
Save