File 0001-unique-debugger-pin-in-Docker-containers.patch of Package python-Werkzeug

From 924fbb4f4e4f724d7f3d35245c8d0f5acc85f66c Mon Sep 17 00:00:00 2001
From: David Lord <davidism@gmail.com>
Date: Tue, 14 May 2019 13:43:22 -0700
Subject: [PATCH] unique debugger pin in Docker containers

(cherry picked from commit 00bc43b1672e662e5e3b8cecd79e67fc968fa246)
---
 werkzeug/debug/__init__.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/werkzeug/debug/__init__.py b/werkzeug/debug/__init__.py
index 14fe1935..03b2e366 100644
--- a/werkzeug/debug/__init__.py
+++ b/werkzeug/debug/__init__.py
@@ -54,6 +54,19 @@ def get_machine_id():
         return rv
 
     def _generate():
+        # docker containers share the same machine id, get the
+        # container id instead
+        try:
+            with open("/proc/self/cgroup") as f:
+                value = f.readline()
+        except IOError:
+            pass
+        else:
+            value = value.strip().partition("/docker/")[2]
+
+            if value:
+                return value
+
         # Potential sources of secret information on linux.  The machine-id
         # is stable across boots, the boot id is not
         for filename in '/etc/machine-id', '/proc/sys/kernel/random/boot_id':
-- 
2.22.0

openSUSE Build Service is sponsored by