-
Notifications
You must be signed in to change notification settings - Fork 881
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
Fix snapd growpart and final message warnings #5215
Fix snapd growpart and final message warnings #5215
Conversation
a71721c
to
5dc4b0b
Compare
cc: @Meulengracht for snap-related concerns. |
Thank you to everyone involved here for getting this ball rolling and fixed so quickly! |
52e64e9
to
6d5f33b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @blackboxsw, thanks for this PR. I just added some wording nits to hopefully make our docs a bit clearer.
cloudinit/config/cc_final_message.py
Outdated
log_func = LOG.debug | ||
else: | ||
log_func = LOG.warning | ||
log_func("Used fallback datasource") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plenty of other logs in the log file by this point would have indicated that the user is using DatasourceNone, so I don't see what this adds as a debug message. Maybe just log a warning if this is not the expected behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good pt. droppng debug version of msg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blackboxsw I'm guessing this was forgotten?
@@ -23,6 +23,11 @@ From lowest priority to highest, configuration sources are: | |||
|
|||
These four sources make up the base configuration. | |||
|
|||
.. note:: | |||
The base configuration files must be valid `YAML 1.1`_ syntax and they can | |||
be declared as :ref:`jinja templates <instancedata-Using>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base configuration files must be valid
YAML 1.1
_ syntax and they can be declared as :ref:jinja templates <instancedata-Using>
.
A jinja template that contains a base configuration is not necessarily valid yaml, so how can this be true? This seems self-contradictory.
We work around this with ## template: jinja
template headers, but this means that a base configuration file must be either YAML 1.1 or a jinja template using instance-data which, when rendered, produces a YAML 1.1 file.
Additionally, I don't think that the phrase "valid YAML 1.1 syntax" really accomplishes what I think you're trying to say. YAML 1.2 can be valid 1.1, but the point we're trying to make is that cloud-init uses the YAML 1.1 interpretation of the configuration.
Maybe something like this will help clarify this statement a bit?
The base configuration format uses `YAML version 1.1`_, but may be defined as jinja
templates which cloud-init will render at runtime with
:ref:`instance-data<instancedata-Using>` variables.
What do you think about making this content part of the first paragraph on this page?
doc/rtd/explanation/format.rst
Outdated
@@ -24,7 +24,7 @@ These things include: | |||
- *and many more...* | |||
|
|||
.. note:: | |||
This file must be valid YAML syntax. | |||
This file must be valid `YAML 1.1`_ syntax. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you didn't write this line, but while we're touching this line can we please update it to something that makes a little more sense?
The file isn't a syntax. YAML isn't a syntax either. YAML is a standardized language for defining data objects, and it has a syntax for describing these data objects as a stream of characters. Cloud-config is a format which uses the YAML syntax described in specification version 1.1 and a set of keys defined in the jsonschema.
This file ...
Additionally, this configuration is often times not even a file. Users may copy-paste a cloud-config into a web interface, for example, and ultimately on the instance they usually do not write a configuration file, so the mention of it being a file may be misleading to some.
Perhaps this paragraph:
Cloud-config is the simplest way to accomplish some things via user data.
Using cloud-config syntax, the user can specify certain things in a
human-friendly format.
Could be updated to say something like:
Cloud-config is the preferred user data format. The cloud config format is a
declarative syntax which uses YAML version 1.1 with keys that describe instance
state. Cloud-config can be used to define how an instance should be configured in
a human-friendly format.
And then remove the This file must be ...
note?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your updated suggestions. I've pulled the majority into the first paragraph of Cloud-config section as well as rewriting a couple of the apt-specific examples to more package format packaging format agnostic terms. CC @s-makin for doc review as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much to add beyond a couple of nits
@@ -79,3 +83,4 @@ images. | |||
|
|||
.. _Config: https://github.com/canonical/cloud-init/blob/b861ea8a5e1fd0eb33096f60f54eeff42d80d3bd/cloudinit/settings.py#L22 | |||
.. _cloud.cfg template: https://github.com/canonical/cloud-init/blob/main/config/cloud.cfg.tmpl | |||
.. _YAML 1.1: https://yaml.org/spec/1.1/current.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. _YAML 1.1: https://yaml.org/spec/1.1/current.html | |
.. _YAML version 1.1: https://yaml.org/spec/1.1/current.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mismatch is (I think) what's throwing the spellcheck error. Even though this isn't an error in the spelling.
7994c54
to
9fcbb9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pulled the majority into the first paragraph of Cloud-config section as well as rewriting a couple of the apt-specific examples to more package format packaging format agnostic terms.
Great idea. This is looking much better! I left a couple more questions and suggestions inline.
Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close. If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging TheRealFalcon, and he will ensure that someone takes a look soon. (If the pull request is closed and you would like to continue working on it, please do tag TheRealFalcon to reopen it.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no more updates to make, I'm just setting this to "request changes" to make it more obvious that this is waiting on @blackboxsw right now.
@blackboxsw since this will make DataSourceNone users no longer have a warning message we might want to squeeze this one into 24.2. I'm adding it to the milestone so that it doesn't slip by without a discussion (we can remove it if we decide it's not a priority). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the more specific text suggestions @holmanb . I've added them all.
- additional ``apt`` sources should be added | ||
- certain SSH keys should be imported | ||
- performing package upgrades on first boot | ||
- configuration of different package mirrors or sources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@holmanb here's the only unreviewed diff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @blackboxsw! Let's land it.
Update growpart schema messaging clarify having to quote the value of growpart: {mode: 'off'}
Avoid warning level log "Used fallback datasource" when base configuration defines `datasource_list: [ None ]`. Using DataSourceNone in this case is desired behavior. Also drop unused is_disconnected property from DataSource which was only used by DataSourceNone in cc_final_message. Instead compare based on dsname property. Fixes: canonicalGH-5192
4767da3
to
e2c6fc9
Compare
rebase merge use individual commits
Proposed Commit Message(s)
fix(final_message): do not warn on datasourcenone when single ds
Avoid warning level log "Used fallback datasource" when base
configuration defines
datasource_list: [ None ]
.Using DataSourceNone in this case is desired behavior.
Also drop unused is_disconnected property from DataSource
which was only used by DataSourceNone in cc_final_message.
Instead compare based on dsname property.
Fixes: Remove DataSourceNone warning in cc_final_message #5192
fix(growpart): correct growpart log message to include value of mode
Additional Context
Affects snapd UC24 which sets `datasource_list: [ None ]' in some configs
Test Steps
Checklist
Merge type