mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-05 12:16:41 +02:00
Revert "build_library: retry losetup up to 10 seconds"
This reverts commit ffeca193c0f2936e064b503e85449669ee6b89e2, a8cafdb3, 518f1298, 5bc76098, 06027d67
This commit is contained in:
parent
06027d670f
commit
ab637f03cf
@ -11,7 +11,6 @@ import re
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import uuid
|
||||
|
||||
# First sector we can use.
|
||||
@ -434,24 +433,17 @@ def FormatFat(part, device):
|
||||
def PartitionLoop(options, partition):
|
||||
"""Allocate (and automatically free) loop devices for a partition."""
|
||||
|
||||
attempts = 0
|
||||
loop_dev = ''
|
||||
loop_dev = subprocess.check_output(['sudo', 'losetup',
|
||||
'--offset', str(partition['first_byte']),
|
||||
'--sizelimit', str(partition['bytes']),
|
||||
'--find', '--show', options.disk_image])
|
||||
loop_dev = loop_dev.strip()
|
||||
|
||||
while attempts < 10:
|
||||
try:
|
||||
loop_dev = subprocess.check_output(['sudo', 'losetup',
|
||||
'--offset', str(partition['first_byte']),
|
||||
'--sizelimit', str(partition['bytes']),
|
||||
'--find', '--show', options.disk_image])
|
||||
loop_dev = loop_dev.strip()
|
||||
break
|
||||
except:
|
||||
if loop_dev:
|
||||
Sudo(['losetup', '--detach', loop_dev])
|
||||
attempts += 1
|
||||
time.sleep(1)
|
||||
try:
|
||||
yield loop_dev
|
||||
finally:
|
||||
Sudo(['losetup', '--detach', loop_dev])
|
||||
|
||||
yield loop_dev
|
||||
|
||||
def FormatPartition(options, part):
|
||||
print "Formatting partition %s (%s) as %s" % (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user