[PATCH 4/7] tuna: Remove obsolete apply command functionality

John Kacur <[email protected]> Thu, 16 Jul 2026 13:45:47 -0400
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
Remove the broken apply command infrastructure that was disabled in
commit 959a16ce. The apply functionality conflicts with the recommended
tuned-based workflow for sysctl profile management.

Removed:
- apply_config() function (only called from commented-out code)
- Commented-out apply command handler
- Unused "profilename" argument definition
- Debug print statement in config.py
- Unreachable comment after raise statement

Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: John Kacur <[email protected]>
---
 tuna-cmd.py    | 28 ----------------------------
 tuna/config.py |  2 --
 2 files changed, 30 deletions(-)

diff --git a/tuna-cmd.py b/tuna-cmd.py
index 4eba82aac412..b78837c614e5 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -111,7 +111,6 @@ def gen_parser():
             "cpu_list": dict(metavar='CPU-LIST', type=tuna.cpustring_to_list, help="CPU-LIST affected by commands"),
             "thread_list": dict(metavar='THREAD-LIST', nargs='+', help="THREAD-LIST affected by commands"),
             "filename": dict(metavar='FILENAME', type=str, help="Save kthreads sched tunables to this file"),
-            "profilename": dict(type=str, help="Apply changes described in this file"),
             "run_command": dict(metavar='COMMAND', type=str, help="fork a new process and run the \"COMMAND\""),
             "priority": dict(type=tuna.get_policy_and_rtprio, metavar="POLICY:RTPRIO", help="Set thread scheduler tunables: POLICY and RTPRIO"),
           }
@@ -887,30 +886,6 @@ def i18n_init():
     gettext.install(app, localedir)
 
 
-def apply_config(filename):
-    from tuna.config import Config
-    config = Config()
-    if os.path.exists(filename):
-        config.config['root'] = os.getcwd() + "/"
-        filename = os.path.basename(filename)
-    else:
-        if not os.path.exists(config.config['root']+filename):
-            print(filename + _(" not found!"))
-            sys.exit(1)
-    if config.loadTuna(filename):
-        sys.exit(1)
-    ctrl = 0
-    values = {}
-    values['toapply'] = {}
-    for index in range(len(config.ctlParams)):
-        for opt in config.ctlParams[index]:
-            values['toapply'][ctrl] = {}
-            values['toapply'][ctrl]['label'] = opt
-            values['toapply'][ctrl]['value'] = config.ctlParams[index][opt]
-            ctrl = ctrl + 1
-    config.applyChanges(values)
-
-
 def list_config():
     from tuna.config import Config
     config = Config()
@@ -1661,9 +1636,6 @@ def main():
                         print(f"[ERROR] Invalid RT priority: {rtprio}. RT priorities must be 1-99", file=sys.stderr)
                         sys.exit(2)
 
-    # if args.command in ['apply', 'a']:
-    #     apply_config(args.profilename)
-
     if args.command in ['include', 'I']:
         tuna.include_cpus(args.cpu_list, utils.get_nr_cpus())
 
diff --git a/tuna/config.py b/tuna/config.py
index 63c9f23bb09b..7f0df96fa655 100644
--- a/tuna/config.py
+++ b/tuna/config.py
@@ -112,7 +112,6 @@ class Config:
         if profile[1]:
             raise RuntimeError(
                 _("Can't activate tuna profile in tuned daemon\n%s" % profile[1]))
-            # return False - unreachable code here!
         if not os.path.exists(ldir):
             try:
                 os.stat(ldir)
@@ -150,7 +149,6 @@ class Config:
         return True
 
     def loadTuna(self, profileName):
-        print(f'profileName = {profileName}')   # REMOVE
         err = self.checkConfigFile(self.config['root'] + profileName)
         if err != '':
             raise RuntimeError(_("Config file contain errors: ") + _(err))
-- 
2.55.0