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

Add support for configuration files #851

Merged

Conversation

debarshiray
Copy link
Member

Fixes up #828 , and leaves out the tests because they look incomplete.

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jul 23, 2021
Figuring out the default toolbox image for a given distribution only
needs to happen as part of resolving the final toolbox image name from
the given command line options.

Fallout from c990fb4

containers#828
containers#851
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jul 23, 2021
A subsequent commit will add support for configuration files, which can
override the default toolbox image. Since this override affects all
commands, it effectively ends up adding a fourth option to the 'enter'
command, other than the existing options to change the distribution,
release and container. This makes it a lot more difficult to reason
when only 'toolbox enter --release N' is enough to enter the created
container.

containers#828
containers#851
debarshiray pushed a commit to debarshiray/toolbox that referenced this pull request Jul 23, 2021
The file format is TOML[0] but the file extension is .conf to follow the
convention set by Podman.

containers#828
containers#851
debarshiray pushed a commit to debarshiray/toolbox that referenced this pull request Jul 23, 2021
It looks like there are some oddities with Viper [1]. The errors can't
be examined with errors.As [2] and Viper doesn't actually throw
ConfigFileNotFoundError if a configuration file is not found. Secondly,
there's no way to find out if a key was actually specified in a
configuration file. The InConfig API doesn't return 'true' even if a
key was mentioned in a configuration file, and the IsSet API returns
'true' even if the key was only set via SetDefault in the code.

[1] https://pkg.go.dev/github.com/spf13/viper
[2] https://blog.golang.org/go1.13-errors

containers#828
containers#851
@debarshiray debarshiray force-pushed the wip/rishi/cmd-add-config-file-support branch from bf823c4 to c2e6074 Compare July 23, 2021 01:02
@softwarefactory-project-zuul
Copy link

Build failed.

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jul 23, 2021
A subsequent commit will add support for configuration files, which can
override the default toolbox image. Since this override affects all
commands, it effectively ends up adding a fourth option to the 'enter'
command, other than the existing options to change the distribution,
release and container. This makes it a lot more difficult to reason
when only 'toolbox enter --release N' is enough to enter the created
container.

containers#828
containers#851
debarshiray pushed a commit to debarshiray/toolbox that referenced this pull request Jul 23, 2021
The file format is TOML[0] but the file extension is .conf to follow the
convention set by Podman.

containers#828
containers#851
debarshiray pushed a commit to debarshiray/toolbox that referenced this pull request Jul 23, 2021
It looks like there are some oddities with Viper [1]. The errors can't
be examined with errors.As [2] and Viper doesn't actually throw
ConfigFileNotFoundError if a configuration file is not found. Secondly,
there's no way to find out if a key was actually specified in a
configuration file. The InConfig API doesn't return 'true' even if a
key was mentioned in a configuration file, and the IsSet API returns
'true' even if the key was only set via SetDefault in the code.

Some changes by Debarshi Ray.

[1] https://pkg.go.dev/github.com/spf13/viper
[2] https://blog.golang.org/go1.13-errors

containers#828
containers#851
@debarshiray debarshiray force-pushed the wip/rishi/cmd-add-config-file-support branch from c2e6074 to c07e1f5 Compare July 23, 2021 01:22
@softwarefactory-project-zuul
Copy link

Build failed.

Figuring out the default toolbox image for a given distribution only
needs to happen as part of resolving the final toolbox image name from
the given command line options.

Fallout from c990fb4

containers#828
containers#851
A subsequent commit will add support for configuration files, which can
override the default toolbox image. Since this override affects all
commands, it effectively ends up adding a fourth option to the 'enter'
command, other than the existing options to change the distribution,
release and container. This makes it a lot more difficult to reason
when only 'toolbox enter --release N' is enough to enter the created
container.

containers#828
containers#851
debarshiray pushed a commit to debarshiray/toolbox that referenced this pull request Jul 23, 2021
The file format is TOML[0] but the file extension is .conf to follow the
convention set by Podman.

containers#828
containers#851
debarshiray pushed a commit to debarshiray/toolbox that referenced this pull request Jul 23, 2021
It looks like there are some oddities with Viper [1]. The errors can't
be examined with errors.As [2] and Viper doesn't actually throw
ConfigFileNotFoundError if a configuration file is not found. Secondly,
there's no way to find out if a key was actually specified in a
configuration file. The InConfig API doesn't return 'true' even if a
key was mentioned in a configuration file, and the IsSet API returns
'true' even if the key was only set via SetDefault in the code.

Some changes by Debarshi Ray.

[1] https://pkg.go.dev/github.com/spf13/viper
[2] https://blog.golang.org/go1.13-errors

containers#828
containers#851
@debarshiray debarshiray force-pushed the wip/rishi/cmd-add-config-file-support branch from c07e1f5 to f893f6a Compare July 23, 2021 01:49
The file format is TOML[0] but the file extension is .conf to follow the
convention set by Podman.

containers#828
containers#851
It looks like there are some oddities with Viper [1]. The errors can't
be examined with errors.As [2] and Viper doesn't actually throw
ConfigFileNotFoundError if a configuration file is not found. Secondly,
there's no way to find out if a key was actually specified in a
configuration file. The InConfig API doesn't return 'true' even if a
key was mentioned in a configuration file, and the IsSet API returns
'true' even if the key was only set via SetDefault in the code.

Some changes by Debarshi Ray.

[1] https://pkg.go.dev/github.com/spf13/viper
[2] https://blog.golang.org/go1.13-errors

containers#828
containers#851
@debarshiray debarshiray force-pushed the wip/rishi/cmd-add-config-file-support branch from f893f6a to 20f4f68 Compare July 23, 2021 01:59
@debarshiray debarshiray merged commit 20f4f68 into containers:main Jul 23, 2021
@debarshiray debarshiray deleted the wip/rishi/cmd-add-config-file-support branch July 23, 2021 02:00
@HarryMichal HarryMichal added 2. CLI Issue is related to the command line interface 2. Under The Hood Multiple areas of the app are influenced by this ticket 3. New Feature New feature 6. Major Change May cause breakage 7. Needs tests The work needs new test cases added labels Jul 23, 2021
HarryMichal added a commit to HarryMichal/toolbox that referenced this pull request Jul 29, 2021
HarryMichal added a commit to HarryMichal/toolbox that referenced this pull request Jul 29, 2021
HarryMichal added a commit to HarryMichal/toolbox that referenced this pull request Jul 29, 2021
HarryMichal added a commit to HarryMichal/toolbox that referenced this pull request Jul 29, 2021
HarryMichal added a commit to HarryMichal/toolbox that referenced this pull request Jul 29, 2021
HarryMichal added a commit to HarryMichal/toolbox that referenced this pull request Jul 29, 2021
HarryMichal added a commit to HarryMichal/toolbox that referenced this pull request Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. CLI Issue is related to the command line interface 2. Under The Hood Multiple areas of the app are influenced by this ticket 3. New Feature New feature 6. Major Change May cause breakage 7. Needs tests The work needs new test cases added
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants