You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2015/03/27 18:27:13 UTC
[1/2] ambari git commit: AMBARI-10244. Ubuntu7 title for debian7
repourl is confusing (aonishuk)
Repository: ambari
Updated Branches:
refs/heads/trunk fd9649dd0 -> 36ac57824
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/SQOOP/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/SQOOP/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/SQOOP/metainfo.xml
index f837458..a63db43 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/SQOOP/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/SQOOP/metainfo.xml
@@ -39,7 +39,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>sqoop-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
index e2384a3..363cc79 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/metainfo.xml
@@ -32,7 +32,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>storm-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/TEZ/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/TEZ/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/TEZ/metainfo.xml
index 5e9d443..863f7dd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/TEZ/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/TEZ/metainfo.xml
@@ -32,7 +32,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>tez-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/metainfo.xml
index a8b35b3..d8ea8e8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/YARN/metainfo.xml
@@ -39,7 +39,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>hadoop-2-3-.*-yarn</name>
@@ -65,7 +65,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>hadoop-2-3-.*-mapreduce</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml
index fd41fcc..276b057 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml
@@ -31,7 +31,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>zookeeper-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/test/python/TestBootstrap.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestBootstrap.py b/ambari-server/src/test/python/TestBootstrap.py
index 373a4be..0dadaed 100644
--- a/ambari-server/src/test/python/TestBootstrap.py
+++ b/ambari-server/src/test/python/TestBootstrap.py
@@ -25,6 +25,7 @@ import logging
import tempfile
import pprint
+from ambari_commons.os_check import OSCheck
from bootstrap import PBootstrap, Bootstrap, SharedState, HostLog, SCP, SSH
from unittest import TestCase
from subprocess import Popen
@@ -123,31 +124,22 @@ class TestBootstrap(TestCase):
self.assertTrue(bootstrap_obj.generateRandomFileName(None) == bootstrap_obj.getUtime())
- @patch("os.path.isfile")
- @patch("__builtin__.open")
- def test_is_suse(self, open_mock, isfile_mock):
- shared_state = SharedState("root", "sshkey_file", "scriptDir", "bootdir",
- "setupAgentFile", "ambariServer", "centos6",
- None, "8440", "root")
- bootstrap_obj = Bootstrap("hostname", shared_state)
- isfile_mock.return_value = True
- f = open_mock.return_value
- f.read.return_value = " suse "
- self.assertTrue(bootstrap_obj.is_suse())
-
- @patch.object(Bootstrap, "is_suse")
- def test_getRepoDir(self, is_suse_mock):
+ @patch.object(OSCheck, "is_redhat_family")
+ @patch.object(OSCheck, "is_suse_family")
+ def test_getRepoDir(self, is_suse_family, is_redhat_family):
shared_state = SharedState("root", "sshkey_file", "scriptDir", "bootdir",
"setupAgentFile", "ambariServer", "centos6",
None, "8440", "root")
bootstrap_obj = Bootstrap("hostname", shared_state)
# Suse
- is_suse_mock.return_value = True
+ is_redhat_family.return_value = False
+ is_suse_family.return_value = True
res = bootstrap_obj.getRepoDir()
self.assertEquals(res, "/etc/zypp/repos.d")
# non-Suse
- is_suse_mock.return_value = False
+ is_suse_family.return_value = False
+ is_redhat_family.return_value = True
res = bootstrap_obj.getRepoDir()
self.assertEquals(res, "/etc/yum.repos.d")
@@ -389,10 +381,16 @@ class TestBootstrap(TestCase):
@patch.object(Bootstrap, "getRemoteName")
@patch.object(Bootstrap, "hasPassword")
- def test_getRepoFile(self, hasPassword_mock, getRemoteName_mock):
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
+ def test_getRepoFile(self, is_redhat_family, is_ubuntu_family, is_suse_family, hasPassword_mock, getRemoteName_mock):
shared_state = SharedState("root", "sshkey_file", "scriptDir", "bootdir",
"setupAgentFile", "ambariServer", "centos6",
None, "8440", "root")
+ is_redhat_family.return_value = True
+ is_ubuntu_family.return_value = False
+ is_suse_family.return_value = False
bootstrap_obj = Bootstrap("hostname", shared_state)
# Without password
hasPassword_mock.return_value = False
@@ -406,6 +404,9 @@ class TestBootstrap(TestCase):
self.assertEquals(rf, "sudo -S mv RemoteName target/ambari.repo < RemoteName")
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
@patch.object(Bootstrap, "getMoveRepoFileCommand")
@patch.object(Bootstrap, "getRepoDir")
@patch.object(Bootstrap, "getRepoFile")
@@ -418,10 +419,13 @@ class TestBootstrap(TestCase):
def test_copyNeededFiles(self, write_mock, ssh_run_mock, ssh_init_mock,
scp_run_mock, scp_init_mock,
getRemoteName_mock, getRepoFile_mock, getRepoDir,
- getMoveRepoFileCommand):
+ getMoveRepoFileCommand, is_redhat_family, is_ubuntu_family, is_suse_family):
shared_state = SharedState("root", "sshkey_file", "scriptDir", "bootdir",
"setupAgentFile", "ambariServer", "centos6",
None, "8440", "root")
+ is_redhat_family.return_value = True
+ is_ubuntu_family.return_value = False
+ is_suse_family.return_value = False
bootstrap_obj = Bootstrap("hostname", shared_state)
getMoveRepoFileCommand.return_value = "MoveRepoFileCommand"
getRepoDir.return_value = "RepoDir"
@@ -540,11 +544,13 @@ class TestBootstrap(TestCase):
self.assertEqual(res, str(expected))
os.unlink(done_file)
- @patch.object(Bootstrap, "getServerFamily")
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
@patch.object(SSH, "__init__")
@patch.object(SSH, "run")
@patch.object(HostLog, "write")
- def test_checkSudoPackage(self, write_mock, run_mock, init_mock, server_family_mock):
+ def test_checkSudoPackage(self, write_mock, run_mock, init_mock, is_redhat_family, is_ubuntu_family, is_suse_family):
shared_state = SharedState("root", "sshkey_file", "scriptDir", "bootdir",
"setupAgentFile", "ambariServer", "centos6",
None, "8440", "root")
@@ -552,25 +558,32 @@ class TestBootstrap(TestCase):
expected = 42
init_mock.return_value = None
run_mock.return_value = expected
- server_family_mock.return_value = ["centos", "6"]
+ is_redhat_family.return_value = True
+ is_ubuntu_family.return_value = False
+ is_suse_family.return_value = False
res = bootstrap_obj.checkSudoPackage()
self.assertEquals(res, expected)
command = str(init_mock.call_args[0][3])
self.assertEqual(command, "rpm -qa | grep -e '^sudo\-'")
- @patch.object(Bootstrap, "getServerFamily")
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
@patch.object(SSH, "__init__")
@patch.object(SSH, "run")
@patch.object(HostLog, "write")
- def test_checkSudoPackageUbuntu(self, write_mock, run_mock, init_mock, server_family_mock):
+ def test_checkSudoPackageUbuntu(self, write_mock, run_mock, init_mock,
+ is_redhat_family, is_ubuntu_family, is_suse_family):
shared_state = SharedState("root", "sshkey_file", "scriptDir", "bootdir",
"setupAgentFile", "ambariServer", "ubuntu12",
None, "8440", "root")
+ is_redhat_family.return_value = False
+ is_ubuntu_family.return_value = True
+ is_suse_family.return_value = False
bootstrap_obj = Bootstrap("hostname", shared_state)
expected = 42
init_mock.return_value = None
run_mock.return_value = expected
- server_family_mock.return_value = ["ubuntu", "12"]
res = bootstrap_obj.checkSudoPackage()
self.assertEquals(res, expected)
command = str(init_mock.call_args[0][3])
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/test/python/TestUtils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestUtils.py b/ambari-server/src/test/python/TestUtils.py
index 8da628b..4d881c4 100644
--- a/ambari-server/src/test/python/TestUtils.py
+++ b/ambari-server/src/test/python/TestUtils.py
@@ -20,7 +20,7 @@ import StringIO
import sys
from unittest import TestCase
from mock.mock import patch, MagicMock
-
+from ambari_commons.os_check import OSCheck
utils = __import__('ambari_server.utils').utils
@@ -33,53 +33,23 @@ class TestUtils(TestCase):
os_listdir_mock.return_value = ['8.4', '9.1']
self.assertEqual('9.1', utils.get_ubuntu_pg_version())
-
- @patch('ambari_server.utils.get_ubuntu_pg_version')
- @patch('os.path.isfile')
- @patch("subprocess.Popen")
- def test_get_postgre_hba_dir(self, popenMock, os_path_is_fine_mock,
- get_ubuntu_pg_version_mock):
- p = MagicMock()
- utils.PG_HBA_INIT_FILES['ubuntu'] = '/tmp'
- get_ubuntu_pg_version_mock.return_value = '9.1'
- self.assertEqual('/tmp/9.1/main', utils.get_postgre_hba_dir('ubuntu'))
-
- # ## Tests depends on postgres version ###
- # 1) PGDATA=/var/lib/pgsql/data
- os_path_is_fine_mock.return_value = True
- utils.PG_HBA_ROOT_DEFAULT = '/def/dir'
- p.communicate.return_value = ('/my/new/location\n', None)
- p.returncode = 0
- popenMock.return_value = p
- self.assertEqual('/my/new/location', utils.get_postgre_hba_dir('redhat'))
-
- # 2) No value set
- os_path_is_fine_mock.return_value = True
- utils.PG_HBA_ROOT_DEFAULT = '/def/dir'
- p.communicate.return_value = ('\n', None)
- p.returncode = 0
- popenMock.return_value = p
- self.assertEqual('/def/dir', utils.get_postgre_hba_dir('redhat'))
-
- # 3) Value set - check diff systems
- os_path_is_fine_mock.return_value = True
- popenMock.reset()
- p.communicate.return_value = (None, None)
- utils.get_postgre_hba_dir('redhat')
- popenMock.assert_called_with('alias exit=return; source /etc/rc.d/init.d/postgresql status &>/dev/null; echo $PGDATA', shell=True, stdin=-1, stderr=-1, stdout=-1)
-
- popenMock.reset()
- p.communicate.return_value = (None, None)
- utils.get_postgre_hba_dir('suse')
- popenMock.assert_called_with('alias exit=return; source /etc/init.d/postgresql status &>/dev/null; echo $PGDATA', shell=True, stdin=-1, stderr=-1, stdout=-1)
-
+
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
@patch('ambari_server.utils.get_ubuntu_pg_version')
- def test_get_postgre_running_status(self, get_ubuntu_pg_version_mock):
+ def test_get_postgre_running_status(self, get_ubuntu_pg_version_mock, is_redhat_family, is_ubuntu_family, is_suse_family):
+ is_redhat_family.return_value = False
+ is_ubuntu_family.return_value = True
+ is_suse_family.return_value = False
utils.PG_STATUS_RUNNING_DEFAULT = "red_running"
get_ubuntu_pg_version_mock.return_value = '9.1'
- self.assertEqual('9.1/main', utils.get_postgre_running_status('ubuntu'))
- self.assertEqual('red_running', utils.get_postgre_running_status('redhat'))
+ self.assertEqual('9.1/main', utils.get_postgre_running_status())
+ is_redhat_family.return_value = True
+ is_ubuntu_family.return_value = False
+ is_suse_family.return_value = False
+ self.assertEqual('red_running', utils.get_postgre_running_status())
@patch('os.path.isfile')
def test_locate_file(self, isfile_mock):
[2/2] ambari git commit: AMBARI-10244. Ubuntu7 title for debian7
repourl is confusing (aonishuk)
Posted by ao...@apache.org.
AMBARI-10244. Ubuntu7 title for debian7 repourl is confusing (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/36ac5782
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/36ac5782
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/36ac5782
Branch: refs/heads/trunk
Commit: 36ac57824554600b63fe8e979bcf888047bdd14a
Parents: fd9649d
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Mar 27 19:27:02 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Mar 27 19:27:02 2015 +0200
----------------------------------------------------------------------
.../src/main/python/ambari_agent/HostCleanup.py | 31 +++++-----
.../src/main/python/ambari_agent/HostInfo.py | 17 +++---
.../TestMonitorWebserverResource.py | 17 +++++-
.../TestRepositoryResource.py | 51 ++++++++++++----
.../src/main/python/ambari_commons/firewall.py | 4 +-
.../src/main/python/ambari_commons/os_check.py | 37 +++++++-----
.../ambari_commons/resources/os_family.json | 13 ++++-
.../core/providers/__init__.py | 3 +
.../python/resource_management/core/system.py | 2 +-
.../libraries/functions/__init__.py | 1 +
.../libraries/functions/get_lzo_packages.py | 47 +++++++++++++++
.../libraries/functions/packages_analyzer.py | 12 ++--
.../libraries/providers/__init__.py | 3 +
.../libraries/providers/monitor_webserver.py | 3 +-
.../libraries/providers/repository.py | 14 ++---
.../server/configuration/Configuration.java | 3 +-
.../server/state/stack/JsonOsFamilyEntry.java | 49 ++++++++++++++++
.../server/state/stack/LatestRepoCallable.java | 3 +-
.../ambari/server/state/stack/OsFamily.java | 56 +++++++++++++-----
.../ambari_server/dbConfiguration_linux.py | 8 +--
.../src/main/python/ambari_server/utils.py | 37 +++++++-----
ambari-server/src/main/python/bootstrap.py | 34 ++++-------
.../GANGLIA/3.5.0/package/scripts/functions.py | 3 +-
.../3.5.0/package/scripts/ganglia_server.py | 3 +-
.../GANGLIA/3.5.0/package/scripts/params.py | 9 +--
.../HDFS/2.1.0.2.0/package/scripts/hdfs.py | 5 +-
.../HDFS/2.1.0.2.0/package/scripts/params.py | 24 ++------
.../HIVE/0.12.0.2.0/package/scripts/params.py | 3 +-
.../0.12.0.2.0/package/scripts/status_params.py | 3 +-
.../package/scripts/kerberos_server.py | 17 +++---
.../1.10.3-10/package/scripts/params.py | 7 +--
.../OOZIE/4.0.0.2.0/package/scripts/oozie.py | 4 +-
.../OOZIE/4.0.0.2.0/package/scripts/params.py | 18 +-----
.../2.0.6/hooks/after-INSTALL/scripts/params.py | 3 +-
.../2.0.6/hooks/before-ANY/scripts/params.py | 3 +-
.../scripts/repo_initialization.py | 3 +-
.../2.0.6/hooks/before-START/scripts/params.py | 3 +-
.../resources/stacks/HDP/2.3/repos/repoinfo.xml | 2 +-
.../HDP/2.3/services/ACCUMULO/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/FALCON/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/FLUME/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/HBASE/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/HDFS/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/HIVE/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/KAFKA/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/KNOX/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/OOZIE/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/PIG/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/RANGER/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/SLIDER/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/SPARK/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/SQOOP/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/STORM/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/TEZ/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/YARN/metainfo.xml | 4 +-
.../HDP/2.3/services/ZOOKEEPER/metainfo.xml | 2 +-
ambari-server/src/test/python/TestBootstrap.py | 61 ++++++++++++--------
ambari-server/src/test/python/TestUtils.py | 58 +++++--------------
58 files changed, 426 insertions(+), 286 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
index ca2bcf4..a725d43 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
@@ -41,12 +41,6 @@ from ambari_commons.os_family_impl import OsFamilyImpl, OsFamilyFuncImpl
logger = logging.getLogger()
-PACKAGE_ERASE_CMD = {
- "redhat": "yum erase -y {0}",
- "suse": "zypper -n -q remove {0}",
- "ubuntu": "/usr/bin/apt-get -y -q remove {0}"
-}
-
USER_ERASE_CMD = "userdel -rf {0}"
GROUP_ERASE_CMD = "groupdel {0}"
PROC_KILL_CMD = "kill -9 {0}"
@@ -55,6 +49,7 @@ ALT_ERASE_CMD = "alternatives --remove {0} {1}"
REPO_PATH_RHEL = "/etc/yum.repos.d"
REPO_PATH_SUSE = "/etc/zypp/repos.d/"
+REPO_PATH_UBUNTU = "/etc/apt/sources.list.d"
SKIP_LIST = []
TMP_HOST_CHECK_FILE_NAME = "tmp_hostcheck.result"
HOST_CHECK_FILE_NAME = "hostcheck.result"
@@ -90,6 +85,17 @@ DIRNAME_PATTERNS = [
REPOSITORY_BLACK_LIST = ["ambari.repo"]
PACKAGES_BLACK_LIST = ["ambari-server", "ambari-agent"]
+def get_erase_cmd():
+ if OSCheck.is_redhat_family():
+ return "yum erase -y {0}"
+ elif OSCheck.is_suse_family():
+ return "zypper -n -q remove {0}"
+ elif OSCheck.is_ubuntu_family():
+ return "/usr/bin/apt-get -y -q remove {0}"
+ else:
+ raise Exception("Unsupported OS family '{0}', cannot remove package. ".format(OSCheck.get_os_family()))
+
+
class HostCleanup:
SELECT_ALL_PERFORMED_MARKER = "/var/lib/ambari-agent/data/hdp-select-set-all.performed"
@@ -349,10 +355,12 @@ class HostCleanup:
repoNameList.append("name=" + repoName)
if repoNameList:
# get list of files
- if osType == 'suse':
+ if OSCheck.is_suse_family():
fileList = self.get_files_in_dir(REPO_PATH_SUSE)
- elif osType == "redhat":
+ elif OSCheck.is_redhat_family():
fileList = self.get_files_in_dir(REPO_PATH_RHEL)
+ elif OSCheck.is_ubuntu_family():
+ fileList = self.get_files_in_dir(REPO_PATH_UBUNTU)
else:
logger.warn("Unsupported OS type, cannot get repository location.")
return []
@@ -376,12 +384,7 @@ class HostCleanup:
packageStr = ' '.join(packageList)
logger.debug("Erasing packages: " + packageStr)
if packageStr is not None and packageStr:
- os_name = OSCheck.get_os_family()
- command = ''
- if os_name in PACKAGE_ERASE_CMD:
- command = PACKAGE_ERASE_CMD[os_name].format(packageStr)
- else:
- logger.warn("Unsupported OS type, cannot remove package.")
+ command = get_erase_cmd().format(packageStr)
if command != '':
logger.debug('Executing: ' + str(command))
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-agent/src/main/python/ambari_agent/HostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/HostInfo.py b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
index b0b96cc..1d1e853 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostInfo.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
@@ -72,10 +72,7 @@ class HostInfo(object):
osType = OSCheck.get_os_family()
for service in services:
svcCheckResult = {}
- if isinstance(service, dict):
- serviceName = service[osType]
- else:
- serviceName = service
+ serviceName = service
svcCheckResult['name'] = serviceName
svcCheckResult['status'] = "UNKNOWN"
svcCheckResult['desc'] = ""
@@ -121,6 +118,12 @@ class HostInfo(object):
pass
return False
+def get_ntp_service():
+ if OSCheck.is_redhat_family():
+ return "ntpd"
+ elif OSCheck.is_suse_family() or OSCheck.is_ubuntu_family():
+ return "ntp"
+
@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
class HostInfoLinux(HostInfo):
@@ -135,11 +138,11 @@ class HostInfoLinux(HostInfo):
"ganglia-web"
]
+
# List of live services checked for on the host, takes a map of plan strings
DEFAULT_LIVE_SERVICES = [
- {OSConst.REDHAT_FAMILY: "ntpd", OSConst.SUSE_FAMILY: "ntp", OSConst.UBUNTU_FAMILY: "ntp"}
+ get_ntp_service()
]
-
# Set of default users (need to be replaced with the configured user names)
DEFAULT_USERS = [
"hive", "ambari-qa", "oozie", "hbase", "hcat", "mapred",
@@ -326,7 +329,7 @@ class HostInfoWindows(HostInfo):
GET_USERS_CMD = '$accounts=(Get-WmiObject -Class Win32_UserAccount -Namespace "root\cimv2" -Filter "LocalAccount=\'$True\'" -ComputerName "LocalHost" -ErrorAction Stop); foreach ($acc in $accounts) {echo $acc.Name}'
GET_JAVA_PROC_CMD = 'foreach ($process in (gwmi Win32_Process -Filter "name = \'java.exe\'")){echo $process.ProcessId;echo $process.CommandLine; echo $process.GetOwner().User}'
DEFAULT_LIVE_SERVICES = [
- {OSConst.WINSRV_FAMILY: "W32Time"}
+ "W32Time"
]
DEFAULT_USERS = ["hadoop"]
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py b/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
index 2e4b473..f149a3c 100644
--- a/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
@@ -23,11 +23,18 @@ from resource_management.libraries.providers.monitor_webserver\
import MonitorWebserverProvider
from resource_management.libraries.resources.monitor_webserver\
import MonitorWebserver
+from ambari_commons.os_check import OSCheck
class TestMonitorWebserverResource(TestCase):
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
@patch.object(System, "os_family", new='redhat')
- def test_setup_redhat(self):
+ def test_setup_redhat(self, is_redhat_family, is_ubuntu_family, is_suse_family):
+ is_redhat_family.return_value = True
+ is_ubuntu_family.return_value = False
+ is_suse_family.return_value = False
with Environment(test_mode=True) as env:
MonitorWebserverProvider(MonitorWebserver("start")).action_start()
defined_resources = env.resource_list
@@ -50,8 +57,14 @@ class TestMonitorWebserverResource(TestCase):
' Execute[\'(\'/etc/init.d/apache2\', \'start\')\']]'
self.assertEqual(str(defined_resources), expected_resources)
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
@patch.object(System, "os_family", new='redhat')
- def test_stop_redhat(self):
+ def test_stop_redhat(self, is_redhat_family, is_ubuntu_family, is_suse_family):
+ is_redhat_family.return_value = True
+ is_ubuntu_family.return_value = False
+ is_suse_family.return_value = False
with Environment(test_mode=True) as env:
MonitorWebserverProvider(MonitorWebserver("stop")).action_stop()
defined_resources = env.resource_list
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py b/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
index 37a9584..0539d25 100644
--- a/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
@@ -23,7 +23,7 @@ from mock.mock import patch, MagicMock
from resource_management import *
from resource_management.libraries.providers import repository
-
+from ambari_commons.os_check import OSCheck
class DummyTemplate(object):
@@ -53,9 +53,16 @@ gpgcheck=0
class TestRepositoryResource(TestCase):
- @patch.object(System, "os_family", new='redhat')
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
@patch("resource_management.libraries.providers.repository.File")
- def test_create_repo_redhat(self, file_mock):
+ @patch.object(System, "os_family", new='redhat')
+ def test_create_repo_redhat(self, file_mock,
+ is_redhat_family, is_ubuntu_family, is_suse_family):
+ is_redhat_family.return_value = True
+ is_ubuntu_family.return_value = False
+ is_suse_family.return_value = False
with Environment('/') as env:
with patch.object(repository,"Template", new=DummyTemplate.create(RHEL_SUSE_DEFAULT_TEMPLATE)):
Repository('hadoop',
@@ -85,9 +92,16 @@ class TestRepositoryResource(TestCase):
self.assertEqual('dummy.j2', template)
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
@patch.object(System, "os_family", new='suse')
@patch("resource_management.libraries.providers.repository.File")
- def test_create_repo_suse(self, file_mock):
+ def test_create_repo_suse(self, file_mock,
+ is_redhat_family, is_ubuntu_family, is_suse_family):
+ is_redhat_family.return_value = False
+ is_ubuntu_family.return_value = False
+ is_suse_family.return_value = True
with Environment('/') as env:
with patch.object(repository,"Template", new=DummyTemplate.create(RHEL_SUSE_DEFAULT_TEMPLATE)):
Repository('hadoop',
@@ -116,6 +130,9 @@ class TestRepositoryResource(TestCase):
self.assertEqual(expected_template_arguments, template_item.context._dict)
self.assertEqual('dummy.j2', template)
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
@patch("resource_management.libraries.providers.repository.checked_call")
@patch.object(tempfile, "NamedTemporaryFile")
@patch("resource_management.libraries.providers.repository.Execute")
@@ -125,7 +142,10 @@ class TestRepositoryResource(TestCase):
@patch.object(System, "os_release_name", new='precise')
@patch.object(System, "os_family", new='ubuntu')
def test_create_repo_ubuntu_repo_exists(self, file_mock, execute_mock,
- tempfile_mock, checked_call_mock):
+ tempfile_mock, checked_call_mock, is_redhat_family, is_ubuntu_family, is_suse_family):
+ is_redhat_family.return_value = False
+ is_ubuntu_family.return_value = True
+ is_suse_family.return_value = False
tempfile_mock.return_value = MagicMock(spec=file)
tempfile_mock.return_value.__enter__.return_value.name = "/tmp/1.txt"
checked_call_mock.return_value = 0, "The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 123ABCD"
@@ -253,9 +273,15 @@ class TestRepositoryResource(TestCase):
self.assertEqual(file_mock.call_count, 0)
self.assertEqual(execute_mock.call_count, 0)
- @patch.object(System, "os_family", new='redhat')
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
@patch("resource_management.libraries.providers.repository.File")
- def test_remove_repo_redhat(self, file_mock):
+ def test_remove_repo_redhat(self, file_mock,
+ is_redhat_family, is_ubuntu_family, is_suse_family):
+ is_redhat_family.return_value = True
+ is_ubuntu_family.return_value = False
+ is_suse_family.return_value = False
with Environment('/') as env:
Repository('hadoop',
action='remove',
@@ -270,13 +296,18 @@ class TestRepositoryResource(TestCase):
'mirror_list': 'https://mirrors.base_url.org/?repo=Repository&arch=$basearch',
'repo_file_name': 'Repository'}
self.assertEqual(defined_arguments, expected_arguments)
- self.assertEqual(file_mock.call_args[1]['action'], 'delete')
- self.assertEqual(file_mock.call_args[0][0], '/etc/yum.repos.d/Repository.repo')
+ @patch.object(OSCheck, "is_suse_family")
+ @patch.object(OSCheck, "is_ubuntu_family")
+ @patch.object(OSCheck, "is_redhat_family")
@patch.object(System, "os_family", new='suse')
@patch("resource_management.libraries.providers.repository.File")
- def test_remove_repo_suse(self, file_mock):
+ def test_remove_repo_suse(self, file_mock,
+ is_redhat_family, is_ubuntu_family, is_suse_family):
+ is_redhat_family.return_value = False
+ is_ubuntu_family.return_value = False
+ is_suse_family.return_value = True
with Environment('/') as env:
Repository('hadoop',
action='remove',
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-common/src/main/python/ambari_commons/firewall.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/firewall.py b/ambari-common/src/main/python/ambari_commons/firewall.py
index 2c4108e..e6a1ff9 100644
--- a/ambari-common/src/main/python/ambari_commons/firewall.py
+++ b/ambari-common/src/main/python/ambari_commons/firewall.py
@@ -44,11 +44,11 @@ class FirewallWindows(Firewall):
@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
class FirewallLinux(Firewall):
def getFirewallObject(self):
- if self.OS_TYPE == OSConst.OS_UBUNTU:
+ if OSCheck.is_ubuntu_family():
return UbuntuFirewallChecks()
elif self.OS_TYPE == OSConst.OS_FEDORA and int(self.OS_VERSION) >= 18:
return Fedora18FirewallChecks()
- elif self.OS_FAMILY == OSConst.SUSE_FAMILY:
+ elif OSCheck.is_suse_family():
return SuseFirewallChecks()
else:
return FirewallChecks()
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-common/src/main/python/ambari_commons/os_check.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/os_check.py b/ambari-common/src/main/python/ambari_commons/os_check.py
index 5d3dad3..904a23b 100644
--- a/ambari-common/src/main/python/ambari_commons/os_check.py
+++ b/ambari-common/src/main/python/ambari_commons/os_check.py
@@ -57,6 +57,7 @@ RESOURCES_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "resou
OSFAMILY_JSON_RESOURCE = "os_family.json"
JSON_OS_TYPE = "distro"
JSON_OS_VERSION = "versions"
+JSON_EXTENDS = "extends"
#windows family constants
SYSTEM_WINDOWS = "Windows"
@@ -104,6 +105,9 @@ class OS_CONST_TYPE(type):
'name': family,
'os_list': json_data[family][JSON_OS_TYPE]
}]
+
+ if JSON_EXTENDS in json_data[family]:
+ cls.OS_FAMILY_COLLECTION[-1][JSON_EXTENDS] = json_data[family][JSON_EXTENDS]
except:
raise Exception("Couldn't load '%s' file" % OSFAMILY_JSON_RESOURCE)
@@ -217,6 +221,15 @@ class OSCheck:
return os_family.lower()
@staticmethod
+ def get_os_family_parent(os_family):
+ for os_family_item in OSConst.OS_FAMILY_COLLECTION:
+ if os_family_item['name'] == os_family:
+ if JSON_EXTENDS in os_family_item:
+ return os_family_item[JSON_EXTENDS]
+ else:
+ return None
+
+ @staticmethod
def get_os_version():
"""
Returns the OS version
@@ -264,14 +277,9 @@ class OSCheck:
"""
Return true if it is so or false if not
- This is safe check for debian family, doesn't generate exception
+ This is safe check for ubuntu/debian families, doesn't generate exception
"""
- try:
- if OSCheck.get_os_family() == OSConst.UBUNTU_FAMILY:
- return True
- except Exception:
- pass
- return False
+ return OSCheck.is_in_family(OSCheck.get_os_family(), OSConst.UBUNTU_FAMILY)
@staticmethod
def is_suse_family():
@@ -280,12 +288,7 @@ class OSCheck:
This is safe check for suse family, doesn't generate exception
"""
- try:
- if OSCheck.get_os_family() == OSConst.SUSE_FAMILY:
- return True
- except Exception:
- pass
- return False
+ return OSCheck.is_in_family(OSCheck.get_os_family(), OSConst.SUSE_FAMILY)
@staticmethod
def is_redhat_family():
@@ -294,12 +297,16 @@ class OSCheck:
This is safe check for redhat family, doesn't generate exception
"""
+ return OSCheck.is_in_family(OSCheck.get_os_family(), OSConst.REDHAT_FAMILY)
+
+ @staticmethod
+ def is_in_family(current_family, family):
try:
- if OSCheck.get_os_family() == OSConst.REDHAT_FAMILY:
+ if current_family == family or OSCheck.get_os_family_parent(current_family) and OSCheck.is_in_family(OSCheck.get_os_family_parent(current_family), family):
return True
except Exception:
pass
- return False
+ return False
@staticmethod
def is_redhat7():
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-common/src/main/python/ambari_commons/resources/os_family.json
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/resources/os_family.json b/ambari-common/src/main/python/ambari_commons/resources/os_family.json
index 2e484c6..dd57e37 100644
--- a/ambari-common/src/main/python/ambari_commons/resources/os_family.json
+++ b/ambari-common/src/main/python/ambari_commons/resources/os_family.json
@@ -21,13 +21,20 @@
7
]
},
- "ubuntu": {
+ "debian": {
+ "extends" : "ubuntu",
"distro": [
- "ubuntu",
"debian"
],
"versions": [
- 7,
+ 7
+ ]
+ },
+ "ubuntu": {
+ "distro": [
+ "ubuntu"
+ ],
+ "versions": [
12
]
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-common/src/main/python/resource_management/core/providers/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/__init__.py b/ambari-common/src/main/python/resource_management/core/providers/__init__.py
index 7f97336..b7f94e5 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/__init__.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/__init__.py
@@ -50,6 +50,9 @@ PROVIDERS = dict(
ubuntu=dict(
Package="resource_management.core.providers.package.apt.AptProvider",
),
+ debian=dict(
+ Package="resource_management.core.providers.package.apt.AptProvider",
+ ),
winsrv=dict(
Service="resource_management.core.providers.windows.service.ServiceProvider",
Execute="resource_management.core.providers.windows.system.ExecuteProvider",
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-common/src/main/python/resource_management/core/system.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/system.py b/ambari-common/src/main/python/resource_management/core/system.py
index 8ec9972..228474b 100644
--- a/ambari-common/src/main/python/resource_management/core/system.py
+++ b/ambari-common/src/main/python/resource_management/core/system.py
@@ -94,7 +94,7 @@ class System(object):
Return values:
redhat, fedora, centos, oraclelinux, ascendos,
amazon, xenserver, oel, ovs, cloudlinux, slc, scientific, psbm,
- ubuntu, ubuntu, sles, sled, opensuse, suse ... and others
+ debian, ubuntu, sles, sled, opensuse, suse ... and others
In case cannot detect raises exception.
"""
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
index 73607e1..6b3d572 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
@@ -39,6 +39,7 @@ from resource_management.libraries.functions.version import *
from resource_management.libraries.functions.format_jvm_option import *
from resource_management.libraries.functions.constants import *
from resource_management.libraries.functions.get_hdp_version import *
+from resource_management.libraries.functions.get_lzo_packages import *
IS_WINDOWS = platform.system() == "Windows"
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py b/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
new file mode 100644
index 0000000..2f2cc33
--- /dev/null
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+__all__ = ["get_lzo_packages"]
+
+from ambari_commons.os_check import OSCheck
+from resource_management.libraries.functions.version import compare_versions, format_hdp_stack_version
+from resource_management.libraries.functions.format import format
+
+def get_lzo_packages(stack_version_unformatted):
+ lzo_packages = ["hadoop-lzo"]
+
+ if OSCheck.is_redhat_family() or OSCheck.is_suse_family():
+ lzo_packages += ["lzo", "hadoop-lzo-native"]
+ elif OSCheck.is_ubuntu_family():
+ lzo_packages += ["liblzo2-2"]
+
+ underscored_version = stack_version_unformatted.replace('.', '_')
+ dashed_version = stack_version_unformatted.replace('.', '-')
+ hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)
+
+ if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
+ if OSCheck.is_redhat_family() or OSCheck.is_suse_family():
+ lzo_packages += [format("hadooplzo_{underscored_version}_*")]
+ elif OSCheck.is_ubuntu_family():
+ lzo_packages += [format("hadooplzo_{dashed_version}_*")]
+
+ return lzo_packages
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-common/src/main/python/resource_management/libraries/functions/packages_analyzer.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/packages_analyzer.py b/ambari-common/src/main/python/resource_management/libraries/functions/packages_analyzer.py
index 55c1eb8..3693886 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/packages_analyzer.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/packages_analyzer.py
@@ -89,16 +89,16 @@ def allInstalledPackages(allInstalledPackages):
"""
osType = OSCheck.get_os_family()
- if osType == OSConst.SUSE_FAMILY:
+ if OSCheck.is_suse_family():
return _lookUpZypperPackages(
["zypper", "search", "--installed-only", "--details"],
allInstalledPackages)
- elif osType == OSConst.REDHAT_FAMILY:
+ elif OSCheck.is_redhat_family():
return _lookUpYumPackages(
["yum", "list", "installed"],
'Installed Packages',
allInstalledPackages)
- elif osType == OSConst.UBUNTU_FAMILY:
+ elif OSCheck.is_ubuntu_family():
return _lookUpAptPackages(
LIST_INSTALLED_PACKAGES_UBUNTU,
allInstalledPackages)
@@ -107,16 +107,16 @@ def allInstalledPackages(allInstalledPackages):
def allAvailablePackages(allAvailablePackages):
osType = OSCheck.get_os_family()
- if osType == OSConst.SUSE_FAMILY:
+ if OSCheck.is_suse_family():
return _lookUpZypperPackages(
["zypper", "search", "--uninstalled-only", "--details"],
allAvailablePackages)
- elif osType == OSConst.REDHAT_FAMILY:
+ elif OSCheck.is_redhat_family():
return _lookUpYumPackages(
["yum", "list", "available"],
'Available Packages',
allAvailablePackages)
- elif osType == OSConst.UBUNTU_FAMILY:
+ elif OSCheck.is_ubuntu_family():
return _lookUpAptPackages(
LIST_AVAILABLE_PACKAGES_UBUNTU,
allAvailablePackages)
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-common/src/main/python/resource_management/libraries/providers/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/providers/__init__.py b/ambari-common/src/main/python/resource_management/libraries/providers/__init__.py
index c765218..0038800 100644
--- a/ambari-common/src/main/python/resource_management/libraries/providers/__init__.py
+++ b/ambari-common/src/main/python/resource_management/libraries/providers/__init__.py
@@ -30,6 +30,9 @@ PROVIDERS = dict(
ubuntu=dict(
Repository="resource_management.libraries.providers.repository.UbuntuRepositoryProvider",
),
+ debian=dict(
+ Repository="resource_management.libraries.providers.repository.UbuntuRepositoryProvider",
+ ),
winsrv=dict(
Msi="resource_management.libraries.providers.msi.MsiProvider"
),
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-common/src/main/python/resource_management/libraries/providers/monitor_webserver.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/providers/monitor_webserver.py b/ambari-common/src/main/python/resource_management/libraries/providers/monitor_webserver.py
index 8ed9b03..276dd20 100644
--- a/ambari-common/src/main/python/resource_management/libraries/providers/monitor_webserver.py
+++ b/ambari-common/src/main/python/resource_management/libraries/providers/monitor_webserver.py
@@ -25,6 +25,7 @@ from resource_management.core.providers import Provider
from resource_management.libraries.functions.format import format
from resource_management.core.shell import as_sudo
from resource_management.core.system import System
+from ambari_commons.os_check import OSCheck
class MonitorWebserverProvider(Provider):
@@ -49,7 +50,7 @@ class MonitorWebserverProvider(Provider):
def get_serivice_params(self):
self.system = System.get_instance()
- if self.system.os_family in ["suse","ubuntu"]:
+ if OSCheck.is_suse_family() or OSCheck.is_ubuntu_family():
self.service_name = "apache2"
self.httpd_conf_dir = '/etc/apache2'
else:
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-common/src/main/python/resource_management/libraries/providers/repository.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/providers/repository.py b/ambari-common/src/main/python/resource_management/libraries/providers/repository.py
index 9bd89ec..94f057e 100644
--- a/ambari-common/src/main/python/resource_management/libraries/providers/repository.py
+++ b/ambari-common/src/main/python/resource_management/libraries/providers/repository.py
@@ -38,7 +38,7 @@ class RhelSuseRepositoryProvider(Provider):
def action_create(self):
with Environment.get_instance_copy() as env:
repo_file_name = self.resource.repo_file_name
- repo_dir = repos_dirs[env.system.os_family]
+ repo_dir = get_repo_dir()
repo_template = self.resource.repo_template
new_content = Template(repo_template, repo_id=self.resource.repo_id, repo_file_name=self.resource.repo_file_name,
base_url=self.resource.base_url, mirror_list=self.resource.mirror_list)
@@ -52,17 +52,17 @@ class RhelSuseRepositoryProvider(Provider):
def action_remove(self):
with Environment.get_instance_copy() as env:
repo_file_name = self.resource.repo_file_name
- repo_dir = repos_dirs[env.system.os_family]
+ repo_dir = get_repo_dir()
File(format("{repo_dir}/{repo_file_name}.repo"),
action = "delete")
-repos_dirs = {
- 'redhat': '/etc/yum.repos.d',
- 'suse': '/etc/zypp/repos.d'
-}
-
+def get_repo_dir():
+ if OSCheck.is_redhat_family():
+ return '/etc/yum.repos.d'
+ elif OSCheck.is_suse_family():
+ return '/etc/zypp/repos.d'
class UbuntuRepositoryProvider(Provider):
package_type = "deb"
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index c3ad685..2b65956 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -1143,10 +1143,9 @@ public class Configuration {
* @return a string array of suffixes used to validate repo URLs.
*/
public String[] getRepoValidationSuffixes(String osType) {
- String osFamily = this.osFamily.find_family(osType);
String repoSuffixes;
- if(osFamily.equals(OsFamily.UBUNTU_FAMILY)) {
+ if(osFamily.isUbuntuFamily(osType)) {
repoSuffixes = properties.getProperty(REPO_SUFFIX_KEY_UBUNTU,
REPO_SUFFIX_UBUNTU);
} else {
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/java/org/apache/ambari/server/state/stack/JsonOsFamilyEntry.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/JsonOsFamilyEntry.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/JsonOsFamilyEntry.java
new file mode 100644
index 0000000..a937d52
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/JsonOsFamilyEntry.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.state.stack;
+
+import java.util.Set;
+
+import com.google.gson.annotations.SerializedName;
+
+class JsonOsFamilyEntry {
+ @SerializedName("extends")
+ private String extendsFamily;
+ private Set<String> distro;
+
+ private Set<String> versions;
+
+ public String getExtendsFamily() {
+ return extendsFamily;
+ }
+ public void setExtendsFamily(String extendsFamily) {
+ this.extendsFamily = extendsFamily;
+ }
+ public Set<String> getDistro() {
+ return distro;
+ }
+ public void setDistro(Set<String> distro) {
+ this.distro = distro;
+ }
+ public Set<String> getVersions() {
+ return versions;
+ }
+ public void setVersions(Set<String> versions) {
+ this.versions = versions;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/java/org/apache/ambari/server/state/stack/LatestRepoCallable.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/LatestRepoCallable.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/LatestRepoCallable.java
index 9eb2387..f4578a6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/LatestRepoCallable.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/LatestRepoCallable.java
@@ -108,9 +108,8 @@ public class LatestRepoCallable implements Callable<Void> {
// Agents do the reverse action (take the base url, and append <name>.repo)
String repo_file_format;
- String osFamily = os_family.find_family(ri.getOsType());
- if(osFamily.equals(OsFamily.UBUNTU_FAMILY)) {
+ if(os_family.isUbuntuFamily(ri.getOsType())) {
repo_file_format = "list";
} else {
repo_file_format = "repo";
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
index 2df3fcf..3cdc2ce 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
@@ -25,8 +25,8 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import com.google.inject.Singleton;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,7 +41,9 @@ import org.apache.commons.io.IOUtils;
*/
@Singleton
public class OsFamily {
- public final static String UBUNTU_FAMILY = "ubuntu";
+ private final static String OS_FAMILY_UBUNTU = "ubuntu";
+ private final static String OS_FAMILY_SUSE = "suse";
+ private final static String OS_FAMILY_REDHAT = "redhat";
private final String os_pattern = "([^\\d]*)([\\d]*)";
private final String OS_DISTRO = "distro";
@@ -50,7 +52,7 @@ public class OsFamily {
private final String FILE_NAME = "os_family.json";
private final Logger LOG = LoggerFactory.getLogger(OsFamily.class);
- private Map<String, Map<String, Set<String>>> osMap = null;
+ private Map<String, JsonOsFamilyEntry> osMap = null;
/**
* Initialize object
@@ -75,7 +77,7 @@ public class OsFamily {
if (!f.exists()) throw new Exception();
inputStream = new FileInputStream(f);
- Type type = new TypeToken<Map<String, Map<String, Set<String>>>>() {}.getType();
+ Type type = new TypeToken<Map<String, JsonOsFamilyEntry>>() {}.getType();
Gson gson = new Gson();
osMap = gson.fromJson(new InputStreamReader(inputStream), type);
} catch (Exception e) {
@@ -115,10 +117,10 @@ public class OsFamily {
public Set<String> findTypes(String os) {
Map<String,String> pos = parse_os(os);
for ( String family : osMap.keySet()) {
- Map<String, Set<String>> fam = osMap.get(family);
- if (fam.get(OS_DISTRO).contains(pos.get(OS_DISTRO)) && fam.get(OS_VERSION).contains(pos.get(OS_VERSION))){
+ JsonOsFamilyEntry fam = osMap.get(family);
+ if (fam.getDistro().contains(pos.get(OS_DISTRO)) && fam.getVersions().contains(pos.get(OS_VERSION))){
Set<String> data=new HashSet<String>();
- for (String item: fam.get(OS_DISTRO)) data.add(item + pos.get(OS_VERSION));
+ for (String item: fam.getDistro()) data.add(item + pos.get(OS_VERSION));
return Collections.unmodifiableSet(data);
}
}
@@ -133,8 +135,8 @@ public class OsFamily {
public String find(String os) {
Map<String,String> pos = parse_os(os);
for ( String family : osMap.keySet()) {
- Map<String, Set<String>> fam = osMap.get(family);
- if (fam.get(OS_DISTRO).contains(pos.get(OS_DISTRO)) && fam.get(OS_VERSION).contains(pos.get(OS_VERSION))){
+ JsonOsFamilyEntry fam = osMap.get(family);
+ if (fam.getDistro().contains(pos.get(OS_DISTRO)) && fam.getVersions().contains(pos.get(OS_VERSION))){
return family + pos.get(OS_VERSION);
}
}
@@ -149,14 +151,13 @@ public class OsFamily {
public String find_family(String os) {
Map<String,String> pos = parse_os(os);
for ( String family : osMap.keySet()) {
- Map<String, Set<String>> fam = osMap.get(family);
- if (fam.get(OS_DISTRO).contains(pos.get(OS_DISTRO)) && fam.get(OS_VERSION).contains(pos.get(OS_VERSION))){
+ JsonOsFamilyEntry fam = osMap.get(family);
+ if (fam.getDistro().contains(pos.get(OS_DISTRO)) && fam.getVersions().contains(pos.get(OS_VERSION))){
return family;
}
}
return null;
}
-
/**
* Form list of all supported os types
* @return one dimension list with os types
@@ -164,13 +165,38 @@ public class OsFamily {
public Set<String> os_list(){
Set<String> r= new HashSet<String>();
for ( String family : osMap.keySet()) {
- Map<String, Set<String>> fam = osMap.get(family);
- for (String version: fam.get(OS_VERSION)){
+ JsonOsFamilyEntry fam = osMap.get(family);
+ for (String version: fam.getVersions()){
Set<String> data=new HashSet<String>();
- for (String item: fam.get(OS_DISTRO)) data.add(item + version);
+ for (String item: fam.getDistro()) data.add(item + version);
r.addAll(data);
}
}
return r;
}
+
+ public boolean isUbuntuFamily(String osType) {
+ return isOsInFamily(osType, OS_FAMILY_UBUNTU);
+ }
+
+ public boolean isSuseFamily(String osType) {
+ return isOsInFamily(osType, OS_FAMILY_SUSE);
+ }
+
+ public boolean isRedhatFamily(String osType) {
+ return isOsInFamily(osType, OS_FAMILY_REDHAT);
+ }
+
+ public boolean isOsInFamily(String osType, String osFamily) {
+ String familyOfOsType = find_family(osType);
+ return (familyOfOsType != null && isFamilyExtendedByFamily(familyOfOsType, osFamily));
+ }
+
+ private boolean isFamilyExtendedByFamily(String currentFamily, String family) {
+ return (currentFamily.equals(family) || getOsFamilyParent(currentFamily)!=null && isFamilyExtendedByFamily(getOsFamilyParent(currentFamily), family));
+ }
+
+ private String getOsFamilyParent(String osFamily) {
+ return osMap.get(osFamily).getExtendsFamily();
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
index 735336c..e59f1ed 100644
--- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
@@ -35,7 +35,7 @@ from ambari_server.dbConfiguration import DBMSConfig, USERNAME_PATTERN, SETUP_DB
SETUP_DB_CONNECT_TIMEOUT, STORAGE_TYPE_LOCAL, DEFAULT_USERNAME, DEFAULT_PASSWORD
from ambari_server.serverConfiguration import encrypt_password, store_password_file, \
get_ambari_properties, get_resources_location, get_value_from_properties, configDefaults, \
- OS_TYPE, OS_FAMILY, AMBARI_PROPERTIES_FILE, RESOURCES_DIR_PROPERTY, \
+ OS_FAMILY, AMBARI_PROPERTIES_FILE, RESOURCES_DIR_PROPERTY, \
JDBC_DATABASE_PROPERTY, JDBC_DATABASE_NAME_PROPERTY, JDBC_POSTGRES_SCHEMA_PROPERTY, \
JDBC_HOSTNAME_PROPERTY, JDBC_PORT_PROPERTY, \
JDBC_USER_NAME_PROPERTY, JDBC_PASSWORD_PROPERTY, JDBC_PASSWORD_FILENAME, \
@@ -347,7 +347,7 @@ class PGConfig(LinuxDBMSConfig):
self._is_user_changed = False
if self.persistence_type == STORAGE_TYPE_LOCAL:
- PGConfig.PG_STATUS_RUNNING = get_postgre_running_status(OS_TYPE)
+ PGConfig.PG_STATUS_RUNNING = get_postgre_running_status()
PGConfig.PG_HBA_DIR = get_postgre_hba_dir(OS_FAMILY)
PGConfig.PG_HBA_CONF_FILE = os.path.join(PGConfig.PG_HBA_DIR, "pg_hba.conf")
@@ -537,7 +537,7 @@ class PGConfig(LinuxDBMSConfig):
return pg_status, 0, out, err
else:
# run initdb only on non ubuntu systems as ubuntu does not have initdb cmd.
- if OS_TYPE != OSConst.OS_UBUNTU:
+ if not OSCheck.is_ubuntu_family():
print "Running initdb: This may take upto a minute."
retcode, out, err = run_os_command(PGConfig.PG_INITDB_CMD)
if retcode == 0:
@@ -549,7 +549,7 @@ class PGConfig(LinuxDBMSConfig):
stdin=subprocess.PIPE,
stderr=subprocess.PIPE
)
- if OS_TYPE == OSConst.OS_SUSE:
+ if OSCheck.is_suse_family():
time.sleep(20)
result = process.poll()
print_info_msg("Result of postgres start cmd: " + str(result))
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/python/ambari_server/utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/utils.py b/ambari-server/src/main/python/ambari_server/utils.py
index 23bd9d6..f09a95c 100644
--- a/ambari-server/src/main/python/ambari_server/utils.py
+++ b/ambari-server/src/main/python/ambari_server/utils.py
@@ -30,9 +30,6 @@ from ambari_commons import OSConst,OSCheck
# PostgreSQL settings
PG_STATUS_RUNNING_DEFAULT = "running"
PG_HBA_ROOT_DEFAULT = "/var/lib/pgsql/data"
-PG_HBA_INIT_FILES = {'ubuntu': '/etc/postgresql',
- 'redhat': '/etc/rc.d/init.d/postgresql',
- 'suse': '/etc/init.d/postgresql'}
#Environment
ENV_PATH_DEFAULT = ['/bin', '/usr/bin', '/sbin', '/usr/sbin'] # default search path
@@ -43,6 +40,16 @@ PROC_DIR = '/proc'
PROC_CMDLINE = 'cmdline'
PROC_EXEC = 'exe'
+def get_pg_hba_init_files():
+ if OSCheck.is_ubuntu_family():
+ return '/etc/postgresql'
+ elif OSCheck.is_redhat_family():
+ return '/etc/rc.d/init.d/postgresql'
+ elif OSCheck.is_suse_family():
+ return '/etc/init.d/postgresql'
+ else:
+ raise Exception("Unsupported OS family '{0}'".format(OSCheck.get_os_family()))
+
# ToDo: move that function to common-functions
def locate_file(filename, default=''):
@@ -189,11 +196,10 @@ def get_ubuntu_pg_version():
"""
postgre_ver = ""
- if os.path.isdir(PG_HBA_INIT_FILES[
- 'ubuntu']): # detect actual installed versions of PG and select a more new one
+ if os.path.isdir(get_pg_hba_init_files()): # detect actual installed versions of PG and select a more new one
postgre_ver = sorted(
- [fld for fld in os.listdir(PG_HBA_INIT_FILES[OSConst.UBUNTU_FAMILY]) if
- os.path.isdir(os.path.join(PG_HBA_INIT_FILES[OSConst.UBUNTU_FAMILY], fld))],
+ [fld for fld in os.listdir(get_pg_hba_init_files()) if
+ os.path.isdir(os.path.join(get_pg_hba_init_files(), fld))],
reverse=True)
if len(postgre_ver) > 0:
return postgre_ver[0]
@@ -206,21 +212,20 @@ def get_postgre_hba_dir(OS_FAMILY):
1) /etc/rc.d/init.d/postgresql --> /etc/rc.d/init.d/postgresql-9.3
2) /etc/init.d/postgresql --> /etc/init.d/postgresql-9.1
"""
- if OS_FAMILY == OSConst.UBUNTU_FAMILY:
+ if OSCheck.is_ubuntu_family():
# Like: /etc/postgresql/9.1/main/
- return os.path.join(PG_HBA_INIT_FILES[OS_FAMILY], get_ubuntu_pg_version(),
+ return os.path.join(get_pg_hba_init_files(), get_ubuntu_pg_version(),
"main")
elif OSCheck.is_redhat7():
return PG_HBA_ROOT_DEFAULT
else:
- if not os.path.isfile(PG_HBA_INIT_FILES[OS_FAMILY]):
+ if not os.path.isfile(get_pg_hba_init_files()):
# Link: /etc/init.d/postgresql --> /etc/init.d/postgresql-9.1
- os.symlink(glob.glob(PG_HBA_INIT_FILES[OS_FAMILY] + '*')[0],
- PG_HBA_INIT_FILES[OS_FAMILY])
+ os.symlink(glob.glob(get_pg_hba_init_files() + '*')[0],
+ get_pg_hba_init_files())
# Get postgres_data location (default: /var/lib/pgsql/data)
- cmd = "alias exit=return; source " + PG_HBA_INIT_FILES[
- OS_FAMILY] + " status &>/dev/null; echo $PGDATA"
+ cmd = "alias exit=return; source " + get_pg_hba_init_files() + " status &>/dev/null; echo $PGDATA"
p = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
@@ -234,9 +239,9 @@ def get_postgre_hba_dir(OS_FAMILY):
return PG_HBA_ROOT_DEFAULT
-def get_postgre_running_status(OS_FAMILY):
+def get_postgre_running_status():
"""Return postgre running status indicator"""
- if OS_FAMILY == OSConst.UBUNTU_FAMILY:
+ if OSCheck.is_ubuntu_family():
return os.path.join(get_ubuntu_pg_version(), "main")
else:
return PG_STATUS_RUNNING_DEFAULT
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/python/bootstrap.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/bootstrap.py b/ambari-server/src/main/python/bootstrap.py
index 111ff46..692ce27 100755
--- a/ambari-server/src/main/python/bootstrap.py
+++ b/ambari-server/src/main/python/bootstrap.py
@@ -33,6 +33,7 @@ import traceback
import re
from datetime import datetime
from resource_management.core.shell import quote_bash_args
+from ambari_commons.os_check import OSCheck
AMBARI_PASSPHRASE_VAR_NAME = "AMBARI_PASSPHRASE"
HOST_BOOTSTRAP_TIMEOUT = 300
@@ -164,7 +165,7 @@ class Bootstrap(threading.Thread):
self.host_log = HostLog(log_file)
self.daemon = True
- if self.is_ubuntu():
+ if OSCheck.is_ubuntu_family():
self.AMBARI_REPO_FILENAME = self.AMBARI_REPO_FILENAME + ".list"
else:
self.AMBARI_REPO_FILENAME = self.AMBARI_REPO_FILENAME + ".repo"
@@ -192,26 +193,16 @@ class Bootstrap(threading.Thread):
def _call(*args, **kwargs):
self(obj, *args, **kwargs)
return _call
-
- def is_suse(self):
- if os.path.isfile("/etc/issue"):
- if "suse" in open("/etc/issue").read().lower():
- return True
- return False
-
- def is_ubuntu(self):
- if self.getServerFamily()[0] == "ubuntu":
- return True
- return False
-
+
def getRepoDir(self):
- """ Ambari repo file for Ambari."""
- if self.is_suse():
+ if OSCheck.is_redhat_family():
+ return "/etc/yum.repos.d"
+ elif OSCheck.is_suse_family():
return "/etc/zypp/repos.d"
- elif self.is_ubuntu():
+ elif OSCheck.is_ubuntu_family():
return "/etc/apt/sources.list.d"
else:
- return "/etc/yum.repos.d"
+ raise Exception("Unsupported OS family '{0}'".format(OSCheck.get_os_family()))
def getRepoFile(self):
@@ -325,7 +316,7 @@ class Bootstrap(threading.Thread):
self.host_log.write("\n")
# Update repo cache for ubuntu OS
- if self.is_ubuntu():
+ if OSCheck.is_ubuntu_family():
self.host_log.write("==========================\n")
self.host_log.write("Update apt cache of repository...")
command = self.getAptUpdateCommand()
@@ -430,17 +421,12 @@ class Bootstrap(threading.Thread):
doneFile.write(str(retcode))
doneFile.close()
- def getServerFamily(self):
- '''Return server OS family and version'''
- cot = re.search("([^\d]+)([\d]*)", self.shared_state.cluster_os_type)
- return cot.group(1).lower(),cot.group(2).lower()
-
def checkSudoPackage(self):
""" Checking 'sudo' package on remote host """
self.host_log.write("==========================\n")
self.host_log.write("Checking 'sudo' package on remote host...")
params = self.shared_state
- if self.getServerFamily()[0] == "ubuntu":
+ if OSCheck.is_ubuntu_family():
command = "dpkg --get-selections|grep -e '^sudo\s*install'"
else:
command = "rpm -qa | grep -e '^sudo\-'"
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/functions.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/functions.py b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/functions.py
index 0f20f17..02c44f0 100644
--- a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/functions.py
+++ b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/functions.py
@@ -16,10 +16,11 @@
# under the License.
#
from resource_management import *
+from ambari_commons.os_check import OSCheck
def turn_off_autostart(service):
- if System.get_instance().os_family == "ubuntu":
+ if OSCheck.is_ubuntu_family():
Execute(('update-rc.d', service, 'disable'),
path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
sudo = True
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server.py b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server.py
index 5bbb545..1893483 100644
--- a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server.py
+++ b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server.py
@@ -24,6 +24,7 @@ from ganglia import generate_daemon
import ganglia
import functions
import ganglia_server_service
+from ambari_commons.os_check import OSCheck
class GangliaServer(Script):
@@ -114,7 +115,7 @@ def server_files():
recursive=True
)
- if System.get_instance().os_family in ["ubuntu","suse"]:
+ if OSCheck.is_suse_family() or OSCheck.is_ubuntu_family():
File( params.ganglia_apache_config_file,
content = Template("ganglia.conf.j2"),
mode = 0644
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/params.py
index 5fe6335..30f8ee4 100644
--- a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/params.py
@@ -18,6 +18,7 @@ limitations under the License.
from resource_management import *
from resource_management.core.system import System
+from ambari_commons.os_check import OSCheck
import os
config = Script.get_config()
@@ -42,7 +43,7 @@ for x in gmond_app_strs:
a,b = x.strip().split(':')
gmond_apps.append((a.strip(),b.strip()))
-if System.get_instance().os_family == "ubuntu":
+if OSCheck.is_ubuntu_family():
gmond_service_name = "ganglia-monitor"
modules_dir = "/usr/lib/ganglia"
else:
@@ -145,7 +146,7 @@ if len(gmond_apps) > 0:
ganglia_apache_config_file = "/etc/apache2/conf.d/ganglia.conf"
ganglia_web_path="/var/www/html/ganglia"
-if System.get_instance().os_family == "suse":
+if OSCheck.is_suse_family():
rrd_py_path = '/srv/www/cgi-bin'
dwoo_path = '/var/lib/ganglia-web/dwoo'
web_user = "wwwrun"
@@ -153,11 +154,11 @@ if System.get_instance().os_family == "suse":
if not os.path.exists(ganglia_web_path):
ganglia_web_path='/srv/www/htdocs/ganglia'
-elif System.get_instance().os_family == "redhat":
+elif OSCheck.is_redhat_family():
rrd_py_path = '/var/www/cgi-bin'
dwoo_path = '/var/lib/ganglia/dwoo'
web_user = "apache"
-elif System.get_instance().os_family == "ubuntu":
+elif OSCheck.is_ubuntu_family():
rrd_py_path = '/usr/lib/cgi-bin'
ganglia_web_path = '/usr/share/ganglia-webfrontend'
dwoo_path = '/var/lib/ganglia/dwoo'
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
index 795b315..b203800 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
@@ -79,6 +79,5 @@ def hdfs(name=None):
content=Template("slaves.j2")
)
- if params.lzo_enabled:
- if len(params.lzo_packages_for_current_host) > 0:
- Package(params.lzo_packages_for_current_host)
+ if params.lzo_enabled and len(params.lzo_packages) > 0:
+ Package(params.lzo_packages)
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params.py
index 6b66158..7061057 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params.py
@@ -18,6 +18,7 @@ limitations under the License.
"""
from resource_management.libraries.functions.version import format_hdp_stack_version, compare_versions
+from ambari_commons.os_check import OSCheck
from resource_management.libraries.functions.default import default
from resource_management import *
import status_params
@@ -269,28 +270,11 @@ HdfsDirectory = functools.partial(
# The logic for LZO also exists in OOZIE's params.py
io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None)
lzo_enabled = io_compression_codecs is not None and "com.hadoop.compression.lzo" in io_compression_codecs.lower()
-
-# stack_is_hdp22_or_further
-underscored_version = stack_version_unformatted.replace('.', '_')
-dashed_version = stack_version_unformatted.replace('.', '-')
-lzo_packages_to_family = {
- "any": ["hadoop-lzo", ],
- "redhat": ["lzo", "hadoop-lzo-native"],
- "suse": ["lzo", "hadoop-lzo-native"],
- "ubuntu": ["liblzo2-2", ]
-}
-
-if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
- lzo_packages_to_family["redhat"] += [format("hadooplzo_{underscored_version}_*")]
- lzo_packages_to_family["suse"] += [format("hadooplzo_{underscored_version}_*")]
- lzo_packages_to_family["ubuntu"] += [format("hadooplzo_{dashed_version}_*")]
-
-lzo_packages_for_current_host = lzo_packages_to_family['any'] + lzo_packages_to_family[System.get_instance().os_family]
-all_lzo_packages = set(itertools.chain(*lzo_packages_to_family.values()))
+lzo_packages = get_lzo_packages(stack_version_unformatted)
exclude_packages = []
if not lzo_enabled:
- exclude_packages += all_lzo_packages
+ exclude_packages += lzo_packages
name_node_params = default("/commandParams/namenode", None)
@@ -300,7 +284,7 @@ hadoop_env_sh_template = config['configurations']['hadoop-env']['content']
#hadoop-env.sh
java_home = config['hostLevelParams']['java_home']
-if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.0') >= 0 and compare_versions(hdp_stack_version, '2.1') < 0 and System.get_instance().os_family != "suse":
+if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.0') >= 0 and compare_versions(hdp_stack_version, '2.1') < 0 and not OSCheck.is_suse_family():
# deprecated rhel jsvc_path
jsvc_path = "/usr/libexec/bigtop-utils"
else:
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params.py
index 17db636..69ac68d 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params.py
@@ -19,6 +19,7 @@ limitations under the License.
"""
from ambari_commons.constants import AMBARI_SUDO_BINARY
+from ambari_commons.os_check import OSCheck
from resource_management.libraries.functions.version import format_hdp_stack_version, compare_versions
from resource_management.libraries.functions.default import default
from resource_management import *
@@ -279,7 +280,7 @@ app_dir_files = {tez_local_api_jars:None}
# Tez libraries
tez_lib_uris = default("/configurations/tez-site/tez.lib.uris", None)
-if System.get_instance().os_family == "ubuntu":
+if OSCheck.is_ubuntu_family():
mysql_configname = '/etc/mysql/my.cnf'
else:
mysql_configname = '/etc/my.cnf'
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/status_params.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/status_params.py
index b5a38f4..3b75b98 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/status_params.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/status_params.py
@@ -19,6 +19,7 @@ limitations under the License.
"""
from resource_management import *
+from ambari_commons.os_check import OSCheck
config = Script.get_config()
@@ -31,7 +32,7 @@ hcat_pid_dir = config['configurations']['hive-env']['hcat_pid_dir'] #hcat_pid_di
webhcat_pid_file = format('{hcat_pid_dir}/webhcat.pid')
process_name = 'mysqld'
-if System.get_instance().os_family == "suse" or System.get_instance().os_family == "ubuntu":
+if OSCheck.is_suse_family() or OSCheck.is_ubuntu_family():
daemon_name = 'mysql'
else:
daemon_name = 'mysqld'
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_server.py b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_server.py
index 3e15f50..8cc4312 100644
--- a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_server.py
+++ b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_server.py
@@ -18,6 +18,7 @@ limitations under the License.
"""
from kerberos_common import *
+from ambari_commons.os_check import OSCheck
class KerberosServer(KerberosScript):
@staticmethod
@@ -81,18 +82,16 @@ class KerberosServer(KerberosScript):
def start(self, env):
- os_family = System.get_instance().os_family
-
# Attempt to reconfigure the service before starting
self.configure(env)
# Create or update the administrator account
KerberosScript.create_or_update_administrator_identity()
- if os_family == "suse":
+ if OSCheck.is_suse_family():
Execute('rckadmind start')
Execute('rckrb5kdc start')
- elif os_family == 'ubuntu':
+ elif OSCheck.is_ubuntu_family():
Execute('service krb5-kdc start')
Execute('service krb5-admin-server start')
else:
@@ -100,12 +99,10 @@ class KerberosServer(KerberosScript):
Execute('service kadmin start')
def stop(self, env):
- os_family = System.get_instance().os_family
-
- if os_family == "suse":
+ if OSCheck.is_suse_family():
Execute('rckadmind stop')
Execute('rckrb5kdc stop')
- elif os_family == 'ubuntu':
+ elif OSCheck.is_ubuntu_family():
Execute('service krb5-kdc stop')
Execute('service krb5-admin-server stop')
else:
@@ -124,14 +121,14 @@ class KerberosServer(KerberosScript):
def status(self, env):
import params
- if params.os_family == "suse":
+ if OSCheck.is_suse_family():
try:
Execute('checkproc `which krb5kdc`')
Execute('checkproc `which kadmind`')
except Fail as ex:
raise ComponentIsNotRunning()
- elif params.os_family == 'ubuntu':
+ elif OSCheck.is_ubuntu_family():
check_process_status(params.kdamin_pid_path)
check_process_status(params.krb5kdc_pid_path)
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/params.py b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/params.py
index 18255bd..5482f6c 100644
--- a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/params.py
@@ -19,16 +19,15 @@ limitations under the License.
from resource_management import *
from utils import get_property_value, get_unstructured_data
-
-os_family = System.get_instance().os_family
+from ambari_commons.os_check import OSCheck
krb5_conf_dir = '/etc'
krb5_conf_file = 'krb5.conf'
krb5_conf_path = krb5_conf_dir + '/' + krb5_conf_file
-if os_family == 'suse':
+if OSCheck.is_suse_family():
kdc_conf_dir = '/var/lib/kerberos/krb5kdc'
-elif os_family == 'ubuntu':
+elif OSCheck.is_ubuntu_family():
kdc_conf_dir = '/etc/krb5kdc'
else:
kdc_conf_dir = '/var/kerberos/krb5kdc'
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
index 4e31673..1cf0e9d 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
@@ -182,8 +182,8 @@ def oozie_server_specific():
Execute(format('{sudo} chown {oozie_user}:{user_group} {oozie_libext_dir}/falcon-oozie-el-extension-*.jar'),
not_if = no_op_test,
)
- if params.lzo_enabled and len(params.lzo_packages_for_current_host) > 0:
- Package(params.lzo_packages_for_current_host)
+ if params.lzo_enabled and len(params.all_lzo_packages) > 0:
+ Package(params.all_lzo_packages)
Execute(format('{sudo} cp {hadoop_lib_home}/hadoop-lzo*.jar {oozie_lib_dir}'),
not_if = no_op_test,
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params.py
index 454491f..d1ad6df 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params.py
@@ -19,6 +19,7 @@ limitations under the License.
"""
from ambari_commons.constants import AMBARI_SUDO_BINARY
+from resource_management import *
from resource_management.core import System
from resource_management.libraries import Script
from resource_management.libraries.functions import default
@@ -208,20 +209,5 @@ HdfsDirectory = functools.partial(
# The logic for LZO also exists in HDFS' params.py
io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None)
lzo_enabled = io_compression_codecs is not None and "com.hadoop.compression.lzo" in io_compression_codecs.lower()
-# stack_is_hdp22_or_further
-underscored_version = stack_version_unformatted.replace('.', '_')
-dashed_version = stack_version_unformatted.replace('.', '-')
-lzo_packages_to_family = {
- "any": ["hadoop-lzo", ],
- "redhat": ["lzo", "hadoop-lzo-native"],
- "suse": ["lzo", "hadoop-lzo-native"],
- "ubuntu": ["liblzo2-2", ]
-}
-if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
- lzo_packages_to_family["redhat"] += [format("hadooplzo_{underscored_version}_*")]
- lzo_packages_to_family["suse"] += [format("hadooplzo_{underscored_version}_*")]
- lzo_packages_to_family["ubuntu"] += [format("hadooplzo_{dashed_version}_*")]
-
-lzo_packages_for_current_host = lzo_packages_to_family['any'] + lzo_packages_to_family[System.get_instance().os_family]
-all_lzo_packages = set(itertools.chain(*lzo_packages_to_family.values()))
\ No newline at end of file
+all_lzo_packages = get_lzo_packages(stack_version_unformatted)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
index 755c18c..16f78b2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
@@ -21,6 +21,7 @@ from ambari_commons.constants import AMBARI_SUDO_BINARY
from resource_management.libraries.functions.version import format_hdp_stack_version, compare_versions
from resource_management import *
from resource_management.core.system import System
+from ambari_commons.os_check import OSCheck
config = Script.get_config()
sudo = AMBARI_SUDO_BINARY
@@ -48,7 +49,7 @@ hdfs_log_dir_prefix = config['configurations']['hadoop-env']['hdfs_log_dir_prefi
hadoop_pid_dir_prefix = config['configurations']['hadoop-env']['hadoop_pid_dir_prefix']
hadoop_root_logger = config['configurations']['hadoop-env']['hadoop_root_logger']
-if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.0') >= 0 and compare_versions(hdp_stack_version, '2.1') < 0 and System.get_instance().os_family != "suse":
+if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.0') >= 0 and compare_versions(hdp_stack_version, '2.1') < 0 and not OSCheck.is_suse_family():
# deprecated rhel jsvc_path
jsvc_path = "/usr/libexec/bigtop-utils"
else:
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
index 5a069b9..012ed2c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
@@ -18,6 +18,7 @@ limitations under the License.
"""
from resource_management.libraries.functions.version import format_hdp_stack_version, compare_versions
+from ambari_commons.os_check import OSCheck
from resource_management import *
import collections
import json
@@ -105,7 +106,7 @@ hdfs_log_dir_prefix = config['configurations']['hadoop-env']['hdfs_log_dir_prefi
hadoop_pid_dir_prefix = config['configurations']['hadoop-env']['hadoop_pid_dir_prefix']
hadoop_root_logger = config['configurations']['hadoop-env']['hadoop_root_logger']
-if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.0') >= 0 and compare_versions(hdp_stack_version, '2.1') < 0 and System.get_instance().os_family != "suse":
+if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.0') >= 0 and compare_versions(hdp_stack_version, '2.1') < 0 and not OSCheck.is_suse_family():
# deprecated rhel jsvc_path
jsvc_path = "/usr/libexec/bigtop-utils"
else:
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/repo_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/repo_initialization.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/repo_initialization.py
index 87ce1f1..f040bcc 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/repo_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/repo_initialization.py
@@ -17,6 +17,7 @@ limitations under the License.
"""
from resource_management import *
+from ambari_commons.os_check import OSCheck
import json
# components_lits = repoName + postfix
@@ -51,7 +52,7 @@ def _alter_repo(action, repo_string, repo_template):
def install_repos():
import params
- template = "repo_suse_rhel.j2" if System.get_instance().os_family in ["suse", "redhat"] else "repo_ubuntu.j2"
+ template = "repo_suse_rhel.j2" if OSCheck.is_suse_family() or OSCheck.is_redhat_family() else "repo_ubuntu.j2"
_alter_repo("create", params.repo_info, template)
if params.service_repo_info:
_alter_repo("create", params.service_repo_info, template)
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
index d39a2fc..0c18645 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
@@ -18,6 +18,7 @@ limitations under the License.
"""
from resource_management.libraries.functions.version import format_hdp_stack_version, compare_versions
+from ambari_commons.os_check import OSCheck
from resource_management import *
from resource_management.core.system import System
import os
@@ -132,7 +133,7 @@ else:
#hadoop-env.sh
java_home = config['hostLevelParams']['java_home']
-if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.0') >= 0 and compare_versions(hdp_stack_version, '2.1') < 0 and System.get_instance().os_family != "suse":
+if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.0') >= 0 and compare_versions(hdp_stack_version, '2.1') < 0 and not OSCheck.is_suse_family():
# deprecated rhel jsvc_path
jsvc_path = "/usr/libexec/bigtop-utils"
else:
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/repos/repoinfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/repos/repoinfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/repos/repoinfo.xml
index 20c0ea3..a4c867a 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/repos/repoinfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/repos/repoinfo.xml
@@ -53,7 +53,7 @@
<reponame>HDP-UTILS</reponame>
</repo>
</os>
- <os family="ubuntu7">
+ <os family="debian7">
<repo>
<baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian6/2.x/updates/2.3.0.0</baseurl>
<repoid>HDP-2.3</repoid>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/metainfo.xml
index 91692f6..7d48b3e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/metainfo.xml
@@ -31,7 +31,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>accumulo-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/FALCON/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/FALCON/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/FALCON/metainfo.xml
index 017d494..02683e5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/FALCON/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/FALCON/metainfo.xml
@@ -31,7 +31,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>falcon-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/FLUME/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/FLUME/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/FLUME/metainfo.xml
index 1398ca5..af75fc5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/FLUME/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/FLUME/metainfo.xml
@@ -32,7 +32,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>flume-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/HBASE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HBASE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HBASE/metainfo.xml
index 3fe37bd..060721b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HBASE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HBASE/metainfo.xml
@@ -35,7 +35,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>hbase-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
index 2c8d8be..071ec91 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
@@ -51,7 +51,7 @@
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>hadoop-2-3-.*-client</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/metainfo.xml
index 2a32b0d..1e6bdfd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/metainfo.xml
@@ -49,7 +49,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>hive-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/KAFKA/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/KAFKA/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/KAFKA/metainfo.xml
index dad36ed..92c4da0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/KAFKA/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/KAFKA/metainfo.xml
@@ -31,7 +31,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>kafka-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/KNOX/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/KNOX/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/KNOX/metainfo.xml
index 1ab9c2f..8a3670b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/KNOX/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/KNOX/metainfo.xml
@@ -31,7 +31,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>knox-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/metainfo.xml
index e551b10..9b4d05c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/metainfo.xml
@@ -48,7 +48,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>oozie-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/PIG/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/PIG/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/PIG/metainfo.xml
index 38e3c80..ae5718f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/PIG/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/PIG/metainfo.xml
@@ -39,7 +39,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>pig-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/metainfo.xml
index 7f98fb3..429270c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/metainfo.xml
@@ -37,7 +37,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>ranger-2-3-.*-admin</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/SLIDER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/SLIDER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/SLIDER/metainfo.xml
index 10b78bc..4c33d52 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/SLIDER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/SLIDER/metainfo.xml
@@ -34,7 +34,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>slider-2-3-.*</name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/36ac5782/ambari-server/src/main/resources/stacks/HDP/2.3/services/SPARK/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/SPARK/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/SPARK/metainfo.xml
index bb00924..a4b9ef4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/SPARK/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/SPARK/metainfo.xml
@@ -37,7 +37,7 @@
</packages>
</osSpecific>
<osSpecific>
- <osFamily>ubuntu7,ubuntu12</osFamily>
+ <osFamily>debian7,ubuntu12</osFamily>
<packages>
<package>
<name>spark-2-3-.*</name>