wip: make work Services Status
This commit is contained in:
+15
-4
@@ -478,11 +478,12 @@ umask = 022
|
||||
is_docker = os.path.exists('/.dockerenv') or os.environ.get('DOCKER_CONTAINER') == 'true'
|
||||
|
||||
if is_docker:
|
||||
# Return positive status when running in Docker
|
||||
# Check if file container is actually running
|
||||
container_running = self._check_file_container_status()
|
||||
status = {
|
||||
'running': True,
|
||||
'status': 'online',
|
||||
'webdav_status': {'running': True, 'port': 8080},
|
||||
'running': container_running,
|
||||
'status': 'online' if container_running else 'offline',
|
||||
'webdav_status': {'running': container_running, 'port': 8080},
|
||||
'users_count': 0,
|
||||
'total_storage_used': {'bytes': 0, 'human_readable': '0 B'},
|
||||
'timestamp': datetime.utcnow().isoformat()
|
||||
@@ -505,6 +506,16 @@ umask = 022
|
||||
except Exception as e:
|
||||
return self.handle_error(e, "get_status")
|
||||
|
||||
def _check_file_container_status(self) -> bool:
|
||||
"""Check if file Docker container is running"""
|
||||
try:
|
||||
import docker
|
||||
client = docker.from_env()
|
||||
containers = client.containers.list(filters={'name': 'cell-webdav'})
|
||||
return len(containers) > 0
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def test_connectivity(self) -> Dict[str, Any]:
|
||||
"""Test file service connectivity"""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user