def update_nginx(logger): try: #importing here because, APIWrapper needs postgres to be setup, so #importing at the top results in failure the first time. from smart_manager.models import Service from storageadmin.models import NetworkConnection ip = None port = 443 so = Service.objects.get(name='rockstor') if (so.config is not None): config = json.loads(so.config) port = config['listener_port'] try: ip = NetworkConnection.objects.get(name=config['network_interface']).ipaddr except NetworkConnection.DoesNotExist: logger.error('Network interface(%s) configured for rockstor ' 'service does not exist' % config['network_interface']) return services.update_nginx(ip, port) except Exception, e: logger.error('Exception occured while trying to update nginx') logger.exception(e)
def update_nginx(logger): try: ip, port = current_rockstor_mgmt_ip(logger) services.update_nginx(ip, port) except Exception as e: logger.exception('Exception while updating nginx: {e}'.format(e=e))
def restart_rockstor(ip, port): services.update_nginx(ip, port)