Skip to content

Can't collect directory within container #4190

@pmoravec

Description

@pmoravec

When calling something like:

self.add_copy_spec(["/etc/foreman/", container='foreman')

then it fails with:

Traceback (most recent call last):
  File "/blah/sos/report/__init__.py", line 1385, in collect_plugin
    plug.collect_plugin()
  File "/blah/sos/report/plugins/__init__.py", line 3344, in collect_plugin
    self._collect_container_copy_specs()
  File "/blah/sos/report/plugins/__init__.py", line 3213, in _collect_container_copy_specs
    self.archive.check_path(arcdest, P_FILE)
  File "/blah/sos/archive.py", line 328, in check_path
    raise ValueError(ve_msg % (dest, f"regular file, for {src=} and {dest=}"))
ValueError: path '/var/tmp/sos.28fzpusb/sosreport-blah-2025-12-20-omtrsgs/sos_containers/foreman/etc/foreman/' exists and is not a regular file

The reason is https://github.com/sosreport/sos/blob/main/sos/report/plugins/__init__.py#L3213 assumes we collect just files (neither dir or symlink or special file).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions