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

Bolt should use a configuration inheritance model similar to the one used by 'git' #608

Closed
3 tasks done
trevor-vaughan opened this issue Aug 27, 2018 · 3 comments · Fixed by #1557
Closed
3 tasks done
Assignees
Labels
Feature New features and improvements.

Comments

@trevor-vaughan
Copy link

trevor-vaughan commented Aug 27, 2018

When running bolt I expected the configuration options to be stacked in a method similar to those of git since some options are repository specific and some are user specific and should not be in a shared repository.

I did not expect the local configuration to override my global configuration completely (though it is documented at https://puppet.com/docs/bolt/0.x/configuring_bolt.html and I simply missed it).

Config inheritance order (from lowest to highest)
On non-Windows systems, the default config paths searched are:

  1. /etc/puppetlabs/bolt/bolt.yaml
  2. ~/.puppetlabs/etc/bolt/bolt.yaml
  3. <boltdir>/bolt.yaml

On Windows systems, the default config paths searched are:

  1. C:\Program Files\Puppet Labs\Bolt\bolt.yaml
  2. %USERPROFILE%/.puppetlabs/etc/bolt/bolt.yaml
  3. <boltdir>/bolt.yaml

TODO:

  • Verify where Puppet looks for equivalent files on Windows
    Global: C:\ProgramData\PuppetLabs\bolt\etc
    Local: C:\Users\<user>\.puppetlabs\etc\bolt
    
  • Spike on how to merge configs. Any config options that's a hash should be evaluated for how it should be merged, and an RFC should be proposed to the Bolt team.
    https://gist.github.com/beechtom/f7b758893796d61a23c8ab868cf8b062
  • This should include a debug log message about what configs are being loaded and override precedence.
@lucywyman
Copy link
Contributor

@trevor-vaughan I think Alex has already talked to you about this, but just for visibility: There are some other features we'd like to add around this before implementing it so that users aren't blindsided by having configuration applied that they aren't sure where it's coming from (like a global config). We'll leave this open since long term we plan to address it, but we don't have immediate plans or fixing.

https://tickets.puppetlabs.com/browse/BOLT-795

@reidmv
Copy link
Contributor

reidmv commented Nov 6, 2018

@lucywyman fwiw, I have the same request as @trevor-vaughan. I want to be able to commit a bolt.yaml to my e.g. control-repo in Puppet, to capture project-level configuration settings. However, I can't commit user-level configuration for ssh, winrm, and so forth to this file.

I need configuration stacking in order to use Bolt on a team level rather than an individual level.

@MikaelSmith MikaelSmith added the Feature New features and improvements. label Dec 7, 2018
@op-ct
Copy link
Contributor

op-ct commented Nov 4, 2019

👍

The winner-takes-all nature of bolt.yaml files seems unusually restrictive when both users and projects can have good reasons to define their own settings. This behavior will seem even stranger if system configuration files are implemented for #759.

As things stand, it doesn't make much sense to invest important settings in ~/.puppetlabs/bolt/bolt.yaml, because none of them will work from any project directory—even if the only thing the directory's settings do is rename site-modules/.

FWIW, there have recently been similar requests in the puppetcommunity Slack:

op-ct added a commit to op-ct/bolt that referenced this issue Dec 12, 2019
This patch adds config files to specify default values for individual
users (puppetlabs#608, puppetlabs#1438) and system-wide (puppetlabs#759, puppetlabs#1438).
op-ct added a commit to op-ct/bolt that referenced this issue Dec 12, 2019
This patch adds config files to specify default values for individual
users (puppetlabs#608, puppetlabs#1438) and system-wide (puppetlabs#759, puppetlabs#1438).
@beechtom beechtom self-assigned this Jan 18, 2020
beechtom added a commit to beechtom/bolt that referenced this issue Jan 24, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 24, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 24, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 24, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 24, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 24, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 24, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 24, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 24, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 24, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
hestonhoffman added a commit to hestonhoffman/bolt that referenced this issue Jan 24, 2020
beechtom added a commit to beechtom/bolt that referenced this issue Jan 27, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 28, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 30, 2020
This change adds support for two new configuration files. In order from
highest precedence to lowest, the configuration files are:

- Project configuration

  `<boltdir>/bolt.yaml`

- User configuration

  `~/.puppetlabs/etc/bolt/bolt.yaml`

- System-wide configuration

  *nix: `/etc/puppetlabs/bolt/bolt.yaml`

  Windows: `%PROGRAMDATA%\PuppetLabs\bolt\etc\bolt.yaml`

When multiple configuration files are found, Bolt will employ the
following merge strategy:

- Shallow merge options that accept hashes

- Overwrite options that do not accept hashes

- Deep merge transport configuration options (e.g. `ssh`, `winrm`)

- Shallow merge configuration for individual plugins configured under
the `plugins` option.
beechtom added a commit to beechtom/bolt that referenced this issue Jan 30, 2020
beechtom added a commit to beechtom/bolt that referenced this issue Jan 30, 2020
beechtom added a commit to beechtom/bolt that referenced this issue Jan 30, 2020
beechtom added a commit to beechtom/bolt that referenced this issue Jan 31, 2020
beechtom added a commit to beechtom/bolt that referenced this issue Jan 31, 2020
nicklewis added a commit that referenced this issue Jan 31, 2020
(GH-608) Add support for multiple configuration files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New features and improvements.
Projects
None yet
6 participants