Skip to content

Commit 77413e6

Browse files
committed
Downgrade Python to more supported version by PM, bring back my kazoo shutdown implementation which works
1 parent ecce42b commit 77413e6

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

docker/compose/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ RUN `
6868
choco install -y strawberryperl --version 5.28.2.1
6969

7070
RUN `
71-
# Download & install Python 3.11.7
71+
# Download & install Python 3.11.6
7272
`
73-
choco install -y python --version 3.11.7
73+
choco install -y python --version 3.11.6
7474

7575
RUN `
7676
# Donwload debugpy Python module

docker/scripts/nbl/ci/dev/lib/kazoo.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,6 @@ def appendKazooAtomic(self, zNodePath, data):
6262
pass
6363

6464

65-
def shutdownOs():
66-
if os.name == 'nt' or os.name == 'java': # For windows and java (in the rare case of running jython)
67-
return os.system('shutdown /s /f 0')
68-
elif os.name == 'posix': # For Unix, Linux, Mac
69-
return os.system('shutdown -h now')
70-
else:
71-
print('Unknown operating system') # Docs for os.name listed only the above three cases
72-
return 1
73-
74-
7565
def healthyCheck(host):
7666
try:
7767
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
@@ -92,8 +82,10 @@ def healthyCheck(host):
9282
if shutdown:
9383
print("Requested shutdown...")
9484

95-
if shutdownOs() != 0:
96-
print(f"Could not shutdown container")
85+
try:
86+
subprocess.run(f"shutdown /s /f", check=True)
87+
except subprocess.CalledProcessError as e:
88+
print(f"Could not shutdown container because of: {e.stderr}")
9789

9890
return True
9991
except (socket.error, socket.timeout):
@@ -110,4 +102,4 @@ def healthyCheck(host):
110102
if healthyCheck(args.host):
111103
sys.exit(0) # healthy
112104
else:
113-
sys.exit(1) # not healthy
105+
sys.exit(1) # not healthy

0 commit comments

Comments
 (0)