chef / chef/chef-cli

NoMethodError when parallel push of policyfile

Open
#41 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Triage: Needs Information Type: Bug
Dominant language
Ruby
Stars
18
Forks
23
Avg merge
5d 17h
Merged PRs (30d)
1

Description

Description

Trying to do parallel push of a single policyfile to multiple policy groups. This is being executed from a jenkins pipeline. I am guessing it is something to do with the lock file being accessed by more than once process at the same time.

ChefDK Version

I have tried this with 2.4.17 and 1.6.11

Platform Version

Windows Server 2012 R2

Replication Case

Create a batch file .bat or similar solution in order to create parallel exceution of the command chef push. I have been able to replicate this by having a bat file with start chef push ... with a total of 10 executions.

Stacktrace

Error: Invalid lockfile data
Reason: (NoMethodError) undefined method `[]' for nil:NilClass


C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-dk-2.4.17/lib/chef-dk/policyfile_lock.rb:402:in `set_name_from_lock_data'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-dk-2.4.17/lib/chef-dk/policyfile_lock.rb:270:in `build_from_lock_data'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-dk-2.4.17/lib/chef-dk/policyfile_services/push.rb:102:in `validate_lockfile'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-dk-2.4.17/lib/chef-dk/policyfile_services/push.rb:77:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-dk-2.4.17/lib/chef-dk/command/push.rb:74:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-dk-2.4.17/lib/chef-dk/command/base.rb:58:in `run_with_default_options'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-dk-2.4.17/lib/chef-dk/cli.rb:73:in `run'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-dk-2.4.17/bin/chef:25:in `<top (required)>'
C:/opscode/chefdk/embedded/bin/chef:23:in `load'
C:/opscode/chefdk/embedded/bin/chef:23:in `<main>'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/chef-dk/policyfile_lock.rb, especially set_name_from_lock_data and build_from_lock_data, then follow validation in lib/chef-dk/policyfile_services/push.rb. Reproduce the failure on Windows Server 2012 R2 by launching multiple chef push commands from a batch file, and confirm that parallel pushes no longer produce Invalid lockfile data or the NoMethodError.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.