mirror of
https://github.com/flatcar/scripts.git
synced 2026-04-28 00:41:24 +02:00
build_library: break the attempt loop when losetup succeeds
We need to break the attempt loop when losetup succeeds. Also we should not use finally, which is called also for success.
This commit is contained in:
parent
518f12983f
commit
5bc76098a5
@ -444,11 +444,11 @@ def PartitionLoop(options, partition):
|
||||
'--sizelimit', str(partition['bytes']),
|
||||
'--find', '--show', options.disk_image])
|
||||
loop_dev = loop_dev.strip()
|
||||
break
|
||||
except:
|
||||
Sudo(['losetup', '--detach', loop_dev])
|
||||
attempts += 1
|
||||
time.sleep(1)
|
||||
finally:
|
||||
Sudo(['losetup', '--detach', loop_dev])
|
||||
|
||||
yield loop_dev
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user