User-specified dependency error

For a few weeks, our Windows architect has been working on a ‘wabtec_ad_join’ cookbook that is just for our Window EC2 server builds. Per the pipeline in GitLab, he had only been manually running the windows build portion. Today, I was updating the ‘wabtec_carbonblack’ cookbook (which affects both windows and linux) and when I ran the CI/CD pipeline in our Gitlab, it errored out do to the following message:

Building policy wabtec_base_tools

Expanded run list: recipe[wabtec_chef_service_user], recipe[wabtec_cloudwatch_logs], recipe[wabtec_logrotate], recipe[wabtec_secrets], recipe[wabtec_timezone], recipe[wabtec_datadog], recipe[wabtec_carbonblack], recipe[wabtec_nessus], recipe[wabtec_ad_join]

Caching Cookbooks...
WARN: habitat cookbook missing metadata or no name field, skipping
WARN: policyfiles cookbook missing metadata or no name field, skipping
WARN: recipes cookbook missing metadata or no name field, skipping
WARN: results cookbook missing metadata or no name field, skipping
WARN: spec cookbook missing metadata or no name field, skipping
WARN: test cookbook missing metadata or no name field, skipping
Error: Failed to generate Policyfile.lock

Reason: (Solve::Errors::NoSolutionError) Unable to satisfy the following requirements:

  • wabtec_ad_join (>= 0.0.0) required by user-specified dependency

wabtec_base_tools: Build time: 1m18s
wabtec_base_tools: Exiting on error

What do I need to do to resolve this error so that our Linux builds will complete? The Windows builds work just fine.

This mat be mis-categorized? It is filed in Habitat Help but this looks like a chef-infra question. Nothing in the content seems to reference habitat.

It's part of the policyfile build in Habitat.

name 'wabtec_base_tools'

cookbook 'wabtec_chef_service_user'
cookbook 'wabtec_cloudwatch_logs'
cookbook 'wabtec_timezone'
#cookbook 'wabtec_system'
cookbook 'wabtec_logrotate'
cookbook 'wabtec_secrets'
cookbook 'wabtec_datadog'
cookbook 'wabtec_carbonblack'
cookbook 'wabtec_nessus'
cookbook 'wabtec_ad_join'

default_source :chef_repo, '../'
default_source :supermarket

run_list: chef-client will run these recipes in the order specified.

run chef service user twice. needs to run first for linux servers, and windows needs to run AFTER datadog cookbook.

run_list 'wabtec_chef_service_user',
'wabtec_cloudwatch_logs',
#'wabtec_system',
'wabtec_logrotate',
'wabtec_secrets',
'wabtec_timezone',
'wabtec_datadog',
'wabtec_carbonblack',
'wabtec_nessus',
'wabtec_ad_join'

After a little bit of a deep dive, found the problem. It was inside of the “wabtec_base_tools” .gitlab-ci.yml file. Since the run_list is for both windows and linux, the ‘git clone’ must be stated for both OS types. The “wabtec_ad_join” was only configured in the ‘Windows’ section, but missing from the ‘Linux’ section. Just to be safe, also added an if/else statement to the platform family check in the wabtec_ad_join default.rb, to help to prevent Linux systems on triggering the AD recipe code. Problem disappeared after these changes.