[fix] would have failed on status.get returning None

This commit is contained in:
Laurent Peuch 2018-05-29 08:32:36 +02:00
parent d0b9eb1bdd
commit 6ec5a916f3

View file

@ -263,7 +263,7 @@ def service_status(names=[]):
'active': str(status.get("ActiveState", "unknown")),
'active_at': {
"timestamp": str(status.get("ActiveEnterTimestamp", "unknown")),
"human": datetime.fromtimestamp(status.get("ActiveEnterTimestamp") / 1000000).strftime("%F %X"),
"human": datetime.fromtimestamp(status["ActiveEnterTimestamp"] / 1000000).strftime("%F %X") if "ActiveEnterTimestamp" in status else "unknown",
},
'description': description,
'service_file_path': str(status.get("FragmentPath", "unknown")),