Update 'freenas_network_unlock.py'
This commit is contained in:
@@ -4,13 +4,6 @@ import subprocess # For executing a shell command
|
||||
import config # configuration file
|
||||
import logging
|
||||
|
||||
#try:
|
||||
# import http.client as http_client
|
||||
#except ImportError:
|
||||
# Python 2
|
||||
# import httplib as http_client
|
||||
#http_client.HTTPConnection.debuglevel = 1
|
||||
|
||||
# You must initialize logging, otherwise you'll not see debug output.
|
||||
logging.basicConfig(level=logging.INFO,format='%(asctime)s - [%(levelname)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
|
||||
#logging.getLogger().setLevel(logging.DEBUG)
|
||||
@@ -41,7 +34,7 @@ VOLUMES = requests.get(
|
||||
|
||||
for volume in VOLUMES.json():
|
||||
if volume['is_decrypted'] == False:
|
||||
logging.info('Pool {} is locked.'.format(volume['name']))
|
||||
logging.info('Pool {} is locked'.format(volume['name']))
|
||||
response = requests.post(
|
||||
'https://{}/api/v1.0/storage/volume/{}/unlock/'.format(config.HOSTNAME,volume['name']),
|
||||
json={'passphrase': '{}'.format(config.POOLS[volume['name']])},
|
||||
|
||||
Reference in New Issue
Block a user