@@ -83,7 +83,7 @@ def __init__(self, basedir=None, log_packages=None, profiler=None):
8383 else :
8484 log .debug ("sudo_distros config is empty or missing" )
8585
86- def _load_sudo_list (raw_value , key ):
86+ def _load_sudo_list (raw_value , key ):
8787 # pylint: disable=wrong-spelling-in-docstring
8888 """
8989 If `raw_value` is a path to an INI file, read `[sysinfo] / key`
@@ -110,47 +110,6 @@ def _load_sudo_list(raw_value, key):
110110 dst .strip ().lower () for dst in sudo_distros_value .split ("," ) if dst .strip ()
111111 }
112112
113- # Retrieve the configured paths for sudo commands and distros from the settings dictionary
114- sudo_commands_conf = self .config .get ("sysinfo.sudo_commands" , "" )
115- sudo_distros_conf = self .config .get ("sysinfo.sudo_distros" , "" )
116-
117- if sudo_commands_conf :
118- log .info ("sudo_commands loaded from config: %s" , sudo_commands_conf )
119- else :
120- log .debug ("sudo_commands config is empty or missing" )
121-
122- if sudo_distros_conf :
123- log .info ("sudo_distros loaded from config: %s" , sudo_distros_conf )
124- else :
125- log .debug ("sudo_distros config is empty or missing" )
126-
127- def _load_sudo_list (raw_value , key ):
128- # pylint: disable=wrong-spelling-in-docstring
129- """
130- If `raw_value` is a path to an INI file, read `[sysinfo] / key`
131- from it; otherwise, treat `raw_value` itself as a CSV list.
132- """
133- if not raw_value :
134- return ""
135- if os .path .isfile (raw_value ):
136- config = configparser .ConfigParser ()
137- config .read (raw_value )
138- return config .get ("sysinfo" , key , fallback = "" )
139- return raw_value
140-
141- # Retrieve the actual sudo commands and distros values from the config files,
142- # falling back to empty string if the keys are missing
143- sudo_commands_value = _load_sudo_list (sudo_commands_conf , "sudo_commands" )
144- sudo_distros_value = _load_sudo_list (sudo_distros_conf , "sudo_distros" )
145-
146- self .sudo_commands = {
147- cmd .strip ().lower () for cmd in sudo_commands_value .split ("," ) if cmd .strip ()
148- }
149-
150- self .sudo_distros = {
151- dst .strip ().lower () for dst in sudo_distros_value .split ("," ) if dst .strip ()
152- }
153-
154113 if basedir is None :
155114 basedir = utils_path .init_dir ("sysinfo" )
156115 self .basedir = basedir
0 commit comments