Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
pass the optional config dictionary while checking service status. ro…
  • Loading branch information
schakrava committed Feb 1, 2016
1 parent b694a3f commit b754fc3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions src/rockstor/smart_manager/data_collector.py
Expand Up @@ -3,6 +3,7 @@

import psutil
import re
import json
import gevent
from socketio.server import SocketIOServer
from socketio import socketio_manage
Expand Down Expand Up @@ -241,14 +242,20 @@ def recv_disconnect(self):
self.disconnect()

def send_service_statuses(self):
# Iterate through the collection and assign the values accordingly
services = [s.name for s in Service.objects.all()]
while True:
data = {}
for service in services:
data[service] = {}
output, error, return_code = service_status(service)
data[service]['running'] = return_code
for service in Service.objects.all():
config = None
if (service.config is not None):
try:
config = json.loads(service.config)
except Exception, e:
logger.error('Exception while loading config of '
'Service(%s): %s' %
(service.name, e.__str__()))
data[service.name] = {}
output, error, return_code = service_status(service.name, config=config)
data[service.name]['running'] = return_code

self.emit('services:get_services', {
'data': data, 'key': 'services:get_services'
Expand Down
2 changes: 1 addition & 1 deletion src/rockstor/smart_manager/views/active_directory.py
Expand Up @@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""

import socket
from rest_framework.response import Response
from storageadmin.util import handle_exception
from system.services import (toggle_auth_service, systemctl)
Expand All @@ -40,7 +41,6 @@ def _ntp_check(self, request):

@staticmethod
def _resolve_check(domain, request):
import socket
try:
res = socket.gethostbyname(domain)
except Exception, e:
Expand Down

0 comments on commit b754fc3

Please sign in to comment.