Skip to content

Undefined method when querying GCE metadata#2732

Merged
joshcooper merged 1 commit intopuppetlabs:mainfrom
jiwonaid:main
Jun 13, 2024
Merged

Undefined method when querying GCE metadata#2732
joshcooper merged 1 commit intopuppetlabs:mainfrom
jiwonaid:main

Conversation

@jiwonaid
Copy link
Contributor

@jiwonaid jiwonaid commented Jun 12, 2024

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

@jiwonaid jiwonaid requested a review from a team as a code owner June 12, 2024 05:31
@puppetlabs-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@CLAassistant
Copy link

CLAassistant commented Jun 12, 2024

CLA assistant check
All committers have signed the CLA.

@joshcooper
Copy link
Contributor

Thank you @jiwonaid!

@joshcooper joshcooper added the triaged Jira issue has been created for this label Jun 12, 2024
@joshcooper
Copy link
Contributor

@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 jiwonaid changed the title [BUG-2731] Fix gce Fix gce Jun 13, 2024
Starting from version 4.7.1, Facter is unable to read Gce metadata like below.
[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

This is because get_request is getting 4 parameters.
This commit set timeouts = {}, to avoid timeouts = false.
@jiwonaid
Copy link
Contributor Author

Hi @joshcooper,

I updated the commit.
Please take a look.

@joshcooper joshcooper added the bug Something isn't working label Jun 13, 2024
@joshcooper joshcooper merged commit 43111c9 into puppetlabs:main Jun 13, 2024
@joshcooper joshcooper changed the title Fix gce Undefined method when querying GCE metadata Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working triaged Jira issue has been created for this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Facter can't read Gce metadata

4 participants