refactor status
This commit is contained in:
@@ -215,16 +215,6 @@ class Service:
|
|||||||
return None
|
return None
|
||||||
schedule.cancel_job(self._update_task)
|
schedule.cancel_job(self._update_task)
|
||||||
|
|
||||||
def get_status(self):
|
|
||||||
|
|
||||||
"""Gets the running status of the service
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
"up" or "down" depending on the running status of the service
|
|
||||||
"""
|
|
||||||
|
|
||||||
return "up" if bool(self.parent.docker.compose.ps(services=[self.name])) else "down"
|
|
||||||
|
|
||||||
def start_update_job(self):
|
def start_update_job(self):
|
||||||
|
|
||||||
"""Schedules a recurring update based on the composer.update label
|
"""Schedules a recurring update based on the composer.update label
|
||||||
@@ -293,4 +283,5 @@ class Service:
|
|||||||
services=[self.name]
|
services=[self.name]
|
||||||
)
|
)
|
||||||
logger.info(f"Updated service {self.name}")
|
logger.info(f"Updated service {self.name}")
|
||||||
self.set_status(self.get_status())
|
status = "up" if bool(self.parent.docker.compose.ps(services=[self.name])) else "down"
|
||||||
|
self.set_status(status)
|
||||||
Reference in New Issue
Block a user