aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2019-03-19 17:02:39 -0400
committerBryn M. Reeves <bmr@redhat.com>2019-03-25 16:56:29 +0000
commit9a9b529247329e7019e5bb016fcfb67e715d78f5 (patch)
tree93634f93821846c208a5282c62a4466be84cd1eb
parent295c702c730405c4bf6d6b7223f45d8790f0aca9 (diff)
downloadsos-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.py35
-rw-r--r--sos/policies/amazon.py35
-rw-r--r--sos/policies/redhat.py1
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 :