hgwebfs: keep trying as long as we get needkey response
This commit is contained in:
parent
6651be7516
commit
9f2c7606ab
1 changed files with 14 additions and 12 deletions
|
@ -6,20 +6,22 @@ import os
|
||||||
|
|
||||||
class Webconn:
|
class Webconn:
|
||||||
def __init__(self, mnt, req):
|
def __init__(self, mnt, req):
|
||||||
try:
|
loop = True
|
||||||
self.open(mnt, req)
|
while loop:
|
||||||
except IOError, e:
|
loop = False
|
||||||
try:
|
try:
|
||||||
errstr = e.strerror
|
|
||||||
params = errstr[errstr.index("needkey ")+8:]
|
|
||||||
if params.find("!password?") < 0:
|
|
||||||
raise e
|
|
||||||
if os.spawnl(os.P_WAIT, "/boot/factotum", "getkey", "-g", params) != 0:
|
|
||||||
raise e
|
|
||||||
self.open(mnt, req)
|
self.open(mnt, req)
|
||||||
return
|
except IOError, e:
|
||||||
except:
|
try:
|
||||||
raise e
|
errstr = e.strerror
|
||||||
|
params = errstr[errstr.index("needkey ")+8:]
|
||||||
|
if params.find("!password?") < 0:
|
||||||
|
raise e
|
||||||
|
if os.spawnl(os.P_WAIT, "/boot/factotum", "getkey", "-g", params) != 0:
|
||||||
|
raise e
|
||||||
|
loop = True
|
||||||
|
except:
|
||||||
|
raise e
|
||||||
|
|
||||||
def open(self, mnt, req):
|
def open(self, mnt, req):
|
||||||
if type(req) == str:
|
if type(req) == str:
|
||||||
|
|
Loading…
Reference in a new issue