Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get username either by IMDS or from a local OVF file #100

Merged
merged 3 commits into from
Jul 11, 2024

Conversation

dongsupark
Copy link
Collaborator

Username can be obtained either via fetching instance metadata from IMDS or mounting a local device for OVF environment file. It should not fail immediately in a single failure, instead it should fall back to the other mechanism. So it is not a good idea to use ? for query() or get_environment().

Fixes #99

@dongsupark dongsupark force-pushed the fallback-imds-local branch 2 times, most recently from 2d2a9df to 5171131 Compare July 5, 2024 10:14
@dongsupark dongsupark marked this pull request as ready for review July 10, 2024 13:24
@dongsupark
Copy link
Collaborator Author

Pushed commits to fix minor issues in the e2e tests script.

@SeanDougherty Could you please retest with this PR, to see if the issue of #99 was gone?

I myself tried to run e2e tests with an Azure Linux gallery image, MicrosoftCBLMariner:azure-linux:azure-linux-gen2:3.20240510.01, and could not see the booting issue described. Though I am not sure if the current e2e test coverage would be enough for making the booting issue visible.
(After booting I actually hit useradd issues as already known, which would be addressed in separate PRs.)

@SeanDougherty
Copy link

Pushed commits to fix minor issues in the e2e tests script.

@SeanDougherty Could you please retest with this PR, to see if the issue of #99 was gone?

I myself tried to run e2e tests with an Azure Linux gallery image, MicrosoftCBLMariner:azure-linux:azure-linux-gen2:3.20240510.01, and could not see the booting issue described. Though I am not sure if the current e2e test coverage would be enough for making the booting issue visible. (After booting I actually hit useradd issues as already known, which would be addressed in separate PRs.)

After retesting, I can confirm this has resolved the issue. Thank you Dongsu!

And, yes, as you had mentioned, there are other issues with useradd that are being addressed in this PR

LGTM

Copy link
Member

@jeremycline jeremycline left a comment

Choose a reason for hiding this comment

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

A few superficial notes, but nothing blocking. At some point we should have the library provide a nice interface for this, but we can tackle that later.

src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
Username can be obtained either via fetching instance metadata from IMDS
or mounting a local device for OVF environment file. It should not fail
immediately in a single failure, instead it should fall back to the other
mechanism. So it is not a good idea to use `?` for query() or
get_environment().

Explicitly get instance metadata to handle error of missing instance metadata
before dealing with setting ssh keys or hostname.
When running functional tests, pass in --security-type, usually
`TrustedLaunch`, which is nowadays the default for most VMs.
It is still possible to override the security type by passing in
an environment variable $VM_SECURITY_TYPE, like `Standard`.
@jeremycline jeremycline merged commit dee43fa into Azure:main Jul 11, 2024
5 checks passed
balakreddy pushed a commit to balakreddy/azure-init that referenced this pull request Jul 19, 2024
* Get username either by IMDS or from a local OVF file

Username can be obtained either via fetching instance metadata from IMDS
or mounting a local device for OVF environment file. It should not fail
immediately in a single failure, instead it should fall back to the other
mechanism. So it is not a good idea to use `?` for query() or
get_environment().

Explicitly get instance metadata to handle error of missing instance metadata
before dealing with setting ssh keys or hostname.

* tests: pass in security type when creating VM

When running functional tests, pass in --security-type, usually
`TrustedLaunch`, which is nowadays the default for most VMs.
It is still possible to override the security type by passing in
an environment variable $VM_SECURITY_TYPE, like `Standard`.

* tests: address shellcheck warnings in functional_tests.sh
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.

[BUG] media::get_environment attempts to locate a non-existent CDROM device on AzureLinux
3 participants