Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/puppet/provider/podman_secret/podman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ def create_secret_from_content(args, secret_content)
tempfile.write(secret_content.to_s)
tempfile.flush

# The tempfile is created as root with mode 0600, so it must be chowned
# to the target user or podman will get a permission denied" trying to open it.
if resource[:user] and resource[:user] != 'root'
user_info = Etc.getpwnam(resource[:user])
File.chown(user_info.uid, user_info.gid, tempfile.path)
end

# Add the tempfile path to args and execute
final_args = args + [tempfile.path]
execute_podman_command(final_args)
Expand Down