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