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 D45951880E for ; Mon, 18 May 2015 13:29:52 +0000 (UTC) Received: (qmail 48660 invoked by uid 500); 18 May 2015 13:29:52 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 48631 invoked by uid 500); 18 May 2015 13:29:52 -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 48622 invoked by uid 99); 18 May 2015 13:29:52 -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, 18 May 2015 13:29:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9193ADFD9E; Mon, 18 May 2015 13:29:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: fbarca@apache.org To: commits@ambari.apache.org Message-Id: <0950d4e263c040178f2842f1803dc90b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-11206 [WinTP2] Ambari Agent fails to start Date: Mon, 18 May 2015 13:29:52 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/trunk 736696ba1 -> b950812eb AMBARI-11206 [WinTP2] Ambari Agent fails to start Moved the module imports inside functions, to immunize the startup against unused modules. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b950812e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b950812e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b950812e Branch: refs/heads/trunk Commit: b950812eb89cd0571aea16a12dc9dee8653fb883 Parents: 736696b Author: Florian Barca Authored: Mon May 18 06:27:42 2015 -0700 Committer: Florian Barca Committed: Mon May 18 06:29:23 2015 -0700 ---------------------------------------------------------------------- .../src/main/python/resource_management/core/utils.py | 6 ++++-- .../libraries/functions/check_process_status.py | 3 ++- .../libraries/providers/modify_properties_file.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/b950812e/ambari-common/src/main/python/resource_management/core/utils.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/core/utils.py b/ambari-common/src/main/python/resource_management/core/utils.py index f9ad193..cc8b404 100644 --- a/ambari-common/src/main/python/resource_management/core/utils.py +++ b/ambari-common/src/main/python/resource_management/core/utils.py @@ -20,8 +20,6 @@ Ambari Agent """ -import grp -import pwd from resource_management.core.exceptions import Fail class AttributeDictionary(object): @@ -110,6 +108,8 @@ def checked_unite(dict1, dict2): return result def _coerce_uid(user): + import pwd + try: uid = int(user) except ValueError: @@ -121,6 +121,8 @@ def _coerce_uid(user): def _coerce_gid(group): + import grp + try: gid = int(group) except ValueError: http://git-wip-us.apache.org/repos/asf/ambari/blob/b950812e/ambari-common/src/main/python/resource_management/libraries/functions/check_process_status.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/check_process_status.py b/ambari-common/src/main/python/resource_management/libraries/functions/check_process_status.py index a3efabd..a3e4a39 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/check_process_status.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/check_process_status.py @@ -23,7 +23,6 @@ Ambari Agent from resource_management.core.exceptions import ComponentIsNotRunning from resource_management.core.logger import Logger from resource_management.core import shell -from resource_management.core import sudo __all__ = ["check_process_status"] import os @@ -37,6 +36,8 @@ def check_process_status(pid_file): @param pid_file: path to service pid file """ + from resource_management.core import sudo + if not pid_file or not os.path.isfile(pid_file): raise ComponentIsNotRunning() http://git-wip-us.apache.org/repos/asf/ambari/blob/b950812e/ambari-common/src/main/python/resource_management/libraries/providers/modify_properties_file.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/providers/modify_properties_file.py b/ambari-common/src/main/python/resource_management/libraries/providers/modify_properties_file.py index a07881b..e71abb8 100644 --- a/ambari-common/src/main/python/resource_management/libraries/providers/modify_properties_file.py +++ b/ambari-common/src/main/python/resource_management/libraries/providers/modify_properties_file.py @@ -26,7 +26,7 @@ from resource_management.libraries.functions.format import format from resource_management.core.environment import Environment from resource_management.core.source import InlineTemplate from resource_management.core.logger import Logger -from resource_management import sudo +from resource_management.core import sudo class ModifyPropertiesFileProvider(Provider):