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 03CF9200BB4 for ; Tue, 1 Nov 2016 18:34:37 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 02695160AF7; Tue, 1 Nov 2016 17:34:37 +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 45B4C160ADA for ; Tue, 1 Nov 2016 18:34:36 +0100 (CET) Received: (qmail 54728 invoked by uid 500); 1 Nov 2016 17:34: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 54716 invoked by uid 99); 1 Nov 2016 17:34:35 -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; Tue, 01 Nov 2016 17:34:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2279BE0C0A; Tue, 1 Nov 2016 17:34:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dsen@apache.org To: commits@ambari.apache.org Message-Id: <76d40081c44c4bd7b10086d67c86d2d1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-18760 ambari-server.pid might not be created (dsen) Date: Tue, 1 Nov 2016 17:34:35 +0000 (UTC) archived-at: Tue, 01 Nov 2016 17:34:37 -0000 Repository: ambari Updated Branches: refs/heads/branch-2.4 db618b29c -> 7077ccb37 AMBARI-18760 ambari-server.pid might not be created (dsen) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7077ccb3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7077ccb3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7077ccb3 Branch: refs/heads/branch-2.4 Commit: 7077ccb37c9fd138cca5dbd203d0a61099796a36 Parents: db618b2 Author: Dmytro Sen Authored: Tue Nov 1 19:26:05 2016 +0200 Committer: Dmytro Sen Committed: Tue Nov 1 19:31:53 2016 +0200 ---------------------------------------------------------------------- ambari-server/src/main/python/ambari_server/utils.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/7077ccb3/ambari-server/src/main/python/ambari_server/utils.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/utils.py b/ambari-server/src/main/python/ambari_server/utils.py index 012d428..5f0a64d 100644 --- a/ambari-server/src/main/python/ambari_server/utils.py +++ b/ambari-server/src/main/python/ambari_server/utils.py @@ -103,12 +103,14 @@ def save_pid(pid, pidfile): try: pfile = open(pidfile, "w") pfile.write("%s\n" % pid) - except IOError: + except IOError as e: + print_error_msg("Failed to write PID to " + pidfile + " due to " + str(e)) pass finally: try: pfile.close() - except: + except Exception as e: + print_error_msg("Failed to close PID file " + pidfile + " due to " + str(e)) pass @@ -130,12 +132,14 @@ def save_main_pid_ex(pids, pidfile, exclude_list=[], kill_exclude_list=False, sk os.kill(int(item["pid"]), signal.SIGKILL) except: pass - except IOError: + except IOError as e: + print_error_msg("Failed to write PID to " + pidfile + " due to " + str(e)) pass finally: try: pfile.close() - except: + except Exception as e: + print_error_msg("Failed to close PID file " + pidfile + " due to " + str(e)) pass