Source code for riaps.rfab.api.timesync

from fabric import Group
from riaps.rfab.api.task import Task

[docs]class TimeConfig(Task): mode = None
[docs] @classmethod def configure(cls, mode): assert(mode in ['standalone','slave','master']) cls.mode = mode
[docs] def get_config(self): if self.mode is None: raise Exception("TimeConfig must be configure(d) with a mode") return self.sudo(f"timesyncctl config {self.mode}")
[docs]class TimeStatus(Task):
[docs] def get_status(self): return self.sudo("timesyncctl status")
[docs]class TimeRestart(Task):
[docs] def restart(self): return self.sudo("timesyncctl restart")
[docs]class TimeDate(Task):
[docs] def get_date(self): return self.run("date")
[docs]class TimeRdate(Task):
[docs] def run_rdate(self): return self.sudo("rdate -s -n -4 time.nist.gov")