Update 'freenas_network_unlock.py'

This commit is contained in:
2019-11-12 11:00:07 -05:00
parent 9873c70aa1
commit b3b634fa3c

View File

@@ -53,13 +53,14 @@ POOLS = request('storage/volume/', 'GET')
for pool in POOLS:
if pool['is_decrypted'] == False:
logging.info('Pool {} is locked'.format(pool['name']))
response = requests.post(
'https://{}/api/v1.0/storage/volume/{}/unlock/'.format(config.HOSTNAME,pool['name']),
json={'passphrase': '{}'.format(config.POOLS[pool['name']])},
auth=('root', '{}'.format(config.ROOT_PASSWORD)),
verify='{}'.format(config.CA_CERT_PATH),
)
if response.status_code:
response = request('storage/volume/{}/unlock/'.format(pool['name']), 'POST', {'passphrase': '{}'.format(config.POOLS[pool['name']])})
#response = requests.post(
# 'https://{}/api/v1.0/storage/volume/{}/unlock/'.format(config.HOSTNAME,pool['name']),
# json={'passphrase': '{}'.format(config.POOLS[pool['name']])},
# auth=('root', '{}'.format(config.ROOT_PASSWORD)),
# verify='{}'.format(config.CA_CERT_PATH),
#)
if response.ok:
logging.info('Pool {} was unlocked successfully'.format(pool['name']))
else:
logging.error('Pool {} was NOT unlocked successfully'.format(pool['name']))