diff --git a/psconfig/perfsonar-psconfig/psconfig/utilities/jq.py b/psconfig/perfsonar-psconfig/psconfig/utilities/jq.py index c2b9df9..6a77604 100644 --- a/psconfig/perfsonar-psconfig/psconfig/utilities/jq.py +++ b/psconfig/perfsonar-psconfig/psconfig/utilities/jq.py @@ -2,13 +2,13 @@ Utilities for running JQ. ''' -import pyjq +# This dodges a name collision +import jq as _jq -def jq(jq, json_obj, formatting_params=None, timeout=None): +def jq(script, input_data): + ''' + Run a jq script with input and return the first result + ''' - #initialize formatting params - try: - value = pyjq.one(jq, json_obj) - return value - except Exception as e: - raise Exception('jq error: {}'.format(e)) + # On failure, this raises ValueError('jq: ...') + return _jq.compile(script).input_value(input_data).first() diff --git a/psconfig/perfsonar-psconfig/setup.py b/psconfig/perfsonar-psconfig/setup.py index 13113a6..9402ca9 100644 --- a/psconfig/perfsonar-psconfig/setup.py +++ b/psconfig/perfsonar-psconfig/setup.py @@ -30,7 +30,7 @@ ], install_requires=['requests', 'jsonschema', - 'pyjq', + 'jq', 'isodate' 'python-dateutil==2.8.2', 'pyinotify', diff --git a/psconfig/perfsonar-psconfig/unibuild-packaging/deb/control b/psconfig/perfsonar-psconfig/unibuild-packaging/deb/control index 87528c4..ab0b982 100644 --- a/psconfig/perfsonar-psconfig/unibuild-packaging/deb/control +++ b/psconfig/perfsonar-psconfig/unibuild-packaging/deb/control @@ -14,7 +14,7 @@ Package: python3-perfsonar-psconfig Architecture: all Depends: python3, ${misc:Depends}, python3-requests, python3-jsonschema (>= 3.0.1~0), python3-tqdm, - python3-isodate (>= 0.5.0), python3-dnspython, python3-pyjq, + python3-isodate (>= 0.5.0), python3-dnspython, python3-jq, python3-netifaces, python3-dateutil, python3-file-read-backwards, python3-pscheduler Description: pSConfig library diff --git a/psconfig/perfsonar-psconfig/unibuild-packaging/rpm/perfsonar-psconfig.spec b/psconfig/perfsonar-psconfig/unibuild-packaging/rpm/perfsonar-psconfig.spec index c66c149..feb2a39 100644 --- a/psconfig/perfsonar-psconfig/unibuild-packaging/rpm/perfsonar-psconfig.spec +++ b/psconfig/perfsonar-psconfig/unibuild-packaging/rpm/perfsonar-psconfig.spec @@ -57,7 +57,7 @@ Summary: perfSONAR pSConfig Python Libraries Requires: %{_python} Requires: %{_python}-requests Requires: %{_python}-jsonschema >= 3.0 -Requires: %{_python}-pyjq >= 2.2.0 +Requires: %{_python}-jq Requires: %{_python}-netifaces Requires: %{_python}-isodate Requires: %{_python}-dns