|
|
|
@ -46,14 +46,20 @@ class ActionModule(ActionBase):
|
|
|
|
|
fail_msg = self._task.args.get('fail_msg', self._task.args.get('msg'))
|
|
|
|
|
if fail_msg is None:
|
|
|
|
|
fail_msg = 'Assertion failed'
|
|
|
|
|
elif not isinstance(fail_msg, string_types):
|
|
|
|
|
raise AnsibleError('Incorrect type for fail_msg or msg, expected string and got %s' % type(fail_msg))
|
|
|
|
|
elif isinstance(fail_msg, list):
|
|
|
|
|
if not all(isinstance(x, string_types) for x in fail_msg):
|
|
|
|
|
raise AnsibleError('Type of one of the elements in fail_msg or msg list is not string type')
|
|
|
|
|
elif not isinstance(fail_msg, (string_types, list)):
|
|
|
|
|
raise AnsibleError('Incorrect type for fail_msg or msg, expected a string or list and got %s' % type(fail_msg))
|
|
|
|
|
|
|
|
|
|
success_msg = self._task.args.get('success_msg')
|
|
|
|
|
if success_msg is None:
|
|
|
|
|
success_msg = 'All assertions passed'
|
|
|
|
|
elif not isinstance(success_msg, string_types):
|
|
|
|
|
raise AnsibleError('Incorrect type for success_msg, expected string and got %s' % type(success_msg))
|
|
|
|
|
elif isinstance(success_msg, list):
|
|
|
|
|
if not all(isinstance(x, string_types) for x in success_msg):
|
|
|
|
|
raise AnsibleError('Type of one of the elements in success_msg list is not string type')
|
|
|
|
|
elif not isinstance(success_msg, (string_types, list)):
|
|
|
|
|
raise AnsibleError('Incorrect type for success_msg, expected a string or list and got %s' % type(success_msg))
|
|
|
|
|
|
|
|
|
|
quiet = boolean(self._task.args.get('quiet', False), strict=False)
|
|
|
|
|
|
|
|
|
|