canonical / canonical/testflinger
TF agent failed to send result
- Dominant language
- Python
- Stars
- 26
- Forks
- 49
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 16
Description
Description:
The Testflinger agent failed while retrying an old result. It attempted to send the result directory, but failed with a permission error while removing the run directory after transmitting the job outcome.
TF job link: https://testflinger.canonical.com/jobs/0ef7c3c3-8719-4f8a-b7c2-124a903b8ad3
Affected device/queue: multiple RPIs
Error log:
```
[26-06-17 01:03:31] INFO: (agent.py:501)| Attempting to send result: /home/ubuntu/testflinger/rpi3-005/results/0ef7c3c3-8719-4f8a-b7c2-124a903b8ad3
[26-06-17 01:03:31] ERROR: (cmd.py:32)| [Errno 13] Permission denied: 'xxxxx.json'
Traceback (most recent call last):
File "/srv/testflinger-venv/lib/python3.10/site-packages/testflinger_agent/cmd.py", line 27, in main
start_agent()
File "/srv/testflinger-venv/lib/python3.10/site-packages/testflinger_agent/__init__.py", line 148, in start_agent
agent.process_jobs()
File "/srv/testflinger-venv/lib/python3.10/site-packages/testflinger_agent/agent.py", line 272, in process_jobs
self.retry_old_results()
File "/srv/testflinger-venv/lib/python3.10/site-packages/testflinger_agent/agent.py", line 502, in retry_old_results
self.client.transmit_job_outcome(result)
File "/srv/testflinger-venv/lib/python3.10/site-packages/testflinger_agent/client.py", line 303, in transmit_job_outcome
shutil.rmtree(rundir)
File "/usr/lib/python3.10/shutil.py", line 725, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.10/shutil.py", line 658, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib/python3.10/shutil.py", line 658, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib/python3.10/shutil.py", line 658, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
[Previous line repeated 7 more times]
File "/usr/lib/python3.10/shutil.py", line 681, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.10/shutil.py", line 679, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'xxxxx.json'
```
Expected result:
The TF agent should be able to send the old result successfully and clean up the result directory afterward.
Contributor guide
Research direction
Start in testflinger_agent/client.py at transmit_job_outcome, then trace the retry path in testflinger_agent/agent.py through retry_old_results. Reproduce the permission failure when removing the result directory after transmission, and verify that an old result is sent successfully and its directory is cleaned up afterward.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100