New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find value exists in a json without iterating just to improve efficiency #49406

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
3 participants
@rajataneja101

rajataneja101 commented Dec 1, 2018

SUMMARY

This module will help to search whether a key and value exists in a json or not without iterating just to improve efficiency

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

find_value_in_json

ADDITIONAL INFORMATION

we use with_items to iterate through json to find whether a key and value exists or not but sometimes the JSON is huge so iteration takes sometime plus the logs written in ansible window are also huge. So this is a custom module which I use.


@ansibot

This comment has been minimized.

Contributor

ansibot commented Dec 1, 2018

Hi @rajataneja101, thank you for submitting this pull-request!

click here for bot help

@ansibot

This comment has been minimized.

Contributor

ansibot commented Dec 1, 2018

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/common/dict_transformations.py:143:0: trailing-whitespace Trailing whitespace

The test ansible-test sanity --test pep8 [explain] failed with 9 errors:

lib/ansible/module_utils/common/dict_transformations.py:143:1: E101 indentation contains mixed spaces and tabs
lib/ansible/module_utils/common/dict_transformations.py:143:1: W191 indentation contains tabs
lib/ansible/module_utils/common/dict_transformations.py:143:1: W293 blank line contains whitespace
lib/ansible/module_utils/common/dict_transformations.py:144:1: E302 expected 2 blank lines, found 1
lib/ansible/module_utils/common/dict_transformations.py:145:1: E101 indentation contains mixed spaces and tabs
lib/ansible/module_utils/common/dict_transformations.py:147:12: E226 missing whitespace around arithmetic operator
lib/ansible/module_utils/common/dict_transformations.py:147:16: E226 missing whitespace around arithmetic operator
lib/ansible/module_utils/common/dict_transformations.py:147:25: E226 missing whitespace around arithmetic operator
lib/ansible/module_utils/common/dict_transformations.py:147:31: E226 missing whitespace around arithmetic operator

click here for bot help

@gundalow

This comment has been minimized.

Contributor

gundalow commented Dec 4, 2018

@rajataneja101 Thank you for this PR. Could you please add some examples as comment next to the function and a note to say why you'd use this (performance)

@ansibot ansibot added the stale_ci label Dec 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment