Skip to content

Commit 17dbd8b

Browse files
authored
Add environment variable driven failure trigger (#184)
Add code in qesap.py to trigger a simulated failure. QESAP_SIM_RC force the script to immediately exit with a specific exit code QESAP_SIM_MSG print a message on log.error
1 parent 40a7685 commit 17dbd8b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scripts/qesap/qesap.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ def main(command_line=None): # pylint: disable=too-many-return-statements
141141
log.debug("No command")
142142
return 0
143143

144+
sim_message = os.getenv('QESAP_SIM_MSG')
145+
if sim_message:
146+
log.error("This is a -- %s -- simulation.", sim_message)
147+
sim_rc = os.getenv('QESAP_SIM_RC')
148+
if sim_rc:
149+
res = Status(int(sim_rc))
150+
return res
151+
144152
if parsed_args.command == "configure":
145153
log.info("Configuring...")
146154
res = cmd_configure(

0 commit comments

Comments
 (0)