Skip to content

Commit

Permalink
Fix sanity issues
Browse files Browse the repository at this point in the history
  • Loading branch information
adealdag committed Nov 11, 2024
1 parent 9fff6c3 commit c4b1f06
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/httpapi/nd.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def send_file_request(self, method, path, file=None, data=None, remote_path=None
self.method = "GET"
if method is not None:
self.method = method

# If file_ext is provided, replace the file extension (if present) or add it
if file_ext is not None:
if not file_ext.startswith(".") or file_ext not in set(mimetypes.types_map.keys()):
Expand Down
4 changes: 3 additions & 1 deletion plugins/module_utils/ndi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from __future__ import absolute_import, division, print_function
import json
from lxml import etree

try:
from jsonpath_ng import parse
Expand Down Expand Up @@ -310,7 +309,10 @@ def is_json(self, myjson):

def is_xml(self, myxml):
try:
from lxml import etree
etree.parse(myxml)
except ImportError:
self.nd.fail_json(msg="Cannot use lxml etree because lxml module is not available")
except etree.XMLSyntaxError:
return False
return True
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/nd_pcv.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def main():
try:
file_ext = ".json"
extract_data = ndi.load(open(file))
except:
except BaseException:
nd.fail_json(msg="Error processing the file. Check if file content is valid.")

if isinstance(extract_data, list):
Expand Down

0 comments on commit c4b1f06

Please sign in to comment.