Repository: ambari Updated Branches: refs/heads/branch-2.4 2225ad2a7 -> 049c5838e refs/heads/trunk 4426c62ed -> 3f080663a
AMBARI-16735. HDFS data disk mount point permissions (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3f080663 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3f080663 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3f080663 Branch: refs/heads/trunk Commit: 3f080663a4b84ddf8cae52fcbf05599114503e1b Parents: 4426c62 Author: Andrew Onishuk <[email protected]> Authored: Wed May 18 18:26:52 2016 +0300 Committer: Andrew Onishuk <[email protected]> Committed: Wed May 18 18:26:52 2016 +0300 ---------------------------------------------------------------------- .../python/resource_management/TestDatanodeHelper.py | 12 +++++++++--- .../libraries/functions/dfs_datanode_helper.py | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/3f080663/ambari-agent/src/test/python/resource_management/TestDatanodeHelper.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/test/python/resource_management/TestDatanodeHelper.py b/ambari-agent/src/test/python/resource_management/TestDatanodeHelper.py index 4a1a1ba..1f16668 100644 --- a/ambari-agent/src/test/python/resource_management/TestDatanodeHelper.py +++ b/ambari-agent/src/test/python/resource_management/TestDatanodeHelper.py @@ -22,6 +22,7 @@ from mock.mock import Mock, MagicMock, patch from resource_management.libraries.functions import dfs_datanode_helper from resource_management.core.logger import Logger +from resource_management import Directory class StubParams(object): @@ -61,11 +62,14 @@ class TestDatanodeHelper(TestCase): params = StubParams() params.data_dir_mount_file = "/var/lib/ambari-agent/data/datanode/dfs_data_dir_mount.hist" params.dfs_data_dir = "{0},{1},{2}".format(grid0, grid1, grid2) + params.hdfs_user = "hdfs_test" + params.user_group = "hadoop_test" + @patch.object(Logger, "warning") @patch.object(Logger, "info") @patch.object(Logger, "error") - def test_normalized(self, log_error, log_info): + def test_normalized(self, log_error, log_info, warning_info): """ Test that the data dirs are normalized by removing leading and trailing whitespace, and case sensitive. """ @@ -93,7 +97,8 @@ class TestDatanodeHelper(TestCase): @patch.object(dfs_datanode_helper, "get_mount_point_for_dir") @patch.object(os.path, "isdir") @patch.object(os.path, "exists") - def test_grid_becomes_unmounted(self, mock_os_exists, mock_os_isdir, mock_get_mount_point, mock_get_data_dir_to_mount_from_file, log_error, log_info): + def test_grid_becomes_unmounted(self, mock_os_exists, mock_os_isdir, mock_get_mount_point, + mock_get_data_dir_to_mount_from_file, log_error, log_info): """ Test when grid2 becomes unmounted """ @@ -126,7 +131,8 @@ class TestDatanodeHelper(TestCase): @patch.object(dfs_datanode_helper, "get_mount_point_for_dir") @patch.object(os.path, "isdir") @patch.object(os.path, "exists") - def test_grid_becomes_remounted(self, mock_os_exists, mock_os_isdir, mock_get_mount_point, mock_get_data_dir_to_mount_from_file, log_error, log_info): + def test_grid_becomes_remounted(self, mock_os_exists, mock_os_isdir, mock_get_mount_point, + mock_get_data_dir_to_mount_from_file, log_error, log_info): """ Test when grid2 becomes remounted """ http://git-wip-us.apache.org/repos/asf/ambari/blob/3f080663/ambari-common/src/main/python/resource_management/libraries/functions/dfs_datanode_helper.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/dfs_datanode_helper.py b/ambari-common/src/main/python/resource_management/libraries/functions/dfs_datanode_helper.py index 33e7b41..571c089 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/dfs_datanode_helper.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/dfs_datanode_helper.py @@ -155,6 +155,7 @@ def handle_dfs_data_dir(func, params, update_cache=True): if os.path.isdir(data_dir) and data_dir not in data_dirs_unmounted: curr_mount_point = get_mount_point_for_dir(data_dir) data_dir_to_mount_point[data_dir] = curr_mount_point + func(data_dir, params) if error_messages and len(error_messages) > 0: header = " ERROR ".join(["*****"] * 6)
