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

(GH-2475) Allow entire inventory to be a plugin reference #2503

Merged
merged 1 commit into from Jan 5, 2021

Conversation

beechtom
Copy link
Contributor

This change allows an entire inventory to be a plugin reference. For
exmaple, the following inventory was previously invalid:

---
_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
    (#2475)

    Inventory files can now be specified with a plugin. For example, the
    following inventory file is now valid:

    ---
    _plugin: yaml
    filepath: /path/to/inventory_partial.yaml

@beechtom beechtom linked an issue Dec 18, 2020 that may be closed by this pull request
@beechtom beechtom marked this pull request as ready for review December 18, 2020 18:56
@beechtom beechtom requested a review from a team as a code owner December 18, 2020 18:56
@lucywyman
Copy link
Contributor

Ugh, needs a rebase :( Sorry I totally forgot about this!

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
  ```
Copy link
Contributor

@lucywyman lucywyman left a comment

Choose a reason for hiding this comment

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

Awesome! Verified this works with a top-level plugin and nested plugins and doesn't use additional keys (like a top level targets key). Also verified the group name merging warns if a name is set from the plugin, and that any group named all raises the collision error.

@lucywyman lucywyman merged commit eb329b0 into puppetlabs:main Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't merge name => all to inventoryfile before resolving reference
2 participants