puppetlabs / facter

Collect and display system facts
https://puppet.com/open-source/#osp
Apache License 2.0
616 stars 494 forks source link

Undefined method when querying GCE metadata #2732

Closed jiwonaid closed 3 weeks ago

jiwonaid commented 3 weeks ago

Hi team,

Starting from version 4.7.1, Facter is unable to read Gce metadata. This is because get_request is getting 4 parameters.

          #   get_request('https://example.com', { "Accept": 'application/json' }, { session: 2.4, connection: 5 })
          def get_request(url, headers = {}, timeouts = {}, proxy = true)
            make_request(url, headers, timeouts, 'GET', proxy)
          end

However, gce is sending 3 parameters, which is setting timeouts = false. To address this issue, I kindly request that you apply this pull request.

Thank you.

Fixes #2731

puppetlabs-jenkins commented 3 weeks ago

Can one of the admins verify this patch?

CLAassistant commented 3 weeks ago

CLA assistant check
All committers have signed the CLA.

joshcooper commented 3 weeks ago

Thank you @jiwonaid!

joshcooper commented 3 weeks ago

@jiwonaid two small nits before we can merge:

Could you remove BUG-2731 from your commit summary? If you add Fixes #2731 to the commit body, then the issue will be automatically closed when the PR is merged

Could you update your commit message to describe why this change was necessary? And including the error output is helpful

[2024-06-12 04:58:49.787568 ] DEBUG Facter::Util::Resolvers::Http - Trying to connect to http://metadata.google.internal/computeMetadata/v1/?recursive=true&alt=json but got: undefined method `[]' for false:FalseClass
jiwonaid commented 3 weeks ago

Hi @joshcooper,

I updated the commit. Please take a look.