1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

solaris_zone: replace os.system() with run_command() (#11192)

* solaris_zone: replace os.system() with run_command()

* add changelog frag
This commit is contained in:
Alexei Znamensky 2025-11-25 09:07:25 +13:00 committed by GitHub
parent a803156277
commit 64dc009ea7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -309,12 +309,15 @@ class Zone:
Wait until the zone's console login is running; once that's running, consider the zone booted.
"""
zone_booted_re = re.compile(r"ttymon.*-d /dev/console")
cmd_ps = ["ps", "-z", self.name, "-o", "args"]
elapsed = 0
while True:
if elapsed > self.timeout:
self.module.fail_json(msg="timed out waiting for zone to boot")
rc = os.system(f'ps -z {self.name} -o args|grep "ttymon.*-d /dev/console" > /dev/null 2>/dev/null')
if rc == 0:
rc, out, err = self.module.run_command(cmd_ps, check_rc=False)
if any(zone_booted_re.match(x) for x in out.splitlines()):
break
time.sleep(10)
elapsed += 10