You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by od...@apache.org on 2013/09/27 19:29:02 UTC
git commit: AMBARI-3283. Provide more clear warning and prompt for
confirmation on 'setup' regarding iptables. (odiachenko)
Updated Branches:
refs/heads/trunk 6fb5ae4f7 -> df7c622fd
AMBARI-3283. Provide more clear warning and prompt for confirmation on 'setup' regarding iptables. (odiachenko)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/df7c622f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/df7c622f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/df7c622f
Branch: refs/heads/trunk
Commit: df7c622fdd7f40d07873a3ec19e533d74c2d73a8
Parents: 6fb5ae4
Author: Oleksandr Diachenko <od...@hortonworks.com>
Authored: Fri Sep 27 20:28:05 2013 +0300
Committer: Oleksandr Diachenko <od...@hortonworks.com>
Committed: Fri Sep 27 20:28:16 2013 +0300
----------------------------------------------------------------------
ambari-server/src/main/python/ambari-server.py | 9 +++++----
ambari-server/src/test/python/TestAmbariServer.py | 17 ++++++++---------
2 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/df7c622f/ambari-server/src/main/python/ambari-server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server.py b/ambari-server/src/main/python/ambari-server.py
index d6603e3..68e122b 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -771,8 +771,11 @@ def check_iptables():
print err
if out and len(out) > 0 and not out.strip() == IP_TBLS_IS_NOT_RUNNING:
- print_warning_msg('Iptables is running.')
-
+ print_warning_msg("iptables is running. Confirm the necessary Ambari ports are accessible. " +
+ "Refer to the Ambari documentation for more details on ports.")
+ ok = get_YN_input("OK to continue [y/n] (y)? ", True)
+ if not ok:
+ raise FatalException(1, None)
### Postgres ###
@@ -2240,8 +2243,6 @@ def start(args):
err = "Unable to start PostgreSQL server. Exiting"
raise FatalException(retcode, err)
- print 'Checking iptables...'
- check_iptables()
else: # Skipping actions that require root permissions
print "Unable to check iptables status when starting "\
"without root privileges."
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/df7c622f/ambari-server/src/test/python/TestAmbariServer.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py
index 9700468..65dfc7c 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -989,11 +989,15 @@ class TestAmbariServer(TestCase):
@patch.object(ambari_server, "run_os_command")
@patch.object(ambari_server, "print_warning_msg")
- def test_check_iptables_is_running(self, print_warning_msg, run_os_command_mock):
+ @patch.object(ambari_server, "get_YN_input")
+ def test_check_iptables_is_running(self, get_YN_input_mock, print_warning_msg, run_os_command_mock):
run_os_command_mock.return_value = (0, "Table: filter", "")
+ get_YN_input_mock.side_effect = [True]
ambari_server.check_iptables()
-
- self.assertEqual(print_warning_msg.call_args_list[0][0][0], "Iptables is running.")
+ self.assertEqual(print_warning_msg.call_args_list[0][0][0],
+ "iptables is running. Confirm the necessary Ambari ports are accessible. " +
+ "Refer to the Ambari documentation for more details on ports."
+ )
@patch.object(ambari_server, "run_os_command")
@patch.object(ambari_server, "print_warning_msg")
@@ -2166,14 +2170,13 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
@patch.object(ambari_server, "find_jdk")
@patch.object(ambari_server, "print_error_msg")
@patch.object(ambari_server, "check_postgre_up")
- @patch.object(ambari_server, "check_iptables")
@patch.object(ambari_server, "parse_properties_file")
@patch.object(ambari_server, "read_ambari_user")
@patch.object(ambari_server, "is_root")
@patch("getpass.getuser")
@patch("os.chdir")
def test_start(self, chdir_mock, getuser_mock, is_root_mock, read_ambari_user_mock,
- parse_properties_file_mock, check_iptables_mock, check_postgre_up_mock,
+ parse_properties_file_mock, check_postgre_up_mock,
print_error_msg_mock, find_jdk_mock, search_file_mock,
print_info_msg_mock, popenMock, openMock, pexistsMock,
killMock, get_ambari_properties_mock, os_environ_mock,
@@ -2254,7 +2257,6 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
# Remote DB
args.persistence_type = "remote"
- check_iptables_mock.return_value = (0, None)
try:
ambari_server.start(args)
except FatalException as e:
@@ -2332,13 +2334,10 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
parse_properties_file_mock.reset_mock()
# Checking call
- check_iptables_mock.reset_mock()
- check_iptables_mock.return_value = (0, None)
ambari_server.start(args)
self.assertTrue(popenMock.called)
popen_arg = popenMock.call_args[0][0]
self.assertTrue(popen_arg[0] == "/bin/sh")
- self.assertFalse(check_iptables_mock.called)
parse_properties_file_mock.reset_mock()