Blob Blame History Raw
diff --git a/shell/src/interpreter.py b/shell/src/interpreter.py
index d18f918b..8a2d79f7 100644
--- a/shell/src/interpreter.py
+++ b/shell/src/interpreter.py
@@ -2549,6 +2549,22 @@ class Util(object):
 
         return adminUserName
 
+    @staticmethod
+    def getlisteningports():
+        """Check which ports are being listened on"""
+        ports = []
+        try:
+            import subprocess
+            pipe_out_err = subprocess.Popen("ss -tln", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
+            for listen in pipe_out_err[0].split('\n'):
+                m = re.search(r":([0-9]+)\s", listen)
+                if m != None:
+                    ports.append(int(m.group(1)))
+        except:
+            pass
+
+        return ports
+
     @staticmethod
     def setFSReadonly(interpreter, sourceFS):
         #check which implementations are loaded
@@ -2572,7 +2588,7 @@ class Util(object):
                 return 1
             else:
                 #if DPM python is there try to set to RO also via DPM but don't fail in case of errors
-                if 'dpm2' in sys.modules:
+                if 'dpm2' in sys.modules and 5015 in Util.getlisteningports():
                     dpm2.dpm_modifyfs(sourceFS.server, sourceFS.name, 2, sourceFS.weight)
                 return 0