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

Kernel Commandline: Fix 4271 #4273

Merged
merged 2 commits into from Jul 21, 2023
Merged

Conversation

holmanb
Copy link
Member

@holmanb holmanb commented Jul 21, 2023

Fix NoCloud kernel commandline key parsing

Currently >2 keys in NoCloud datasource are not
supported. Previously 250280 attempted to correct
no keys being supported, however that fix was only
partial since more than one key breaks datasource
detection.

Additionally add test coverage.

Fixes GH-4271

Copy link
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

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

LGTM

$ cat  > 1.sh  <<EOF
val="nocloud;s=http://my-url/;h=hostname"
echo -- PRIOR BEHAVIOR --
echo ${val%;*}
echo -- FIXED BEHAVIOR --
echo ${val%%;*}
EOF
$ sh ./1.sh
-- PRIOR BEHAVIOR --
nocloud;s=http://my-url/
-- FIXED BEHAVIOR --
nocloud

# discard anything after delimiter
val=${val%;*}
# discard anything after the first delimiter
val=${val%%;*}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ugh, excellent, and correct fix. bash variable truncation :/

@holmanb holmanb merged commit fda2ec6 into canonical:main Jul 21, 2023
26 checks passed
aciba90 pushed a commit to aciba90/cloud-init that referenced this pull request Jul 26, 2023
Currently >2 keys in NoCloud datasource are not
supported. Previously 250280 attempted to correct
no keys being supported, however that fix was only
partial since more than one key breaks datasource
detection.

Additionally add test coverage.

Fixes canonicalGH-4271
TheRealFalcon pushed a commit to TheRealFalcon/cloud-init that referenced this pull request Jul 26, 2023
Currently >2 keys in NoCloud datasource are not
supported. Previously 250280 attempted to correct
no keys being supported, however that fix was only
partial since more than one key breaks datasource
detection.

Additionally add test coverage.

Fixes canonicalGH-4271
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.

None yet

2 participants