forked from sosreport/sos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Policy] Consolidate check() across policies
There is a common theme for new policies to subclass an existing one and just update the `check()` method. In almost all instances, the `check()` method remains almost entirely the same, simply changing a release file name or string. Reduce repeating ourselves by consolidating this into the base `LinuxPolicy.check()`, and leverage per-policy class attributes `os_release_file`, `os_release_name`, and `os_release_id`. The first of which will enable a policy if the specified file is found. Failing that, `os_release_name` is used to check the `NAME` field in `/etc/os-release`, and `os_release_id` is used to check the `ID` field in the same file if the name pattern does not match (or is not set). Note that we do _not_ check the `ID_LIKE` field. This allows a policy to be defined with as little as something like the following: ``` class MyPolicy(LinuxPolicy): vendor = 'Myself' os_release_file = '/etc/mylinux-release' os_release_name = 'MyLinux' os_release_id ='mynix' ``` Resolves: sosreport#1934 Signed-off-by: Jake Hunsaker <[email protected]>
- Loading branch information
1 parent
5177384
commit a0035b6
Showing
19 changed files
with
108 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.