Commit 9cb6ee64 by Őry Máté

make it work on centos7

parent 51440125
...@@ -46,6 +46,7 @@ mount_template_windows = ( ...@@ -46,6 +46,7 @@ mount_template_windows = (
system = platform.system() system = platform.system()
distros = {'Scientific Linux': 'rhel', distros = {'Scientific Linux': 'rhel',
'CentOS': 'rhel', 'CentOS': 'rhel',
'CentOS Linux': 'rhel',
'Debian': 'debian', 'Debian': 'debian',
'Ubuntu': 'debian'} 'Ubuntu': 'debian'}
if system == 'Linux': if system == 'Linux':
...@@ -243,7 +244,10 @@ class Context(object): ...@@ -243,7 +244,10 @@ class Context(object):
@staticmethod @staticmethod
def start_access_server(): def start_access_server():
if system == 'Linux': if system == 'Linux':
try:
subprocess.call(('/sbin/start', 'ssh')) subprocess.call(('/sbin/start', 'ssh'))
except OSError:
subprocess.call(('/bin/systemctl', 'start', 'sshd.service'))
elif system == 'Windows': elif system == 'Windows':
# TODO # TODO
...@@ -329,9 +333,9 @@ class SerialLineReceiver(SerialLineReceiverBase): ...@@ -329,9 +333,9 @@ class SerialLineReceiver(SerialLineReceiverBase):
disk_usage = {(disk.device.replace('/', '_')): disk_usage = {(disk.device.replace('/', '_')):
psutil.disk_usage(disk.mountpoint).percent psutil.disk_usage(disk.mountpoint).percent
for disk in psutil.disk_partitions()} for disk in psutil.disk_partitions()}
args = {"cpu": dict(psutil.cpu_times().__dict__), args = {"cpu": dict(psutil.cpu_times()._asdict()),
"ram": dict(psutil.virtual_memory().__dict__), "ram": dict(psutil.virtual_memory()._asdict()),
"swap": dict(psutil.swap_memory().__dict__), "swap": dict(psutil.swap_memory()._asdict()),
"uptime": {"seconds": uptime.uptime()}, "uptime": {"seconds": uptime.uptime()},
"disk": disk_usage, "disk": disk_usage,
"user": {"count": len(psutil.get_users())}} "user": {"count": len(psutil.get_users())}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment