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

charmhelpers/contrib/openstack/deferred_events.py: get_service_start_time raises exception for services which have never been started #873

Open
Vultaire opened this issue Jan 9, 2024 · 0 comments

Comments

@Vultaire
Copy link

Vultaire commented Jan 9, 2024

This issue was first filed against https://bugs.launchpad.net/charm-ovn-chassis/+bug/2048806, but as I investigated the details, that bug appears to likely be due to a bug in charmhelpers, hence I'm creating a new bug here.

Specifically: I found that there appears to be a bug in charmhelpers/contrib/openstack/deferred_events.py in the get_service_start_time function. That function tries to parse the output of "systemctl show $SERVICE --property=ActiveEnterTimestamp" - but if the service has never been started before (thus returning "n/a"), the function will raise an exception.

Looking at the code today, it seems the issue still exists. The code assumes that a blank string might be returned, but it does not expect an "n/a" string.

As a concrete example, on an affected machine, this is what I see:

ubuntu@REDACTED:~$ systemctl show dpdk --property=ActiveEnterTimestamp
ActiveEnterTimestamp=n/a

This would clearly break when it hits the datetime.datetime.strptime call since "n/a" doesn't match the specified parse pattern.

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

No branches or pull requests

1 participant