aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2015-01-27 13:53:34 -0500
committerBryn M. Reeves <bmr@redhat.com>2015-07-08 17:05:22 +0100
commitb880c6cb4668815b97841e6532450144a5f825f1 (patch)
treec8392d18e3600a40c0b64dd7a1e536b7e0e3ff3f
parent259897b60b0e4ee00585a8d73521fa4e291eb8da (diff)
downloadsos-b880c6cb4668815b97841e6532450144a5f825f1.tar.gz
[policies/redhat] add Red Hat Atomic Host policy
Add a new policy for the Red Hat Atomic Host. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/policies/redhat.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
index 3cf40b33..9decd0a7 100644
--- a/sos/policies/redhat.py
+++ b/sos/policies/redhat.py
@@ -37,6 +37,7 @@ class RedHatPolicy(LinuxPolicy):
distro = "Red Hat"
vendor = "Red Hat"
vendor_url = "http://www.redhat.com/"
+ _redhat_release = '/etc/redhat-release'
_tmp_dir = "/var/tmp"
_rpmq_cmd = 'rpm -qa --queryformat "%{NAME}|%{VERSION}\\n"'
_in_container = False
@@ -159,7 +160,7 @@ No changes will be made to system configuration.
def check(self):
"""This method checks to see if we are running on RHEL. It returns True
or False."""
- return (os.path.isfile('/etc/redhat-release') and not
+ return (os.path.isfile(self._redhat_release) and not
os.path.isfile('/etc/fedora-release'))
def dist_version(self):
@@ -193,6 +194,42 @@ No changes will be made to system configuration.
return self.rhn_username() or self.host_name()
+class RedHatAtomicPolicy(RHELPolicy):
+ distro = "Red Hat Atomic Host"
+ msg = _("""\
+This command will collect diagnostic and configuration \
+information from this %(distro)s system.
+
+An archive containing the collected information will be \
+generated in %(tmpdir)s and may be provided to a %(vendor)s \
+support representative.
+
+Any information provided to %(vendor)s will be treated in \
+accordance with the published support policies at:\n
+ %(vendor_url)s
+
+The generated archive may contain data considered sensitive \
+and its content should be reviewed by the originating \
+organization before being passed to any third party.
+%(vendor_text)s
+""")
+
+ @classmethod
+ def check(self):
+ atomic = False
+ if ENV_HOST_SYSROOT not in os.environ:
+ return atomic
+ host_release = os.environ[ENV_HOST_SYSROOT] + self._redhat_release
+ if not os.path.exists(host_release):
+ return False
+ try:
+ for line in open(host_release, "r").read().splitlines():
+ atomic |= 'Atomic' in line
+ except:
+ pass
+ return atomic
+
+
class FedoraPolicy(RedHatPolicy):
distro = "Fedora"