-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #38236 - copy /run/containers/0/auth.json only if it exists #11323
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Pavel Moravec <[email protected]>
I haven't tested this via REX yet, but does it work in practice? Seeing this on the shell: [root@9 ~]# cat /run/containers/0/auth.json
cat: /run/containers/0/auth.json: No such file or directory
[root@9 ~]# sudo cp --update /run/containers/0/auth.json /etc/flatpak/oci-auth.json
cp: cannot stat '/run/containers/0/auth.json': No such file or directory
[root@9 ~]# echo $?
1 It looks like the return code is still 1 if the source exists, which should fail the REX job. I suppose an alternate solution could be to use if test -f "/run/containers/0/auth.json"; then
sudo cp --update /run/containers/0/auth.json /etc/flatpak/oci-auth.json
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it just to be safe and saw this:
1:
Login Succeeded!
2:
cp: cannot create regular file '/etc/flatpak/oci-auth.json': No such file or directory
3:
Exit status: 1
4:
StandardError: Job execution failed
Edit: this occurred because flatpak wasn't installed yet. The dir should exist if flatpak is installed.
I'm confused how /run/containers/0/auth.json would not exist, it gets populated when you |
Testing with the current changes and flatpak installed, I see:
Testing with the |
sudo cp --update /run/containers/0/auth.json /etc/flatpak/oci-auth.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sudo cp --update /run/containers/0/auth.json /etc/flatpak/oci-auth.json | |
if test -f "/run/containers/0/auth.json"; then | |
sudo cp --update /run/containers/0/auth.json /etc/flatpak/oci-auth.json | |
fi |
What are the changes introduced in this pull request?
Don't fail on copy
/run/containers/0/auth.json
to/etc/flatpak/oci-auth.json
if the source file does not exist - its presence is optional.Considerations taken when implementing this change?
There are a few options how to fix this, i.e. redirect stderr to
/dev/null
. I chose thiscp
option:for its positive side-effect: dont overwrite
oci-auth.json
if it has a newer content (at least I see this as a feature and not a bug of the chosen fix - let me see if you think otherwise).What are the testing steps for this pull request?
Ensure no
/run/containers/0/auth.json
is present on a Host with podman and flatpak (this is default), and apply the job template to the Host.