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

Make chef repo prefer policyfiles #563

Merged
merged 4 commits into from
Oct 19, 2015

Conversation

danielsdeleo
Copy link
Contributor

  • Replace roles/ and environments/ directories with a policies/ directory (also add a comment for how to reverse this if using the code in a custom generator).
  • Add a .chef-repo.txt file at the root of generated Chef Repos to allow chef-dk to adjust generator behavior for chef repos
  • Use given arguments to chef generate policyfile to set the policy name and run list; add a chef_repo source to generated policies when generating a policy in a chef repo.

@danielsdeleo
Copy link
Contributor Author

I need to figure out what to do about default_source :chef_repo evaluating relative paths as relative to the cwd instead of relative to the policyfile. If you generate a repo, make a policy in it, and then attempt to chef install that policy, you get this error:

chef install policies/hello.rb
Building policy hello
Expanded run list: recipe[example::default]
Caching Cookbooks...
WARN: bin cookbook missing metadata or no name field, skipping
WARN: demo cookbook missing metadata or no name field, skipping
WARN: lib cookbook missing metadata or no name field, skipping
WARN: spec cookbook missing metadata or no name field, skipping
WARN: test-scripts cookbook missing metadata or no name field, skipping
Error: Failed to generate Policyfile.lock
Reason: (Solve::Errors::NoSolutionError) Unable to satisfy the following requirements:

- `example (>= 0.0.0)` required by `user-specified dependency`

@lamont-granquist
Copy link
Contributor

exercise the oh-dotness of chef-dk and just fix it even though it might be breaking?

@danielsdeleo
Copy link
Contributor Author

Yeah, I think that's for the best

@danielsdeleo
Copy link
Contributor Author

With the latest commit, the path argument to chef repo is expanded relative to the dir the policyfiles are in, which is consistent with what we do for cookbooks with a path source.

@danielsdeleo danielsdeleo force-pushed the make-chef-repo-prefer-policyfiles branch from 6162a23 to 6543a96 Compare October 12, 2015 22:04
let(:expected_policyfile_path) { File.join(other_policy_dir, "my-app-middleware.rb") }

let(:expected_policyfile_content) do
<<-POLICYFILE_CONTENT
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to put this in a single let (maybe at the bottom of the file) rather than having it twice?

@randomcamel
Copy link
Contributor

lgtm, though I can't say I have the full context around the Policyfile implementation.

@danielsdeleo danielsdeleo force-pushed the make-chef-repo-prefer-policyfiles branch from 6543a96 to d8eb1c9 Compare October 19, 2015 18:44
@danielsdeleo danielsdeleo merged commit d8eb1c9 into master Oct 19, 2015
@danielsdeleo danielsdeleo deleted the make-chef-repo-prefer-policyfiles branch October 19, 2015 19:21
ksubrama pushed a commit that referenced this pull request Jan 11, 2016
Fix regression with postinst script
@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
None yet
Development

Successfully merging this pull request may close these issues.

4 participants