cloudfoundry/bosh

Error: undefined method `debug' for nil:NilClass

medoror opened this issue · 2 comments

Describe the bug
A clear and concise description of what the bug is.
I attempted to add debug statements in the following file /lib/bosh/blobstore_client/base.rb
but getting errors that the existing logger is Nil.

To Reproduce
Steps to reproduce the behavior (example):

  1. Deploy a bosh director on vsphere with Opsman 2.9.0-build.106
  2. Modify this ruby file with the following
      def validate!(agent_blobstore_options, stemcell_api_version)
        return if can_sign_urls?(stemcell_api_version)

        has_all_required_creds = (required_credential_properties_list - agent_blobstore_options.keys).empty?

        return if has_all_required_creds

        logger.debug("test to see if logger can be invoked")
        raise(
          Director::BadConfig,
          "Inconsistent blobstore configuration: #{required_credential_properties_list.inspect} are required",
        )
      end

Expected behavior
Expected to see printout of "test to see if logger can be invoked" in the director logs

Logs
Logs

Versions (please complete the following information):

  • Infrastructure: vsphere
  • BOSH version 270.11.1
  • BOSH CLI version 6.2.1-a28042ac
releases:
- id: 61ae1a8c-6ed3-49b0-794b-3ad633d06d59
  name: bosh
  version: 270.11.1
- id: b95e4342-3d64-438f-6c0b-f8a40ce780ce
  name: bosh-vsphere-cpi
  version: 53.0.9
- id: 055414d6-3752-4071-710e-3ccd21efe988
  name: uaa
  version: 74.5.11
- id: dc7bff46-ec29-4766-6b20-15b12b27fd4f
  name: credhub
  version: 2.5.11
- id: ed045fac-a954-4fab-41e9-27f35b87d08c
  name: bosh-system-metrics-server
  version: 0.0.24
- id: cf3ac665-e7bf-4eae-69b5-c18d6d2d7de4
  name: os-conf
  version: 21.0.0
- id: f7ef73f8-c3fb-4e86-5ab8-3f6d90916be4
  name: backup-and-restore-sdk
  version: 1.17.2
- id: 7c9acfd0-77fe-464f-72ab-a510d02f32c2
  name: bpm
  version: 1.1.7
stemcells:
- alias: default
  os: ubuntu-xenial
  version: "621.55"
- alias: windows
  os: windows2019
  version: "2019.15"

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/172132066

The labels on this github issue will be updated when the story is started.

I think this has to do with ruby inheritance: the actual blobstore object being used isn't base.rb and so validate! isn't a first-class method on the 'real' client. Take a look at how create and create_object are working in the other clients. You could try @logger here? This isn't a bug with bosh, it's how ruby works. Closing this issue.