mreg-cli started with --record quits when doing changes
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2
- Forks
- 7
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 2
Description
Hi, when mreg-cli is running with the --record-option any change, for example to a policy or host result in an error.
Printing information about hosts or roles/atoms works without any issue (and is logged in json-format as expected in the file specified at startup).
dnf info mreg-cli
Installed Packages
Name : mreg-cli
Version : 0.9.22
Release : 4.20240129.e6eb660.el8
Architecture : noarch
Size : 610 k
Source : mreg-cli-0.9.22-4.20240129.e6eb660.el8.src.rpm
Repository : @System
From repo : uio-free
cat /etc/redhat-release
Red Hat Enterprise Linux release 8.10 (Ootpa)
/usr/bin/mreg-cli --record mreg.json
[>'mreg.json'] mreg> policy atom_create mail_test123 "Test opprettelse"
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/mreg_cli/outputmanager.py", line 275, in recording_request
obj = result.json()
File "/usr/lib/python3.6/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/mreg-cli", line 11, in <module>
load_entry_point('mreg-cli==0.0.0', 'console_scripts', 'mreg-cli')()
File "/usr/lib/python3.6/site-packages/mreg_cli/main.py", line 200, in main
cli.process_command_line(line)
File "/usr/lib/python3.6/site-packages/mreg_cli/cli.py", line 257, in process_command_line
cli.parse(cmd)
File "/usr/lib/python3.6/site-packages/mreg_cli/cli.py", line 157, in parse
args.func(args)
File "/usr/lib/python3.6/site-packages/mreg_cli/policy.py", line 84, in atom_create
post(path, **data)
File "/usr/lib/python3.6/site-packages/mreg_cli/util.py", line 414, in post
return _request_wrapper("post", path, params=params, **kwargs)
File "/usr/lib/python3.6/site-packages/mreg_cli/util.py", line 347, in _request_wrapper
OutputManager().recording_request(operation_type, url, params, data, result)
File "/usr/lib/python3.6/site-packages/mreg_cli/outputmanager.py", line 279, in recording_request
except requests.JSONDecodeError:
AttributeError: module 'requests' has no attribute 'JSONDecodeError'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in mreg_cli/outputmanager.py at recording_request, using the traceback from the --record policy atom_create command; follow the request path through mreg_cli/util.py. Done means changes made while recording no longer terminate with the JSONDecodeError handling failure, while recorded output continues to work for the shown command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100