Skip to content

Instantly share code, notes, and snippets.

@Glutexo
Last active November 9, 2021 21:26
Show Gist options
  • Save Glutexo/adf245185852455866012e8d27ecfcdd to your computer and use it in GitHub Desktop.
Save Glutexo/adf245185852455866012e8d27ecfcdd to your computer and use it in GitHub Desktop.
Data Collector patch for Insights Core to limit collection only to a single file
Index: insights/client/data_collector.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/insights/client/data_collector.py b/insights/client/data_collector.py
--- a/insights/client/data_collector.py (revision 42907d96132d4877ac588e6aa090b0cd4adbfcf1)
+++ b/insights/client/data_collector.py (date 1636398517420)
@@ -320,6 +320,13 @@
rm_commands = rm_conf.get('commands', [])
rm_files = rm_conf.get('files', [])
+ conf['commands'] = []
+ conf['globs'] = []
+ conf['files'] = filter(
+ lambda file: file['symbolic_name'] == 'sshd_config',
+ conf['files']
+ )
+
for c in conf['commands']:
# remember hostname archive path
if c.get('symbolic_name') == 'hostname':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment