Skip to content

Commit 98bea5c

Browse files
Merge pull request #2956 from Krishan-Saraswat/servconfig
Added user input for "serv_config -b" command.
2 parents cf37c35 + e0af8aa commit 98bea5c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

ras/ras_ppcutils.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import os
2020
import re
21+
import pexpect
22+
import sys
2123
from avocado import Test
2224
from avocado.utils import process, distro, build, archive, disk
2325
from avocado import skipIf, skipUnless
@@ -302,7 +304,18 @@ def test_serv_config(self):
302304
'--surveillance', '--reboot-policy', '--remote-pon', '-d --force']
303305
for list_item in list:
304306
cmd = "serv_config %s" % list_item
305-
self.run_cmd(cmd)
307+
child = pexpect.spawn(cmd, encoding='utf-8')
308+
child.logfile = sys.stdout # Log output for debugging
309+
if list_item == '-b':
310+
try:
311+
child.expect("Reboot Policy Settings:", timeout=5)
312+
child.expect(r"Auto Restart Partition \(1=Yes, 0=No\) \[1\]:", timeout=5)
313+
child.sendline("1")
314+
child.expect(r"Are you certain you wish to update the system configuration\s*to the specified values\? \(yes/no\) \[no\]:", timeout=5)
315+
child.sendline("yes")
316+
except pexpect.TIMEOUT:
317+
self.fail("Timeout waiting for expected prompt")
318+
child.wait()
306319
self.error_check()
307320

308321
@skipIf(IS_POWER_NV or IS_KVM_GUEST,

0 commit comments

Comments
 (0)