Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions vol
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ toList = list
def run(cmd, **kw):
try:
command = ['sudo'] + cmd if kw.get('sudo') else cmd
options = {'capture_output': True, 'text': True, 'check': True} | {k:kw[k] for k in kw if k != 'sudo'}
options = {'capture_output': True, 'text': True, 'check': True} | {k: kw[k] for k in kw if k != 'sudo'}
return subprocess.run(command, **options)
except subprocess.CalledProcessError as e:
err(text = f'Command {cmd} failed with exit status {e.returncode}:\n{e.stderr}')
Expand Down Expand Up @@ -402,6 +402,7 @@ def wait_for_volume(volume, valid_states = ['available'], wait_states = [], time
valid_states_str = ', '.join(valid_states)

if volume_state in valid_states:
dbg(f'{get_volume_desc(volume).capitalize()} reached valid state {volume_state}')
return volume
Comment thread
wknapik marked this conversation as resolved.
Resolved
elif volume_state in wait_states:
if timeout_sec <= 0:
Expand Down Expand Up @@ -587,12 +588,15 @@ def mount(volume_id, mountpoint, fstype):

def umount(mountpoint, force = False):
msg(f'Unmounting {mountpoint}')
match system():
case 'Darwin':
maybe_force = ['force'] if force else []
run(['diskutil', 'umount'] + maybe_force + [mountpoint], sudo=not is_mac_admin())
case _:
run(['umount', mountpoint], sudo=True)
if ismount(mountpoint):
match system():
case 'Darwin':
maybe_force = ['force'] if force else []
run(['diskutil', 'umount'] + maybe_force + [mountpoint], sudo=not is_mac_admin())
case _:
run(['umount', mountpoint], sudo=True)
else:
msg(f'Path {mountpoint} is not a mountpoint, nothing to do')

def instance_and_az_match(instance_id, availability_zone):
if instance_id and availability_zone:
Expand Down
Loading