Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 15F8617FD4 for ; Tue, 28 Oct 2014 18:07:35 +0000 (UTC) Received: (qmail 54451 invoked by uid 500); 28 Oct 2014 18:07:35 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 54438 invoked by uid 500); 28 Oct 2014 18:07:35 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 54429 invoked by uid 99); 28 Oct 2014 18:07:34 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Oct 2014 18:07:34 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A8E8799677A; Tue, 28 Oct 2014 18:07:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aonishuk@apache.org To: commits@ambari.apache.org Message-Id: <75f581ddf60e4f7ba60ba522c3dcc3e0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: AMBARI-8005. Cannot get 1.7.0 to start with non-root daemon (aonishuk) Date: Tue, 28 Oct 2014 18:07:34 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/branch-1.7.0 fc134b7c1 -> 387f5a8e7 AMBARI-8005. Cannot get 1.7.0 to start with non-root daemon (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/387f5a8e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/387f5a8e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/387f5a8e Branch: refs/heads/branch-1.7.0 Commit: 387f5a8e75336c6759cd28952d9917a1df80b17c Parents: fc134b7 Author: Andrew Onishuk Authored: Tue Oct 28 20:07:28 2014 +0200 Committer: Andrew Onishuk Committed: Tue Oct 28 20:07:28 2014 +0200 ---------------------------------------------------------------------- ambari-server/src/main/python/ambari-server.py | 10 +++++++++- ambari-server/src/test/python/TestAmbariServer.py | 9 ++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/387f5a8e/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 a36bb77..ee5ed17 100755 --- a/ambari-server/src/main/python/ambari-server.py +++ b/ambari-server/src/main/python/ambari-server.py @@ -554,9 +554,13 @@ NR_ADJUST_OWNERSHIP_LIST = [ ("/var/lib/ambari-server/keys/.ssh", "700", "{0}", False), ("/var/lib/ambari-server/resources/stacks/", "755", "{0}", True), ("/var/lib/ambari-server/resources/custom_actions/", "755", "{0}", True), + ("/var/lib/ambari-server/resources/views", "644", "{0}", True), + ("/var/lib/ambari-server/resources/views", "755", "{0}", False), + ("/var/lib/ambari-server/resources/views/work", "755", "{0}", True), ("/etc/ambari-server/conf", "644", "{0}", True), ("/etc/ambari-server/conf", "755", "{0}", False), ("/etc/ambari-server/conf/password.dat", "640", "{0}", False), + ("/var/lib/ambari-server/keys/pass.txt", "640", "{0}", False), ("/etc/ambari-server/conf/ldap-password.dat", "640", "{0}", False), # Also, /etc/ambari-server/conf/password.dat # is generated later at store_password_file @@ -691,6 +695,7 @@ def adjust_directory_permissions(ambari_user): if trust_store_location: NR_ADJUST_OWNERSHIP_LIST.append((trust_store_location, "600", "{0}", "{0}", False)) print "Adjusting ambari-server permissions and ownership..." + for pack in NR_ADJUST_OWNERSHIP_LIST: file = pack[0] mod = pack[1] @@ -1246,7 +1251,6 @@ def prompt_db_properties(args): # extract the system views def extract_views(): - jdk_path = find_jdk() if jdk_path is None: print_error_msg("No JDK found, please run the \"setup\" " @@ -2269,6 +2273,7 @@ def setup(args): # Create ambari user, if needed retcode = check_ambari_user() + if not retcode == 0: err = 'Failed to create user. Exiting.' raise FatalException(retcode, err) @@ -2365,6 +2370,9 @@ def setup(args): if not retcode == 0: err = 'Error while extracting system views. Exiting' raise FatalException(retcode, err) + + # we've already done this, but new files were created so run it one time. + adjust_directory_permissions(read_ambari_user()) def proceedJDBCProperties(args): http://git-wip-us.apache.org/repos/asf/ambari/blob/387f5a8e/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 450b385..c3651eb 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -2370,7 +2370,9 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV @patch.object(ambari_server, 'is_server_runing') @patch.object(ambari_server, 'proceedJDBCProperties') @patch.object(ambari_server, "extract_views") - def test_setup(self, extract_views_mock, proceedJDBCProperties_mock, is_server_runing_mock, is_root_mock, store_local_properties_mock, + @patch.object(ambari_server, "adjust_directory_permissions") + @patch.object(ambari_server, 'read_ambari_user') + def test_setup(self, read_ambari_user_mock, adjust_dirs_mock, extract_views_mock, proceedJDBCProperties_mock, is_server_runing_mock, is_root_mock, store_local_properties_mock, is_local_database_mock, store_remote_properties_mock, setup_remote_db_mock, check_selinux_mock, check_jdbc_drivers_mock, check_ambari_user_mock, check_postgre_up_mock, setup_db_mock, configure_postgres_mock, @@ -5257,9 +5259,10 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV @patch.object(ambari_server, "get_is_secure") @patch.object(ambari_server, "store_password_file") @patch.object(ambari_server, "extract_views") + @patch.object(ambari_server, "adjust_directory_permissions") @patch("sys.exit") @patch('__builtin__.raw_input') - def test_ambariServerSetupWithCustomDbName(self, raw_input, exit_mock, extract_views_mock, store_password_file_mock, + def test_ambariServerSetupWithCustomDbName(self, raw_input, exit_mock, adjust_dirs_mock, extract_views_mock, store_password_file_mock, get_is_secure_mock, setup_db_mock, is_root_mock, is_local_database_mock, check_selinux_mock, check_jdbc_drivers_mock, check_ambari_user_mock, check_postgre_up_mock, configure_postgres_mock, @@ -5310,7 +5313,7 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV try: result = ambari_server.setup(args) - except FatalException: + except FatalException as ex: self.fail("Setup should be successful") properties = ambari_server.get_ambari_properties()