Improve handlers.py error message

Bug #1739446 reported by Jacek Nykis
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
cloud-init
Expired
Wishlist
Unassigned

Bug Description

I saw messages like this during boot:

[ 11.519226] cloud-init[574]: Cloud-init v. 17.1 running 'init-local' at Wed, 20 Dec 2017 15:41:23 +0000. Up 11.47 seconds.
[ 11.524349] cloud-init[574]: 2017-12-20 15:41:23,687 - handlers.py[WARNING]: failed posting event: start: init-local/check-cache: attempting to read from cache [trust]
[ 11.536175] cloud-init[574]: 2017-12-20 15:41:23,688 - handlers.py[WARNING]: failed posting event: finish: init-local/check-cache: SUCCESS: no cache found
[ 11.554403] cloud-init[574]: 2017-12-20 15:41:23,722 - handlers.py[WARNING]: failed posting event: finish: init-local: SUCCESS: searching for local datasources

They were caused by a config problem on my side but those messages are very confusing. 2 of them contain words "WARNING", "failed" and "SUCCESS" so it's very unclear what they really are.

Ubuntu 16.04.3 LTS
cloud-init 17.1-27-geb292c18-0ubuntu1~16.04.1

Revision history for this message
Scott Moser (smoser) wrote :

Jacek,
Do you have a suggestion on what they should say ?

Its logging a WARNING that it failed to post an event.
that event is start/finish and the event passed or failed.

Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
Jacek Nykis (jacekn) wrote :

For SRE like myself I think those would help:
* log URL it tried posting to and reason it failed (timeout, connection refused, host not found, 500 response). This information would be useful for troubleshooting
* remove "SUCCESS" from "SUCCESS: no cache found". It's in caps so stands out. If I understand it correctly this SUCCESS is not that relevant here
* I think "attempting to read from cache" and "no cache found" messages are "INFO" or similar rather than "WARNINIG" but I may be misunderstanding them.

Revision history for this message
Jacek Nykis (jacekn) wrote :

So maybe something like this:

handlers.py[WARNING]: Failed posting event "finish" to "http://maas.server.host/foo/bar". Reason: "Connection timed out"

Revision history for this message
do3meli (d-info-e) wrote :

+1 for Jacek's suggestion. this would then mean:

handlers.py[WARNING]: Failed posting event "<event>" to <target>. Reason: <reason>.

Looking at the code in cloudinit/reporting/handlers.py i think its not a big deal to add the target and generally reformat the message a bit. the reason might be a bit trickier. i see that there are some exceptions in ./cloudinit/url_helper.py that we might could catch easier. but not sure if it helps. Maybe some additional and more customized exception classes are required in url_helper.py for that.

@Scott: what do you think about this?

Johnson Shi (johnsonshi)
Changed in cloud-init:
assignee: nobody → Johnson Shi (johnsonshi)
Johnson Shi (johnsonshi)
Changed in cloud-init:
assignee: Johnson Shi (johnsonshi) → nobody
Revision history for this message
James Falcon (falcojr) wrote :
Changed in cloud-init:
status: Confirmed → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.