Update 'freenas_network_unlock.py'
This commit is contained in:
@@ -10,7 +10,7 @@ def request(resource, method='GET', data=None):
|
||||
data = ''
|
||||
url = 'https://127.0.0.1/api/v1.0/{}'.format(resource)
|
||||
logging.debug('Request URL: {}'.format(url))
|
||||
logging.debug('Request Data: {}'.format(json.dumps(data)))
|
||||
logging.debug('Request Data: {}'.format(data))
|
||||
logging.debug('CA Certificate Path: {}'.format(config.CA_CERT_PATH))
|
||||
if not config.CA_CERT_PATH:
|
||||
config.CA_CERT_PATH = False
|
||||
@@ -55,7 +55,7 @@ for pool in POOLS['response']:
|
||||
recovery_key = open('/mnt/ramfs/{}.recoveryKey'.format(pool['name']),'rb')
|
||||
recovery_key_binary = recovery_key.read()
|
||||
recovery_key_string = (base64.b64encode(recovery_key_binary)).decode('ascii')
|
||||
response = request('storage/volume/{}/unlock/'.format(pool['name']), 'POST', "{'recovery_key': '{}'.format(recovery_key_string)}")
|
||||
response = request('storage/volume/{}/unlock/'.format(pool['name']), 'POST', {'recovery_key': {}.format(recovery_key_string)})
|
||||
if response['ok']:
|
||||
logging.info('Pool {} was unlocked successfully'.format(pool['name']))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user