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

[NetworkManager] Get system-connections files from other locations #3876

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions sos/report/plugins/networkmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#
# See the LICENSE file in the source distribution for further information.

import os
from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin


Expand All @@ -19,14 +18,21 @@ class NetworkManager(Plugin, RedHatPlugin, UbuntuPlugin):
packages = ('NetworkManager', 'network-manager')

def setup(self):
self.system_connection_files = [
"/etc/NetworkManager/system-connections/",
"/usr/lib/NetworkManager/system-connections/",
"/run/NetworkManager/system-connections/",
]

self.add_copy_spec(self.system_connection_files)

self.add_copy_spec([
"/etc/NetworkManager/NetworkManager.conf",
"/etc/NetworkManager/system-connections",
"/etc/NetworkManager/dispatcher.d",
"/etc/NetworkManager/conf.d",
"/usr/lib/NetworkManager/conf.d",
"/run/NetworkManager/conf.d",
"/var/lib/NetworkManager/NetworkManager-intern.conf"
"/var/lib/NetworkManager/NetworkManager-intern.conf",
])

self.add_journal(units="NetworkManager")
Expand Down Expand Up @@ -111,15 +117,12 @@ def test_nm_status(version=1):
})

def postproc(self):
for _, _, files in os.walk(
"/etc/NetworkManager/system-connections"):
for net_conf in files:
self.do_file_sub(
"/etc/NetworkManager/system-connections/"+net_conf,
r"(password|psk|mka-cak|password-raw|pin|preshared-key"
r"|private-key|secrets|wep-key[0-9])=(.*)",
r"\1=***",
)

for sc_path in self.system_connection_files:
self.do_path_regex_sub(
f"{sc_path}",
r"(password|psk|mka-cak|password-raw|pin|preshared-key"
r"|private-key|secrets|wep-key[0-9])=(.*)",
r"\1=***",
)

# vim: set et ts=4 sw=4 :
Loading