ansibleguy / webui

Basic WebUI for using Ansible
https://webui.ansibleguy.net
GNU General Public License v3.0
95 stars 7 forks source link

Problem: Directories not created automatically #58

Closed mathieumd closed 2 months ago

mathieumd commented 2 months ago

Versions

0.0.23.post3

Scope

Unknown

Issue

It should be specified somewhere that you have to create the path /home/ansibleguy-webui/.local/share/ansible-webui/ otherwise repositories logs cannot be writen:

Sep 13 09:41:15 example1 ansibleguy-webui[36613]: Exception in thread Thread-2 (api_update_repository):
Sep 13 09:41:15 example1 ansibleguy-webui[36613]: Traceback (most recent call last):
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/home/ansibleguy-webui/venv/lib/python3.10/site-packages/ansibleguy-webui/aw/execute/repository.py", line 99, in create_or_update_repository
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     self.create_repository(env=env)
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/home/ansibleguy-webui/venv/lib/python3.10/site-packages/ansibleguy-webui/aw/execute/repository.py", line 52, in create_repository
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     self._repo_process(cmd=cmd, env=env)
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/home/ansibleguy-webui/venv/lib/python3.10/site-packages/ansibleguy-webui/aw/execute/repository.py", line 188, in _repo_process
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     self._log_file_write(f"COMMAND: {cmd}\n{result['stdout']}")
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/home/ansibleguy-webui/venv/lib/python3.10/site-packages/ansibleguy-webui/aw/execute/repository.py", line 226, in _log_file_write
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     write_file_0640(
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/home/ansibleguy-webui/venv/lib/python3.10/site-packages/ansibleguy-webui/aw/utils/util.py", line 85, in write_file_0640
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     with open(file, mode, encoding='utf-8', opener=_open_file_0640) as _file:
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/home/ansibleguy-webui/venv/lib/python3.10/site-packages/ansibleguy-webui/aw/utils/util.py", line 77, in _open_file_0640
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     return open_file(path, flags, 0o640)
Sep 13 09:41:15 example1 ansibleguy-webui[36613]: FileNotFoundError: [Errno 2] No such file or directory: '/home/ansibleguy-webui/.local/share/ansible-webui/RepoUpdate_2024-09-13_07-41-13_ansible_stdout_repo.log'
Sep 13 09:41:15 example1 ansibleguy-webui[36613]: During handling of the above exception, another exception occurred:
Sep 13 09:41:15 example1 ansibleguy-webui[36613]: Traceback (most recent call last):
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     self.run()
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/usr/lib/python3.10/threading.py", line 953, in run
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     self._target(*self._args, **self._kwargs)
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/home/ansibleguy-webui/venv/lib/python3.10/site-packages/ansibleguy-webui/aw/execute/repository.py", line 256, in api_update_repository
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     ).create_or_update_repository()
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/home/ansibleguy-webui/venv/lib/python3.10/site-packages/ansibleguy-webui/aw/execute/repository.py", line 112, in create_or_update_repository
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     self._error(msg=f"Got unexpected error: '{err}'")
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/home/ansibleguy-webui/venv/lib/python3.10/site-packages/ansibleguy-webui/aw/execute/repository.py", line 115, in _error
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     write_file_0640(file=self.repository.log_stderr, content=msg)
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/home/ansibleguy-webui/venv/lib/python3.10/site-packages/ansibleguy-webui/aw/utils/util.py", line 85, in write_file_0640
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     with open(file, mode, encoding='utf-8', opener=_open_file_0640) as _file:
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:   File "/home/ansibleguy-webui/venv/lib/python3.10/site-packages/ansibleguy-webui/aw/utils/util.py", line 77, in _open_file_0640
Sep 13 09:41:15 example1 ansibleguy-webui[36613]:     return open_file(path, flags, 0o640)
Sep 13 09:41:15 example1 ansibleguy-webui[36613]: FileNotFoundError: [Errno 2] No such file or directory: '/home/ansibleguy-webui/.local/share/ansible-webui/RepoUpdate_2024-09-13_07-41-13_ansible_stderr_repo.log'
ansibleguy commented 2 months ago

Interesting. Thank you for the report. The directory should be auto-created.