Skip to content

Commit

Permalink
Fix type cast issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Jie Zheng committed Aug 6, 2020
1 parent d1e8cf1 commit 6864526
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace: fortinet
name: fortimanager

# The version of the collection. Must be compatible with semantic versioning
version: 1.0.3
version: 1.0.4

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down Expand Up @@ -46,7 +46,7 @@ tags: [fortinet, fortimanager, ansible]
dependencies: {}

# The URL of the originating SCM repository
repository: https://github.com/fortinet-ansible-dev/ansible-galaxy-fortimanager-collection/tree/galaxy/1.0.3
repository: https://github.com/fortinet-ansible-dev/ansible-galaxy-fortimanager-collection/tree/galaxy/1.0.4

# The URL to any online docs
documentation: https://ansible-galaxy-fortimanager-docs.readthedocs.io/en/galaxy-1.0.3
Expand Down
5 changes: 5 additions & 0 deletions plugins/module_utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,16 @@ def _validate_param_recursivly(self, param, schema):
return True, ''

if schema['type'] == 'string':
param_value = str(param_value)
if not isinstance(param_value, str):
return self._report_schema_violation(param, schema, 'type mismatch')
if 'enum' in schema and param_value not in schema['enum']:
return self._report_schema_violation(param, schema, 'enum value mismatch')
elif schema['type'] == 'integer':
try:
param_value = int(param_value)
except ValueError:
pass
if not isinstance(param_value, int):
return self._report_schema_violation(param, schema, 'type mismatch')
if 'enum' in schema and param_value not in schema['enum']:
Expand Down

0 comments on commit 6864526

Please sign in to comment.