Skip to content
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

Support system-wide containers config folder on windows #1973

Merged

Conversation

l0rd
Copy link
Member

@l0rd l0rd commented Apr 29, 2024

Add %PROGRAMDATA%/containers to the list of possible config folders on Windows.

For all OSes returns the "the default config path overridden by the root user" using a function rather than a const to allow composing it with variable PROGRAMDATA on windows.

Fixes containers/podman#22411

// DefaultContainersConfig holds the default containers config path
DefaultContainersConfig = "/usr/share/" + _configPath
DefaultContainersConfig = "C:\\ProgramData\\" + _configPath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_configPath is containers/containers.conf so should this use containers\\containers.conf instead or does it not matter?
Also given that overrideContainersConfigPath() returns the actual path with the correct env if the defaults was changed should we maybe just leave DefaultContainersConfig empty on windows? At least I see no benifit to read the same file twice other to make it slower.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_configPath is containers/containers.conf so should this use containers\\containers.conf instead or does it not matter?

It should be fine, the Windows API converts the forward slashes to backslashes. But for consistency I like it more to have _configPath const on windows to be containers\\containers.conf so I have updated that thanks.

Also given that overrideContainersConfigPath() returns the actual path with the correct env if the defaults was changed should we maybe just leave DefaultContainersConfig empty on windows? At least I see no benifit to read the same file twice other to make it slower.

Yes I think it's better. I have left it empty.

@l0rd l0rd force-pushed the windows-system-wide-config branch from 68a5293 to abec2d6 Compare April 29, 2024 14:48
Add %PROGRAMDATA%/containers to the list of possible
config folders.

Fixes containers/podman#22411

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
@l0rd l0rd force-pushed the windows-system-wide-config branch from abec2d6 to 6c651df Compare April 29, 2024 14:50
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

openshift-ci bot commented Apr 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: l0rd, Luap99

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@l0rd
Copy link
Member Author

l0rd commented Apr 30, 2024

@containers/podman-maintainers PTAL

@rhatdan
Copy link
Member

rhatdan commented Apr 30, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Apr 30, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 0f3c980 into containers:main Apr 30, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support system-wide configuration file on Windows too
3 participants