From edde55febc7ec2284e1f1475964da07d1ac127ab Mon Sep 17 00:00:00 2001 From: Luigi Toscano Date: Thu, 30 Mar 2017 19:37:47 +0200 Subject: [PATCH] _get_os_distrib() can return 'redhat', add mapping The unified function returns simply 'redhat' and not 'redhatenterpriselinux' when executed against RHEL systems. Add the mapping to enable few validations and other operations. Change-Id: Ifcc85703a788d2960d20792d817a490f382c1f88 --- sahara/plugins/images.py | 1 + sahara/plugins/mapr/services/mysql/mysql.py | 2 +- sahara/service/edp/shares.py | 1 + sahara/service/volumes.py | 1 + sahara/tests/unit/plugins/test_images.py | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sahara/plugins/images.py b/sahara/plugins/images.py index 841113ed..d15c83af 100644 --- a/sahara/plugins/images.py +++ b/sahara/plugins/images.py @@ -183,6 +183,7 @@ class SaharaImageValidatorBase(ImageValidator): 'centos': 'redhat', 'centos7': 'redhat', 'fedora': 'redhat', + 'redhat': 'redhat', 'redhatenterpriseserver': 'redhat', 'ubuntu': 'debian' } diff --git a/sahara/plugins/mapr/services/mysql/mysql.py b/sahara/plugins/mapr/services/mysql/mysql.py index 51d4a06d..d2ab7837 100644 --- a/sahara/plugins/mapr/services/mysql/mysql.py +++ b/sahara/plugins/mapr/services/mysql/mysql.py @@ -58,7 +58,7 @@ class MySQL(s.Service): return 'mysql' if distro.lower() == 'suse': return 'mysqld' - if distro.lower() in ['centos', 'redhatenterpriseserver']: + if distro.lower() in ['centos', 'redhatenterpriseserver', 'redhat']: if distro_version.split('.')[0] == '7': return 'mariadb' return 'mysqld' diff --git a/sahara/service/edp/shares.py b/sahara/service/edp/shares.py index 69593608..31af77be 100644 --- a/sahara/service/edp/shares.py +++ b/sahara/service/edp/shares.py @@ -219,6 +219,7 @@ class _NFSMounter(_ShareHandler): "centos": _REDHAT_INSTALL, "fedora": _REDHAT_INSTALL, "redhatenterpriseserver": _REDHAT_INSTALL, + "redhat": _REDHAT_INSTALL, "ubuntu": _DEBIAN_INSTALL } diff --git a/sahara/service/volumes.py b/sahara/service/volumes.py index 25ae3595..42d9f8b3 100644 --- a/sahara/service/volumes.py +++ b/sahara/service/volumes.py @@ -70,6 +70,7 @@ def _check_installed_xfs(instance): "centos": redhat, "fedora": redhat, "redhatenterpriseserver": redhat, + "redhat": redhat, "ubuntu": debian, 'debian': debian } diff --git a/sahara/tests/unit/plugins/test_images.py b/sahara/tests/unit/plugins/test_images.py index 81abe600..d63a88b4 100644 --- a/sahara/tests/unit/plugins/test_images.py +++ b/sahara/tests/unit/plugins/test_images.py @@ -201,7 +201,7 @@ class TestImages(b.SaharaTestCase): "rpm -q java-8 hadoop", run_as_root=True) self.assertEqual(remote.execute_command.call_count, 1) - image_arguments = {"distro": 'redhatenterpriseserver'} + image_arguments = {"distro": 'redhat'} packages = [cls.Package("java", "8"), cls.Package("hadoop")] validator = images.SaharaPackageValidator(packages) remote = mock.Mock()