Skip to content

adds imds_available check#96

Merged
tomjemmett merged 2 commits intomainfrom
add_imds_available_check
Mar 26, 2026
Merged

adds imds_available check#96
tomjemmett merged 2 commits intomainfrom
add_imds_available_check

Conversation

@tomjemmett
Copy link
Copy Markdown
Member

before trying to get a managed token, perform a check to see if the endpoint is available. this times out significantly quicker than the get_managed_token function, and caches the result in an environment variable for future use

before trying to get a managed token, perform a check to see if the endpoint is available. this times out significantly quicker than the get_managed_token function, and caches the result in an environment variable for future use
Copilot AI review requested due to automatic review settings March 26, 2026 11:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a fast “IMDS available” probe before attempting managed-identity authentication, aiming to avoid the longer timeout path when running outside Azure and to cache the result for subsequent calls.

Changes:

  • Gate the managed-token attempt in get_auth_token() behind a new imds_available() check.
  • Introduce imds_available() (with generated documentation) that probes the IMDS/MSI endpoint and caches the result in IMDS_AVAILABLE.
  • Minor formatting alignment in the get_auth_token() examples/docs.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
R/get_auth_token.R Adds imds_available() and uses it to gate managed-token retrieval in get_auth_token().
man/imds_available.Rd New documentation page for imds_available().
man/get_auth_token.Rd Example indentation/formatting adjustment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@francisbarton francisbarton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you have a think about the comment - I'm not demanding a change but it might make sense to add in a defensive line somewhere.

@tomjemmett tomjemmett requested a review from Copilot March 26, 2026 11:37
@francisbarton
Copy link
Copy Markdown
Member

Thanks!

@tomjemmett
Copy link
Copy Markdown
Member Author

@francisbarton I've switched from as.logical to something a bit more defensive

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tomjemmett tomjemmett merged commit 16f0adb into main Mar 26, 2026
5 checks passed
@francisbarton francisbarton deleted the add_imds_available_check branch March 26, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants