chef-boneyard / delivery-sugar

DEPRECATED: Library cookbook that adds sugar to build cookbooks for Chef Delivery
Apache License 2.0
12 stars 26 forks source link

undefined method `[]' for nil:NilClass when attempting to pull workflow_stage with delivery sugar #40

Open sflaherty2009 opened 6 years ago

sflaherty2009 commented 6 years ago

In chef automate I am using delivery-sugar to run test kitchen for aws ec2. When running my recipe in the acceptance stage and attempting to use the workflow_stage variable I am presented with the following error.

   Recipe Compile Error in /tmp/kitchen/cache/cookbooks/dt_zks_kafka/recipes/default.rb
   ================================================================================

   NoMethodError
   -------------
   undefined method `[]' for nil:NilClass

   Cookbook Trace:
   ---------------
     /tmp/kitchen/cache/cookbooks/delivery-sugar/libraries/delivery_change.rb:46:in `initialize'
     /tmp/kitchen/cache/cookbooks/delivery-sugar/libraries/delivery_dsl.rb:439:in `new'
     /tmp/kitchen/cache/cookbooks/delivery-sugar/libraries/delivery_dsl.rb:439:in `change'
     /tmp/kitchen/cache/cookbooks/delivery-sugar/libraries/delivery_dsl.rb:211:in `workflow_stage'
     /tmp/kitchen/cache/cookbooks/dt_zks_kafka/recipes/server.rb:9:in `from_file'
     /tmp/kitchen/cache/cookbooks/dt_zks_kafka/recipes/default.rb:7:in `from_file'

   Relevant File Content:
   ----------------------
   /tmp/kitchen/cache/cookbooks/delivery-sugar/libraries/delivery_change.rb:

    39:      # rubocop:disable AbcSize
    40:      # rubocop:disable Metrics/MethodLength
    41:      # rubocop:disable AccessorMethodName
    42:      # rubocop:disable CyclomaticComplexity
    43:      # rubocop:disable PerceivedComplexity
    44:      #
    45:      def initialize(node)
    46>>       change = node['delivery']['change']
    47:        workspace = node['delivery']['workspace']
    48:        @build_user = node['delivery_builder']['build_user']
    49:        @workspace_repo = workspace['repo']
    50:        @workspace_cache = workspace['cache']
    51:        @workspace_chef = workspace['chef']
    52:        @workspace_root = workspace['root']
    53:        @workspace_path = node['delivery']['workspace_path'] ||
    54:                          '/var/opt/delivery/workspace'
    55:        @enterprise = change['enterprise']

   System Info:
   ------------
   chef_version=13.6.4
   platform=ubuntu
   platform_version=16.04
   ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
   program_name=chef-solo worker: ppid=1522;start=13:21:48;
   executable=/opt/chef/bin/chef-solo