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 native policyfile resolution support #1014

Merged
merged 2 commits into from Apr 21, 2016

Conversation

danielsdeleo
Copy link
Contributor

Auto detects policyfiles and uses them for resolution. It's a bit wonky in that it only works with the chef_zero provisioner, but chef_solo seems to still be the default, so you have to at least add provisioner: chef_zero to your kitchen YAML. I tested with a kitchen YAML like:

provisioner: chef_zero

platforms:
  - name: ubuntu-14.04

suites:
  - name: default
    attributes:
      rando_attr: hello from rando
    named_run_list: foo 

I confirmed the named run list functionality works, and also attributes work as expected, so it will fix chef-boneyard/chef-dk#460

# @return [String] an absolute path to a Policyfile, relative to the
# kitchen root
# @api private
def policyfile
Copy link
Member

Choose a reason for hiding this comment

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

This is also in chef_base. can we consolidate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This logic is also duplicated for the berks and librarian resolvers. If you want I could refactor all of them, but I didn't want to have one pre-refactored and the others not-refactored.

Copy link
Member

Choose a reason for hiding this comment

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

oh ok. thats fine. we can refactor separately.

@mwrock
Copy link
Member

mwrock commented Apr 21, 2016

@danielsdeleo
Copy link
Contributor Author

A note about the policyfile_zero provisioner: I'd like this to replace that and have that one start emitting deprecation warnings as soon as this patch makes its way into ChefDK. 95% of the policyfile functionality as it relates to kitchen is that of a resolver, and at the moment those are not pluggable, so it's a lot better to have it built-in (auto detection and so on). This will also be easier to use with named_run_list since the data munger is patched to make it work the way users are used to. I guess tl;dr, with this patch there's no reason to use the policyfile_zero provisioner any more and we might as well only maintain one thing that does this.

@mwrock
Copy link
Member

mwrock commented Apr 21, 2016

Oh got it @danielsdeleo yeah this is WAY better than the provisioner. I'm 👍 here pending we handle the ENOENT scenario above.

@danielsdeleo
Copy link
Contributor Author

@mwrock done

@danielsdeleo danielsdeleo force-pushed the native-policyfile-provisioning branch from ade710a to 57927ea Compare April 21, 2016 21:44
@adamleff
Copy link
Contributor

This is sweet. 👍

@danielsdeleo danielsdeleo merged commit 57927ea into master Apr 21, 2016
@danielsdeleo danielsdeleo deleted the native-policyfile-provisioning branch April 21, 2016 22:11
taylormonacelli added a commit to taylormonacelli/chef_dotfiles that referenced this pull request Jun 25, 2017
@test-kitchen test-kitchen locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attributes ignored in kitchen.yml with policyfile_zero provisioner
5 participants