Add try catch for services to restart to work on core and scale for dataset unlock

This commit is contained in:
2024-08-31 15:40:10 +00:00
parent 92c693abc4
commit b6aa8121b8

View File

@@ -489,7 +489,10 @@ if __name__ == '__main__':
logger.info('Dataset {} was unlocked successfully'.format(dataset['name']))
# restart services since the dataset was unlocked
logger.info('Restarting services')
services_to_restart = request('pool/unlock_services_restart_choices', api_key, "POST", pool['id'])['response']
try:
services_to_restart = request('pool/unlock_services_restart_choices', api_key, "POST", pool['id'])['response']
except:
services_to_restart = request('pool/dataset/unlock_services_restart_choices', api_key, "POST", dataset['name'])['response']
for service_to_restart in services_to_restart:
if service_to_restart == "jails":
logger.debug('Skipping restarting the {} service'.format(services_to_restart[service_to_restart]))
@@ -504,7 +507,7 @@ if __name__ == '__main__':
logger.error('Dataset {} was NOT unlocked'.format(dataset['name']))
else:
logger.info('Dataset {} is already unlocked'.format(dataset['name']))
'''
'''
# make sure jail storage pool is set
logger.info('Setting jail storage pool to {}'.format(jail_storage_pool))
response = request('jail/activate', api_key, 'POST', '{}'.format(jail_storage_pool))