southalc / podman

Puppet module for podman
Apache License 2.0
13 stars 30 forks source link

Cannot merge "/run/podman/podman.sock":String and "/run/user/0/podman/podman.sock":String #81

Open hadmut opened 10 months ago

hadmut commented 10 months ago

Hi,

I'm using several versions of puppetserver 7 and 8, several versions of agents, and

mod 'southalc-podman', '0.6.7'

when running the agent or just facter --puppet, I do get this error message on some of my machines:

[2023-12-23 21:33:35.625281 ] ERROR Facter - Error while resolving custom fact fact='podman', resolution='': Could not deep merge all chunks (Original error: Cannot merge "/run/podman/podman.sock":String and "/run/user/0/podman/podman.sock":String at root["socket"]["root"]), ensure that chunks return either an Array or Hash or override the aggregate block

when both /run/podman/podman.sock and /run/user/0/podman/podman.sock do exist.

Actually, this should not really happen, because running a user-specific podman socket for user root does not really make sense. I'm still looking for what enabled this. Some other script must have erroneously enabled a user-specific podman socket for root. Although this does not make much sense, it is still a correct system configuration, and a puppet module must be able to deal with it.

However, this condition caused the error message and showed that this modules facter chunk functions return a wrong data type, i.e. a String, where Array or Hash is expected.

regards

hadmut commented 10 months ago

Found the reason for the double socket:

Whether a user-specific (including root) systemd is started, depends on how you login. Logging in as root directly by ssh (instead of becoming a user and using sudo), a systemd --user is started for root. If creating a podman socket is enabled in general, every systemd --user will create one for the particular user under /run/user/UID/podman/podman.sock , and thus even one for root, which then has two.

Again: This is not caused by southalc-podman, and I still do not see what this would be good for to have a user-specific socket for root. But that's the way it is, and southalc-podman should treat this correctly.