Repository: ambari Updated Branches: refs/heads/trunk e7643d5eb -> 7f542913b
AMBARI-10553. symlinks for libsnappy.so are not accurate for HDP-2.2 Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7f542913 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7f542913 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7f542913 Branch: refs/heads/trunk Commit: 7f542913bae6cd0a3fe4ead9d507a5e3858545f0 Parents: e7643d5 Author: Sumit Mohanty <smoha...@hortonworks.com> Authored: Fri Apr 17 13:23:08 2015 -0700 Committer: Sumit Mohanty <smoha...@hortonworks.com> Committed: Fri Apr 17 13:23:08 2015 -0700 ---------------------------------------------------------------------- .../src/test/python/resource_management/TestLinkResource.py | 2 +- .../src/test/python/resource_management/TestUserResource.py | 6 ++++-- .../main/python/resource_management/core/providers/system.py | 4 ++-- .../stacks/HDP/2.0.6/hooks/before-START/scripts/params.py | 2 ++ .../2.0.6/hooks/before-START/scripts/shared_initialization.py | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/7f542913/ambari-agent/src/test/python/resource_management/TestLinkResource.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/test/python/resource_management/TestLinkResource.py b/ambari-agent/src/test/python/resource_management/TestLinkResource.py index 88a20a5..ceac076 100644 --- a/ambari-agent/src/test/python/resource_management/TestLinkResource.py +++ b/ambari-agent/src/test/python/resource_management/TestLinkResource.py @@ -62,7 +62,7 @@ class TestLinkResource(TestCase): self.fail("Must fail when directory or file with name /some_path exist") except Fail as e: - self.assertEqual("LinkProvider[Link['/some_path']] trying to create a symlink with the same name as an existing file or directory", + self.assertEqual("Link['/some_path'] trying to create a symlink with the same name as an existing file or directory", str(e)) @patch.object(sudo, "path_lexists") http://git-wip-us.apache.org/repos/asf/ambari/blob/7f542913/ambari-agent/src/test/python/resource_management/TestUserResource.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/test/python/resource_management/TestUserResource.py b/ambari-agent/src/test/python/resource_management/TestUserResource.py index 4d83073..07b4e1e 100644 --- a/ambari-agent/src/test/python/resource_management/TestUserResource.py +++ b/ambari-agent/src/test/python/resource_management/TestUserResource.py @@ -17,7 +17,7 @@ limitations under the License. ''' from unittest import TestCase -from mock.mock import patch, MagicMock +from mock.mock import patch, MagicMock, PropertyMock from resource_management.core import Environment, Fail from resource_management.core.system import System @@ -170,11 +170,13 @@ class TestUserResource(TestCase): popen_mock.assert_called_with(['/bin/bash', '--login', '--noprofile', '-c', "ambari-sudo.sh PATH=/bin -H -E usermod -s /bin/bash -g 1 mapred"], shell=False, preexec_fn=None, stderr=-2, stdout=5, bufsize=1, env={'PATH': '/bin'}, cwd=None, close_fds=True) self.assertEqual(popen_mock.call_count, 1) + @patch('resource_management.core.providers.accounts.UserProvider.user_groups', new_callable=PropertyMock) @patch.object(subprocess, "Popen") @patch.object(pwd, "getpwnam") - def test_attribute_groups(self, getpwnam_mock, popen_mock): + def test_attribute_groups(self, getpwnam_mock, popen_mock, user_groups_mock): subproc_mock = MagicMock() subproc_mock.returncode = 0 + user_groups_mock.return_value = ['hadoop'] subproc_mock.stdout.readline = MagicMock(side_effect = ['OK']) popen_mock.return_value = subproc_mock getpwnam_mock.return_value = 1 http://git-wip-us.apache.org/repos/asf/ambari/blob/7f542913/ambari-common/src/main/python/resource_management/core/providers/system.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/core/providers/system.py b/ambari-common/src/main/python/resource_management/core/providers/system.py index 1e4ce90..6a41bc1 100644 --- a/ambari-common/src/main/python/resource_management/core/providers/system.py +++ b/ambari-common/src/main/python/resource_management/core/providers/system.py @@ -208,7 +208,7 @@ class LinkProvider(Provider): return if not sudo.path_lexists(path): raise Fail( - "%s trying to create a symlink with the same name as an existing file or directory" % self) + "%s trying to create a symlink with the same name as an existing file or directory" % self.resource) Logger.info("%s replacing old symlink to %s" % (self.resource, oldpath)) sudo.unlink(path) @@ -224,7 +224,7 @@ class LinkProvider(Provider): if not sudo.path_exists(self.resource.to): Logger.info("Warning: linking to nonexistent location %s" % self.resource.to) - Logger.info("Creating symbolic %s" % self.resource) + Logger.info("Creating symbolic %s to %s" % (self.resource, self.resource.to)) sudo.symlink(self.resource.to, path) def action_delete(self): http://git-wip-us.apache.org/repos/asf/ambari/blob/7f542913/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 0c18645..e89fd63 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 @@ -35,12 +35,14 @@ if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0: hadoop_lib_home = "/usr/hdp/current/hadoop-client/lib" hadoop_bin = "/usr/hdp/current/hadoop-client/sbin" hadoop_home = '/usr/hdp/current/hadoop-client' + create_lib_snappy_symlinks = False else: mapreduce_libs_path = "/usr/lib/hadoop-mapreduce/*" hadoop_libexec_dir = "/usr/lib/hadoop/libexec" hadoop_lib_home = "/usr/lib/hadoop/lib" hadoop_bin = "/usr/lib/hadoop/sbin" hadoop_home = '/usr' + create_lib_snappy_symlinks = True current_service = config['serviceName'] hadoop_conf_dir = "/etc/hadoop/conf" http://git-wip-us.apache.org/repos/asf/ambari/blob/7f542913/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py index bd5c228..e371b00 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py @@ -160,7 +160,7 @@ def install_snappy(): so_src_dir_x64 = format("{hadoop_home}/lib64") so_src_x86 = format("{so_src_dir_x86}/{snappy_so}") so_src_x64 = format("{so_src_dir_x64}/{snappy_so}") - if params.has_namenode: + if params.has_namenode and params.create_lib_snappy_symlinks: Directory([so_target_dir_x86, so_target_dir_x64], recursive=True, )