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

When using include_policy with no run_list, 'run_list cannot be empty' emitted #39

Open
PeterGrace opened this issue Jul 3, 2018 · 4 comments
Labels
Triage: Confirmed Indicates and issue has been confirmed as described. Triage: Needs Information Indicates an issue needs more information in order to work on it. Type: Bug Does not work as expected.

Comments

@PeterGrace
Copy link

Description

When using include_policy in a Policyfile, if you follow a pattern of using a single Policyfile to define multiple actions via include_policies without specifying run_list, the Policyfile generation will fail with

Reason: (ChefDK::PolicyfileError) Invalid run_list. run_list cannot be empty

However, it would stand to reason that if you are including policies into your Policyfile, that the parser should take the run_lists from those included policies into account before claiming there's no run_list.

ChefDK Version

Chef Development Kit Version: 3.0.36
chef-client version: 14.1.12
delivery version: master (7206afaf4cf29a17d2144bb39c55b7212cfafcc7)
berks version: 7.0.2
kitchen version: 1.21.2
inspec version: 2.1.72

Platform Version

CentOS 7

Replication Case

  • Create a policy (A) that has a run_list
  • Create a policy (B) that includes policy A, but has no run_list in the Policyfile.
  • Execute chef install Policyfile.rb on Policy B
  • You will receive Reason: (ChefDK::PolicyfileError) Invalid run_list. run_list cannot be empty

Stacktrace

Error: Failed to generate Policyfile.lock
Reason: (ChefDK::PolicyfileError) Invalid run_list. run_list cannot be empty


/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-dk-3.0.36/lib/chef-dk/policyfile_compiler.rb:88:in `error!'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-dk-3.0.36/lib/chef-dk/policyfile_services/install.rb:93:in `generate_lock_and_install'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-dk-3.0.36/lib/chef-dk/policyfile_services/install.rb:62:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-dk-3.0.36/lib/chef-dk/command/install.rb:78:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-dk-3.0.36/lib/chef-dk/command/base.rb:58:in `run_with_default_options'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-dk-3.0.36/lib/chef-dk/cli.rb:73:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/chef-dk-3.0.36/bin/chef:25:in `<top (required)>'
/opt/chefdk/bin/chef:270:in `load'
/opt/chefdk/bin/chef:270:in `<main>'
@PeterGrace PeterGrace changed the title When using include_policy with no run_list in the parent policy, 'run_list cannot be empty' emitted When using include_policy with no run_list, 'run_list cannot be empty' emitted Jul 3, 2018
@tyler-ball tyler-ball transferred this issue from chef-boneyard/chef-dk Sep 30, 2019
@tyler-ball tyler-ball added Aspect: Correctness Triage: Confirmed Indicates and issue has been confirmed as described. Triage: Needs Information Indicates an issue needs more information in order to work on it. Type: Bug Does not work as expected. labels Sep 30, 2019
@tyler-ball
Copy link
Contributor

Moved this to the chef-cli repo and triaged it. I added the Needs Information tag because I want to go repro this with the latest version of Chef Workstation, but I have a feeling it is still an issue.

Thanks @PeterGrace for the report! I agree with your logic about the run-list not being empty even though thats what the error complains about.

@mrmarbury
Copy link

Is there a workaround other than adding a random item that is in the inherited run_list anyway?

@tas50
Copy link
Contributor

tas50 commented Feb 11, 2020

This is being worked in the chef/chef repo itself

@YAMLcase
Copy link

This is being worked in the chef/chef repo itself

Would you provide a link to the issue you're referencing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage: Confirmed Indicates and issue has been confirmed as described. Triage: Needs Information Indicates an issue needs more information in order to work on it. Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

5 participants