Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if True:
if True:
# Plugin tests passed
exitcitellus(code=citellus.RC_OKAY)
else:
# Error with plugin tests
# Provide messages on STDERR
exitcitellus(
code=citellus.RC_FAILED, msg="There was an error because of 'xxx'"
)
else:
# Plugin script skipped per conditions
# Provide reason for skipping:
exitcitellus(code=citellus.RC_SKIPPED, msg="Required file 'xxx' not found")
if True:
# Plugin tests passed
exitcitellus(code=citellus.RC_OKAY)
else:
# Error with plugin tests
# Provide messages on STDERR
exitcitellus(
code=citellus.RC_FAILED, msg="There was an error because of 'xxx'"
)
else:
# Plugin script skipped per conditions
# Provide reason for skipping:
exitcitellus(code=citellus.RC_SKIPPED, msg="Required file 'xxx' not found")
elif not runninglive():
# Running on snapshot/sosreport environment
if True:
if True:
# Plugin tests passed
exitcitellus(code=citellus.RC_OKAY)
else:
# Error with plugin tests
# Provide messages on STDERR
exitcitellus(
code=citellus.RC_FAILED, msg="There was an error because of 'xxx'"
)
else:
# Plugin script skipped per conditions
if result['result']['rc'] == 2:
result['result']['rc'] = citellus.RC_FAILED
elif result['result']['rc'] == 0:
result['result']['rc'] = citellus.RC_OKAY
# Convert stdout to stderr for citellus handling
result['result']['err'] = result['result']['out']
result['result']['out'] = ''
# Remove ansible-playbook command and just leave yml file
result['plugin'] = result['plugin'].replace(which('ansible-playbook'), '').replace(' -i localhost --connection=local, ', '')
# Now, fake 'skipped' for all the plugins which were tied to the mode we're not running in:
for playbook in playbookskipped:
dictionary = {'plugin': playbook,
'result': {'rc': citellus.RC_SKIPPED, 'err': 'Skipped for incompatible operating mode', 'out': ''}}
results.append(dictionary)
return results