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

FR-5549 - Make sure customized cloud-init files are valid #147

Merged
merged 3 commits into from Oct 3, 2023

Conversation

upils
Copy link
Collaborator

@upils upils commented Oct 2, 2023

Fixes LP: #2032585

@upils upils requested a review from sil2100 October 2, 2023 09:36
@codecov
Copy link

codecov bot commented Oct 2, 2023

Codecov Report

Merging #147 (81450d5) into main (40cf462) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #147      +/-   ##
==========================================
- Coverage   87.33%   87.32%   -0.02%     
==========================================
  Files          11       11              
  Lines        2440     2438       -2     
==========================================
- Hits         2131     2129       -2     
  Misses        289      289              
  Partials       20       20              
Files Coverage Δ
internal/statemachine/classic_states.go 97.86% <100.00%> (-0.01%) ⬇️

Copy link
Collaborator

@sil2100 sil2100 left a comment

Choose a reason for hiding this comment

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

By principle, I think what we want is to warn or error-out on users submitting wrong cloud-init file contents instead of implicitly fixing the input for them. I know this might be a bit of an additional burden for users, but the idea behind the cloud-init customization was always: allow providing 1-to-1 contents for the respective cloud-init metadata. So I'm thinking of these as 1:1 content per what is in the image definition. Adding things without the users knowing seems weird. Also, it might encourage people to misunderstand how proper cloud-init files should be structured - if someone forgets to add the #cloud-init header, then they might forget to do it when they're not using ubuntu-image.

So I'd recommend us erroring out, or maybe only warning, when someone provides an 'invalid' cloud-init file instead of doing it for them.

@upils upils changed the title Make sure customized cloud-init files are valid FR-5549 - Make sure customized cloud-init files are valid Oct 2, 2023
@upils
Copy link
Collaborator Author

upils commented Oct 2, 2023

OK, I understand the position and I agree with having a 1:1 content between a proper cloud-init and the content of the image definition.
I will fix this to error-out because I really fear a simple warning might be too easy to ignore. I suppose that if users set a cloud-init config they expect it to be valid in the end and not end up in the situation we encounter right now.

@upils upils requested a review from sil2100 October 2, 2023 12:05
Copy link
Collaborator

@sil2100 sil2100 left a comment

Choose a reason for hiding this comment

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

Looking good! Test coverage is good as well. Let me merge this.

@sil2100 sil2100 merged commit b07b50f into main Oct 3, 2023
10 of 12 checks passed
@sil2100 sil2100 deleted the cloud-init-invalid-customization branch October 3, 2023 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants