Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Add named_run_list support to provisioner #607

Merged
merged 2 commits into from
Nov 17, 2015

Conversation

danielsdeleo
Copy link
Contributor

Note that kitchen does a little bit of magic to distribute per-suite
configuration to the right place, so to use this to customize suites,
you have to explicitly name it as a provisioner customization, like:

suites:
  - name: default
    attributes:
  - name: other
    provisioner:
      named_run_list: example

It'd be nice to clean that up when we move policyfile support into kitchen proper. (See: https://github.com/test-kitchen/test-kitchen/blob/9b906c6292d9c183ffb5d631f7355c030790f058/lib/kitchen/data_munger.rb#L625-L688)

@chef/workflow

@tyler-ball
Copy link
Contributor

@danielsdeleo From your initial comment, are you saying if I have a .kitchen.yml like

---
driver:
  name: vagrant

provisioner:
  name: policyfile_zero
  named_run_lists: example

platforms:
  - name: ubuntu-14.04
  - name: centos-7.1

suites:
  - name: default1
    run_list:
      - recipe[test-audit::default]
    attributes:
  - name: default2
    run_list:
      - recipe[test-audit::other]
    attributes:

then it won't apply the named_run_lists to all 4 test runs?

@danielsdeleo
Copy link
Contributor Author

@tyler-ball it's the other way around. The use case that I got a specific request for was to make something like this possible with policyfiles:

suites:
  - name: client
    run_list:
      - recipe[something::client]
  - name: server
    run_list:
      - recipe[something::server]

When I was developing this patch I tried something like:

suites:
  - name: client
    named_run_list: test_client_recipe
  - name: server
    named_run_list: test_server_recipe

But I found that kitchen was not copying the named_run_list config from the per-suite config to the provisioner config. Reading the code for the data munger, I learned that kitchen special cases the run_list and attributes configuration, but otherwise you have to put provisioner customizations one level deeper, under the provisioner key, like:

suites:
  - name: client
    provisioner:
      named_run_list: test_client_recipe
  - name: server
    provisioner:
      named_run_list: test_server_recipe

When we eventually merge policyfile stuff into core test-kitchen, it would be nice to add named_run_list to the special cases in the data munger, but putting it under the provisioner key does work for now.

@tyler-ball
Copy link
Contributor

Ahhhhh, I understand! I think its fine to have provisioner:\n named_run_list replace run_list under each of the suites - its actually more clear IMO. Its not magic munging behind the scenes.

That said, I think its worth adding a README entry in addition to the automatically generated CHANGELOG

@danielsdeleo
Copy link
Contributor Author

@tyler-ball added a named_run_list section to POLICYFILE_README

@danielsdeleo danielsdeleo force-pushed the named-run-lists-kitchen branch from e43eee1 to 28b7fa9 Compare November 17, 2015 18:26
@danielsdeleo danielsdeleo added this to the 0.11.0 milestone Nov 17, 2015
Note that kitchen does a little bit of magic to distribute per-suite
configuration to the right place, so to use this to customize suites,
you have to explicitly name it as a provisioner customization, like:

```
suites:
  - name: default
    attributes:
  - name: other
    provisioner:
      named_run_list: example
```
@danielsdeleo danielsdeleo force-pushed the named-run-lists-kitchen branch from 28b7fa9 to 44b6ace Compare November 17, 2015 18:45
@danielsdeleo danielsdeleo merged commit 44b6ace into master Nov 17, 2015
@danielsdeleo danielsdeleo deleted the named-run-lists-kitchen branch November 17, 2015 20:15
@thommay thommay added Type: Enhancement Adds new functionality. and removed Enhancement labels Feb 1, 2017
@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Enhancement Adds new functionality.
Development

Successfully merging this pull request may close these issues.

4 participants