diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2019-03-19 17:02:39 -0400 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-03-25 16:56:29 +0000 |
commit | 9a9b529247329e7019e5bb016fcfb67e715d78f5 (patch) | |
tree | 93634f93821846c208a5282c62a4466be84cd1eb | |
parent | 295c702c730405c4bf6d6b7223f45d8790f0aca9 (diff) | |
download | sos-9a9b529247329e7019e5bb016fcfb67e715d78f5.tar.gz |
[amazon] Add Amazon Linux policy
Adds a policy for Amazon Linux. As Amazon Linux is a RHEL clone, it
inherits from the base RedHatPolicy and uses the RedHatPlugin tagging
class.
Fixes: #1563
Resolves: #1619
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/amazon.py | 35 | ||||
-rw-r--r-- | sos/policies/amazon.py | 35 | ||||
-rw-r--r-- | sos/policies/redhat.py | 1 |
3 files changed, 70 insertions, 1 deletions
diff --git a/sos/plugins/amazon.py b/sos/plugins/amazon.py new file mode 100644 index 00000000..9753d6e0 --- /dev/null +++ b/sos/plugins/amazon.py @@ -0,0 +1,35 @@ +# Copyright (C) Steve Conklin <sconklin@redhat.com> + +# This file is part of the sos project: https://github.com/sosreport/sos +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# version 2 of the GNU General Public License. +# +# See the LICENSE file in the source distribution for further information. + +# This enables the use of with syntax in python 2.5 (e.g. jython) +from __future__ import print_function + +from sos.policies.redhat import RedHatPolicy, OS_RELEASE + + +class AmazonPolicy(RedHatPolicy): + + distro = "Amazon Linux" + vendor = "Amazon" + vendor_url = "https://aws.amazon.com" + + def __init__(self, sysroot=None): + super(AmazonPolicy, self).__init__(sysroot=sysroot) + + @classmethod + def check(cls): + with open(OS_RELEASE, 'r') as f: + for line in f: + if line.startswith('NAME'): + if 'Amazon Linux' in line: + return True + return False + +# vim: set et ts=4 sw=4 : diff --git a/sos/policies/amazon.py b/sos/policies/amazon.py new file mode 100644 index 00000000..9753d6e0 --- /dev/null +++ b/sos/policies/amazon.py @@ -0,0 +1,35 @@ +# Copyright (C) Steve Conklin <sconklin@redhat.com> + +# This file is part of the sos project: https://github.com/sosreport/sos +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# version 2 of the GNU General Public License. +# +# See the LICENSE file in the source distribution for further information. + +# This enables the use of with syntax in python 2.5 (e.g. jython) +from __future__ import print_function + +from sos.policies.redhat import RedHatPolicy, OS_RELEASE + + +class AmazonPolicy(RedHatPolicy): + + distro = "Amazon Linux" + vendor = "Amazon" + vendor_url = "https://aws.amazon.com" + + def __init__(self, sysroot=None): + super(AmazonPolicy, self).__init__(sysroot=sysroot) + + @classmethod + def check(cls): + with open(OS_RELEASE, 'r') as f: + for line in f: + if line.startswith('NAME'): + if 'Amazon Linux' in line: + return True + return False + +# vim: set et ts=4 sw=4 : diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py index a1f3b2ed..6aec7828 100644 --- a/sos/policies/redhat.py +++ b/sos/policies/redhat.py @@ -447,5 +447,4 @@ class FedoraPolicy(RedHatPolicy): self.all_pkgs_by_name_regex("fedora-release-.*")[-1] return int(pkg["version"]) - # vim: set et ts=4 sw=4 : |