-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
-Fixes JSON parsing(use JSON object instead of string) for facts module #31818
Conversation
from ansible.module_utils.basic import AnsibleModule | ||
from ansible.module_utils.junos import junos_argument_spec, check_args, get_param | ||
from ansible.module_utils.junos import get_configuration | ||
from ansible.module_utils.pycompat24 import get_exception | ||
from ansible.module_utils.netconf import send_request | ||
from ansible.module_utils.six import iteritems | ||
from ansible.module_utils._text import to_text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is to_text
used anywhere in this module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
@@ -155,7 +158,7 @@ def populate(self): | |||
config = self.get_text(reply, 'configuration-text') | |||
|
|||
elif config_format == 'json': | |||
config = str(reply.text).strip() | |||
config = json.loads(reply.text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I think this can be updated to use module.from_json()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do add/modify unit and integration test for this fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
cherry-picked for 2.4.2beta1 |
SUMMARY
Fixes output parsing for junos facts to use JSON object instead of a string
Fixes #31489
ISSUE TYPE
COMPONENT NAME
modules/network/junos
ANSIBLE VERSION