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

controller init: set _on_battery before switching profile #672

Merged

Conversation

AdamWill
Copy link
Contributor

Since 6ef5b58 , switch_profile expects self._on_battery to be set, but when it's called in Controller.initialize, it is called before we do self._on_battery = False , and will crash with
AttributeError: 'Controller' object has no attribute '_on_battery' if the requested profile is not the currently active one.

This fixes that by moving the call to switch_profile after self._on_battery is set.

Since 6ef5b58 , switch_profile expects self._on_battery to be
set, but when it's called in Controller.initialize, it is
called before we do self._on_battery = False , and will crash
with
AttributeError: 'Controller' object has no attribute '_on_battery'
if the requested profile is not the currently active one.

This fixes that by moving the call to switch_profile after
self._on_battery is set.

Signed-off-by: Adam Williamson <[email protected]>
@AdamWill
Copy link
Contributor Author

Full traceback from recent Fedora Rawhide update tests:

Aug 15 03:07:00 fedora tuned-ppd[1785]: Traceback (most recent call last):
Aug 15 03:07:00 fedora tuned-ppd[1785]:   File "/usr/sbin/tuned-ppd", line 53, in <module>
Aug 15 03:07:00 fedora tuned-ppd[1785]:     controller = controller.Controller(bus, tuned_iface)
Aug 15 03:07:00 fedora tuned-ppd[1785]:   File "/usr/lib/python3.13/site-packages/tuned/ppd/controller.py", line 106, in __init__
Aug 15 03:07:00 fedora tuned-ppd[1785]:     self.initialize()
Aug 15 03:07:00 fedora tuned-ppd[1785]:     ~~~~~~~~~~~~~~~^^
Aug 15 03:07:00 fedora tuned-ppd[1785]:   File "/usr/lib/python3.13/site-packages/tuned/ppd/controller.py", line 141, in initialize
Aug 15 03:07:00 fedora tuned-ppd[1785]:     self.switch_profile(self._base_profile)
Aug 15 03:07:00 fedora tuned-ppd[1785]:     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
Aug 15 03:07:00 fedora tuned-ppd[1785]:   File "/usr/lib/python3.13/site-packages/tuned/ppd/controller.py", line 166, in switch_profile
Aug 15 03:07:00 fedora tuned-ppd[1785]:     tuned_profile = self._config.ppd_to_tuned_battery[profile] if self._on_battery else self._config.ppd_to_tuned[profile]
Aug 15 03:07:00 fedora tuned-ppd[1785]:                                                                   ^^^^^^^^^^^^^^^^
Aug 15 03:07:00 fedora tuned-ppd[1785]: AttributeError: 'Controller' object has no attribute '_on_battery'

@AdamWill
Copy link
Contributor Author

You should probably turn off EPEL 7 and CentOS 7 stuff in CI. It's EOL.

@yarda
Copy link
Contributor

yarda commented Aug 19, 2024

/packit build

@yarda
Copy link
Contributor

yarda commented Aug 19, 2024

Thanks, LGTM.

@yarda
Copy link
Contributor

yarda commented Aug 19, 2024

F41 CI failure is unrelated.

@yarda
Copy link
Contributor

yarda commented Aug 19, 2024

RHEL-7/CentOS CI is fixed, we need it till ELS is supported.

@yarda yarda merged commit c082797 into redhat-performance:master Aug 19, 2024
15 of 16 checks passed
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

Successfully merging this pull request may close these issues.

2 participants