diff --git a/services/services-generator b/services/services-generator index b2fed28..04fd5ed 100755 --- a/services/services-generator +++ b/services/services-generator @@ -21,11 +21,11 @@ class SystemdManager: @staticmethod def get_service_status_active(service): cmd = 'systemctl status -o short {} | grep "Active:"'.format(service) - lines = subprocess.check_output(cmd, shell=True).splitlines() + lines = subprocess.check_output(cmd, shell=True, universal_newlines=True).splitlines() if not len(lines) == 1: logging.error('Incorrect out(service)put format for systemctl status: {}'.format(lines)) return - return lines[0].split(' ')[1] + return lines[0].split()[1] @staticmethod def stop_service(service): diff --git a/services/snap.py b/services/snap.py index 1a62fd1..c945ba2 100644 --- a/services/snap.py +++ b/services/snap.py @@ -16,7 +16,7 @@ def __init__(self, name): def _get_info(self): line = 'snap info {}'.format(self.name) - return subprocess.check_output(line, shell=True).splitlines() + return subprocess.check_output(line, shell=True, universal_newlines=True).splitlines() def _get_channel_info(self, line, channel): parts = line.split() @@ -47,6 +47,6 @@ def get_info_by_channel(self): for channel in Snap.SUPPORTED_CHANNELS: channel_id = '{}:'.format(channel) if line.strip().startswith(channel_id): - info[channel] = self._get_channel_info(line, channel) + info[channel] = self._get_channel_info(line.strip(), channel) return info