Skip to content

Commit

Permalink
Merge pull request #11 from tobias-richter/feature/skip-when-no-value
Browse files Browse the repository at this point in the history
Early return and skip if value is not provided / omitted
  • Loading branch information
tobias-richter authored Jan 4, 2021
2 parents 7fd230f + 7d7c171 commit 9d31c90
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion action_plugins/tasmota.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,24 @@ def run(self, tmp=None, task_vars=None):
# Get the tasmota host
tasmota_host = self._get_arg_or_var('tasmota_host', task_vars['ansible_host'])
command = self._get_arg_or_var('command')
incoming_value = self._get_arg_or_var('value')
incoming_value = self._get_arg_or_var('value', None, False)

if incoming_value is None:

# early return when incoming_value is not provided
result["changed"] = False
result["skipped"] = True

return result

except Exception as err:
display.v("got an exception: %s" % (err))
display.v("got an exception: "+err.message)
return self._fail_result(result, "error during retrieving parameter '%s'" % (err.message))

display.v("incoming_value %s" % (incoming_value))


auth_params = {}
try:
user = self._get_arg_or_var("tasmota_user")
Expand Down

0 comments on commit 9d31c90

Please sign in to comment.