1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fail if requested variable is not available

This commit is contained in:
Maykel Moya 2013-10-18 13:11:47 +02:00
parent 4f13967386
commit 3db7ec8356

View file

@ -201,6 +201,8 @@ def main():
if value is None: if value is None:
module.exit_json(msg=mysqlvar_val) module.exit_json(msg=mysqlvar_val)
else: else:
if len(mysqlvar_val) < 1:
module.fail_json(msg="Variable not available", changed=False)
if value == mysqlvar_val[0][1]: if value == mysqlvar_val[0][1]:
module.exit_json(msg="Variable already set to requested value", changed=False) module.exit_json(msg="Variable already set to requested value", changed=False)
result = setvariable(cursor, mysqlvar, value) result = setvariable(cursor, mysqlvar, value)