forked from shaba/openuds
First working (but already non functional) "thin plugin" for thinstation
(and any other linux also ;-) )
This commit is contained in:
parent
29e062ba5d
commit
e257ca0571
@ -133,11 +133,29 @@ if __name__ == "__main__":
|
||||
|
||||
res = getWithRetry(rest, '/{}/{}'.format(ticket, scrambler), params={'hostname': tools.getHostName(), 'version': VERSION})
|
||||
|
||||
logger.debug('Got ticket {}'.format(res))
|
||||
script = res.decode('base64').decode('bz2')
|
||||
|
||||
logger.debug('Script: {}'.format(script))
|
||||
|
||||
six.exec_(script, globals(), {'parent': None})
|
||||
except Exception as e:
|
||||
error = 'ERROR: {}'.format(e)
|
||||
logger.error(error)
|
||||
ui.message('Error', error)
|
||||
sys.exit(2)
|
||||
|
||||
# Finalize
|
||||
try:
|
||||
tools.waitForTasks()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
tools.unlinkFiles()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
tools.execBeforeExit()
|
||||
except Exception:
|
||||
pass
|
||||
|
@ -31,11 +31,19 @@
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
import sys
|
||||
import time
|
||||
from uds.log import logger
|
||||
|
||||
counter = 0
|
||||
|
||||
def message(title, message):
|
||||
sys.stderr.write("** {} **\n {}\n".format(title, message))
|
||||
|
||||
def question(title, message):
|
||||
sys.stderr.write("** {} **\n{}\nReturned YES\n".format(title, message))
|
||||
global counter
|
||||
if counter > 100: # 5 minutes
|
||||
return False
|
||||
counter += 1
|
||||
sys.stderr.write("** {} **\n{}\nReturning YES in 3 seconds. (counter is {})\n".format(title, message, counter))
|
||||
time.sleep(3) # Wait 3 seconds before returning
|
||||
return True
|
||||
|
Loading…
x
Reference in New Issue
Block a user