File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -307,6 +307,36 @@ def process(self, output):
307
307
return items
308
308
309
309
310
+ class OsRelease (FactBase ):
311
+ """
312
+ Returns a dictionary of release information stored in ``/etc/os-release``.
313
+
314
+ .. code:: python
315
+
316
+ {
317
+ "name": "EndeavourOS",
318
+ "pretty_name": "EndeavourOS",
319
+ "id": "endeavouros",
320
+ "id_like": "arch",
321
+ "build_id": "2024.06.25",
322
+ ...
323
+ }
324
+ """
325
+
326
+ def command (self ):
327
+ return "cat /etc/os-release"
328
+
329
+ def process (self , output ):
330
+ items = {}
331
+
332
+ for line in output :
333
+ if "=" in line :
334
+ key , value = line .split ("=" , 1 )
335
+ items [key .strip ().lower ()] = value .strip ().strip ('"' )
336
+
337
+ return items
338
+
339
+
310
340
class Sysctl (FactBase ):
311
341
"""
312
342
Returns a dictionary of sysctl settings and values.
You can’t perform that action at this time.
0 commit comments