Skip to content

Commit 73b7448

Browse files
committed
[OMCProcessDockerHelper] (re)add serverAdress()
1 parent 23dac75 commit 73b7448

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

OMPython/OMCSession.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
import getpass
3838
import io
39+
import json
3940
import logging
4041
import os
4142
import pathlib
@@ -641,6 +642,13 @@ def _getuid() -> int:
641642
"""
642643
return 1000 if sys.platform == 'win32' else os.getuid()
643644

645+
def serverAdress(self) -> Optional[str]:
646+
if self._dockerNetwork == "separate":
647+
output = subprocess.check_output(["docker", "inspect", str(self._dockerCid)]).decode().strip()
648+
return json.loads(output)[0]["NetworkSettings"]["IPAddress"]
649+
650+
return None
651+
644652

645653
class OMCProcessDocker(OMCProcess, OMCProcessDockerHelper):
646654

0 commit comments

Comments
 (0)