import logging
-from datetime import datetime
+
+from dateutil.parser import parse as parse_date
from . import model
from .client import client
"""Get the time when the `agent_status` was last updated.
"""
- since = self.data['agent-status']['since']
- # Juju gives us nanoseconds, but Python only supports microseconds
- since = since[:26]
- return datetime.strptime(since, "%Y-%m-%dT%H:%M:%S.%f")
+ return parse_date(self.data['agent-status']['since'])
@property
def agent_status_message(self):
"""Get the time when the `workload_status` was last updated.
"""
- since = self.data['workload-status']['since']
- # Juju gives us nanoseconds, but Python only supports microseconds
- since = since[:26]
- return datetime.strptime(since, "%Y-%m-%dT%H:%M:%S.%f")
+ return parse_date(self.data['workload-status']['since'])
@property
def workload_status_message(self):
# until https://github.com/juju/theblues/pull/46 and https://github.com/juju/theblues/pull/47
# are merged, this depends on the following fork:
git+https://github.com/johnsca/theblues@libjuju#egg=theblues
+python-dateutil==2.6.0
'websockets',
'pyyaml',
'theblues',
+ 'python-dateutil'
],
include_package_data=True,
maintainer='Juju Ecosystem Engineering',