forked from puppetlabs/bolt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(puppetlabsGH-2475) Allow entire inventory to be a plugin reference
This change allows an entire inventory to be a plugin reference. For exmaple, the following inventory was previously invalid: ```yaml --- _plugin: yaml filepath: /path/to/inventory_partial.yaml ``` A top-level plugin like this used to be invalid as Bolt automatically added `'name' => 'all'` to the top of the loaded inventory, which would cause a plugin to receive a `name` parameter and (likely) error. Now, Bolt will resolve a top-level plugin reference, validate that the resolved data does not include a `name` key, and then merge in `'name' => 'all'`. !bug * **Allow entire inventory to be specified with a plugin** ([puppetlabs#2475](puppetlabs#2475)) Inventory files can now be specified with a plugin. For example, the following inventory file is now valid: ```yaml --- _plugin: yaml filepath: /path/to/inventory_partial.yaml ```
- Loading branch information
Showing
7 changed files
with
169 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module BoltSpec | ||
module EnvVar | ||
def with_env_vars(new_vars) | ||
new_vars.transform_keys!(&:to_s) | ||
|
||
begin | ||
old_vars = new_vars.keys.collect { |var| [var, ENV[var]] }.to_h | ||
ENV.update(new_vars) | ||
yield | ||
ensure | ||
ENV.update(old_vars) if old_vars | ||
end | ||
end | ||
end | ||
end |