Page MenuHomeDevCentral

D2603.id6569.diff
No OneTemporary

D2603.id6569.diff

diff --git a/_modules/paas_docker.py b/_modules/paas_docker.py
--- a/_modules/paas_docker.py
+++ b/_modules/paas_docker.py
@@ -50,6 +50,29 @@
return subnets
+def _get_containers():
+ return __pillar__["docker_containers"][__grains__["id"]]
+
+
+def list_containers():
+ """
+ A function to list all the containers provisionned on a Docker engine.
+
+ This function uses the pillar docker_containers as authoritative source,
+ so it documents the expected configuration, not the actual containers
+ running. That allows to compare both states.
+
+ CLI Example:
+
+ salt * paas_docker.list_containers
+ """
+ return [
+ key
+ for service, service_containers in _get_containers().items()
+ for key in service_containers.keys()
+ ]
+
+
# -------------------------------------------------------------
# Monitoring
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -71,7 +94,7 @@
salt * paas_docker.get_health_checks
"""
- containers = __pillar__["docker_containers"][__grains__["id"]]
+ containers = _get_containers()
monitoring = __pillar__["docker_containers_monitoring"]
return {
diff --git a/roles/paas-docker/monitoring/init.sls b/roles/paas-docker/monitoring/init.sls
--- a/roles/paas-docker/monitoring/init.sls
+++ b/roles/paas-docker/monitoring/init.sls
@@ -27,3 +27,4 @@
- context:
checks:
- {{ salt['paas_docker.get_health_checks']() }}
+ - check_docker_containers: {{ salt['paas_docker.list_containers']() }}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 11:54 (21 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2252357
Default Alt Text
D2603.id6569.diff (1 KB)

Event Timeline