Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D020F200CBA for ; Mon, 3 Jul 2017 12:16:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CEA38160BEC; Mon, 3 Jul 2017 10:16:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2213C160BE4 for ; Mon, 3 Jul 2017 12:16:12 +0200 (CEST) Received: (qmail 2627 invoked by uid 500); 3 Jul 2017 10:16:12 -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 2618 invoked by uid 99); 3 Jul 2017 10:16:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jul 2017 10:16:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DAE61DFF8A; Mon, 3 Jul 2017 10:16:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: echekanskiy@apache.org To: commits@ambari.apache.org Message-Id: <8a3f11aedd9a4c8290a934408fce64b2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-21272. LDAP sync requires user to be root (echekanskiy) Date: Mon, 3 Jul 2017 10:16:10 +0000 (UTC) archived-at: Mon, 03 Jul 2017 10:16:14 -0000 Repository: ambari Updated Branches: refs/heads/trunk b5e40f9b2 -> 8e9df940f AMBARI-21272. LDAP sync requires user to be root (echekanskiy) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8e9df940 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8e9df940 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8e9df940 Branch: refs/heads/trunk Commit: 8e9df940fcc045c7b22cc571cd58d0a1e82dd530 Parents: b5e40f9 Author: Eugene Chekanskiy Authored: Mon Jul 3 13:15:56 2017 +0300 Committer: Eugene Chekanskiy Committed: Mon Jul 3 13:15:56 2017 +0300 ---------------------------------------------------------------------- .../src/main/python/ambari_server/setupSecurity.py | 4 ---- ambari-server/src/test/python/TestAmbariServer.py | 13 +------------ 2 files changed, 1 insertion(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8e9df940/ambari-server/src/main/python/ambari_server/setupSecurity.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/setupSecurity.py b/ambari-server/src/main/python/ambari_server/setupSecurity.py index 1508d27..17d1025 100644 --- a/ambari-server/src/main/python/ambari_server/setupSecurity.py +++ b/ambari-server/src/main/python/ambari_server/setupSecurity.py @@ -270,10 +270,6 @@ class LdapSyncOptions: # def sync_ldap(options): logger.info("Sync users and groups with configured LDAP.") - if not is_root(): - err = 'Ambari-server sync-ldap should be run with ' \ - 'root-level privileges' - raise FatalException(4, err) properties = get_ambari_properties() http://git-wip-us.apache.org/repos/asf/ambari/blob/8e9df940/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 c511237..1c4ebaf 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -7675,13 +7675,12 @@ class TestAmbariServer(TestCase): @patch("urllib2.urlopen") @patch("urllib2.Request") @patch("base64.encodestring") - @patch("ambari_server.setupSecurity.is_root") @patch("ambari_server.setupSecurity.is_server_runing") @patch("ambari_server.setupSecurity.get_ambari_properties") @patch("ambari_server.setupSecurity.get_validated_string_input") @patch("ambari_server.setupSecurity.logger") def test_sync_ldap_forbidden(self, logger_mock, get_validated_string_input_method, get_ambari_properties_method, - is_server_runing_method, is_root_method, + is_server_runing_method, encodestring_method, request_constructor, urlopen_method): options = self._create_empty_options_mock() @@ -7690,16 +7689,6 @@ class TestAmbariServer(TestCase): options.ldap_sync_users = None options.ldap_sync_groups = None - is_root_method.return_value = False - try: - sync_ldap(options) - self.fail("Should throw exception if not root") - except FatalException as fe: - # Expected - self.assertTrue("root-level" in fe.reason) - pass - is_root_method.return_value = True - is_server_runing_method.return_value = (None, None) try: sync_ldap(options)