Skip to content

Commit

Permalink
tuned-ppd: Remove the use of StrEnum
Browse files Browse the repository at this point in the history
To be compatible with Python 3.9.

Resolves: RHEL-68208
  • Loading branch information
zacikpa committed Nov 22, 2024
1 parent 35eed3c commit 18317ed
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tuned/ppd/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from tuned.utils.commands import commands
from tuned.consts import PPD_CONFIG_FILE
from tuned.ppd.config import PPDConfig, PPD_PERFORMANCE, PPD_POWER_SAVER
from enum import StrEnum
from enum import Enum
import threading
import dbus
import os
Expand All @@ -18,7 +18,7 @@
UPOWER_DBUS_PATH = "/org/freedesktop/UPower"
UPOWER_DBUS_INTERFACE = "org.freedesktop.UPower"

class PerformanceDegraded(StrEnum):
class PerformanceDegraded(Enum):
NONE = ""
LAP_DETECTED = "lap-detected"
HIGH_OPERATING_TEMPERATURE = "high-operating-temperature"
Expand Down Expand Up @@ -128,9 +128,9 @@ def _check_performance_degraded(self):
if os.path.exists(LAP_MODE_PATH) and self._cmd.read_file(LAP_MODE_PATH).strip() == "1":
performance_degraded = PerformanceDegraded.LAP_DETECTED
if performance_degraded != self._performance_degraded:
log.info("Performance degraded: %s" % performance_degraded)
log.info("Performance degraded: %s" % performance_degraded.value)
self._performance_degraded = performance_degraded
exports.property_changed("PerformanceDegraded", performance_degraded)
exports.property_changed("PerformanceDegraded", performance_degraded.value)

def initialize(self):
self._profile_holds = ProfileHoldManager(self)
Expand Down Expand Up @@ -216,7 +216,7 @@ def get_actions(self):

@exports.property_getter("PerformanceDegraded")
def get_performance_degraded(self):
return self._performance_degraded
return self._performance_degraded.value

@exports.property_getter("ActiveProfileHolds")
def get_active_profile_holds(self):
Expand Down

0 comments on commit 18317ed

Please sign in to comment.