canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.74k stars 833 forks source link

Don't Depend on GNU Date #4357

Open holmanb opened 11 months ago

holmanb commented 11 months ago

https://github.com/canonical/cloud-init/pull/4347 added support for cloud-init analyze dump on FreeBSD, which might not have GNU Date installed. This raises the point that shelling out once per line isn't efficient, and this is something that we should be able to do in Python code. This will improve portability as well.

The codepath that uses date isn't actually taken on Ubuntu. If possible it might be best to transitionally log a warning anytime parse_timestamp_from_date() is called to gather the date format so that we can implement this in Python.

blackboxsw commented 10 months ago

For this issue, I agree logging a warning to the console on encountering an unsupported timestamp asking for a bug to be filed would be helpful so we can add the python logic to cope with other formats on different distributions better.

I agree it's not shell out and invoke date command on systems but I also do not think we should look to prioritize exploring more efficiency improvements beyond suggesting that the user file an issue.

I think investing more time in generic efficiency improvements with the analyze tool show have low-priority for the following reasons:

holmanb commented 10 months ago

I also do not think we should look to prioritize exploring more efficiency improvements beyond suggesting that the user file an issue.

Agreed, compatibility and eliminating dependencies are the primary reasons here, which I did not express well in the initial report.