This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 929ac2e  [AMBARI-22946]. Download client configs API failing with 500 
server error (amagyar) (#314)
929ac2e is described below

commit 929ac2eaf4261bf61d0d4ad9c1bbd8794808bd33
Author: Attila Magyar <m.magy...@gmail.com>
AuthorDate: Fri Feb 9 22:13:42 2018 +0100

    [AMBARI-22946]. Download client configs API failing with 500 server error 
(amagyar) (#314)
    
    * AMBARI-22946. Download client configs API failing with 500 server error 
(amagyar)
    
    * AMBARI-22946. Download client configs API failing with 500 server error 
(amagyar)
    
    * AMBARI-22946. Download client configs API failing with 500 server error 
(amagyar)
    
    * AMBARI-22946. Download client configs API failing with 500 server error 
(amagyar)
---
 .../src/main/python/ambari_agent/Constants.py       | 21 ---------------------
 .../ambari_agent/CustomServiceOrchestrator.py       |  4 ++--
 .../src/main/python/ambari_agent/HostCleanup.py     |  2 +-
 .../main/python/ambari_agent/alerts/metric_alert.py |  4 ++--
 .../main/python/ambari_agent/alerts/script_alert.py |  4 ++--
 .../main/python/ambari_agent/alerts/web_alert.py    |  4 ++--
 .../src/main/python/ambari_commons/constants.py     |  1 +
 .../ambari_commons/kerberos/kerberos_common.py      |  4 ++--
 .../KERBEROS/package/scripts/kerberos_common.py     |  4 ++--
 9 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/ambari-agent/src/main/python/ambari_agent/Constants.py 
b/ambari-agent/src/main/python/ambari_agent/Constants.py
deleted file mode 100644
index 6b80f00..0000000
--- a/ambari-agent/src/main/python/ambari_agent/Constants.py
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env python
-
-'''
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-'''
-
-AGENT_TMP_DIR = "/var/lib/ambari-agent/tmp"
\ No newline at end of file
diff --git 
a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py 
b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index f92ef1d..e37cce4 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -32,7 +32,7 @@ from PythonReflectiveExecutor import PythonReflectiveExecutor
 from resource_management.libraries.functions.log_process_information import 
log_process_information
 from resource_management.core.utils import PasswordString
 import subprocess
-import Constants
+from ambari_commons.constants import AGENT_TMP_DIR
 import hostname
 
 
@@ -83,7 +83,7 @@ class CustomServiceOrchestrator():
     self.tmp_dir = config.get('agent', 'prefix')
     self.force_https_protocol = config.get_force_https_protocol_name()
     self.ca_cert_file_path = config.get_ca_cert_file_path()
-    self.exec_tmp_dir = Constants.AGENT_TMP_DIR
+    self.exec_tmp_dir = AGENT_TMP_DIR
     self.file_cache = FileCache(config)
     self.status_commands_stdout = os.path.join(self.tmp_dir,
                                                'status_command_stdout.txt')
diff --git a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py 
b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
index 3db90ea..2406bb8 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
@@ -39,7 +39,7 @@ import glob
 import pwd
 import re
 from AmbariConfig import AmbariConfig
-from ambari_agent.Constants import AGENT_TMP_DIR
+from ambari_commons.constants import AGENT_TMP_DIR
 from ambari_commons import OSCheck, OSConst
 from ambari_commons.constants import AMBARI_SUDO_BINARY
 from ambari_commons.os_family_impl import OsFamilyImpl, OsFamilyFuncImpl
diff --git a/ambari-agent/src/main/python/ambari_agent/alerts/metric_alert.py 
b/ambari-agent/src/main/python/ambari_agent/alerts/metric_alert.py
index 64a1a29..7ab7211 100644
--- a/ambari-agent/src/main/python/ambari_agent/alerts/metric_alert.py
+++ b/ambari-agent/src/main/python/ambari_agent/alerts/metric_alert.py
@@ -31,7 +31,7 @@ from ambari_commons.urllib_handlers import 
RefreshHeaderProcessor
 from resource_management.libraries.functions.get_port_from_url import 
get_port_from_url
 from resource_management.libraries.functions.curl_krb_request import 
curl_krb_request
 from ambari_commons import inet_utils
-from ambari_agent import Constants
+from ambari_commons.constants import AGENT_TMP_DIR
 
 logger = logging.getLogger()
 
@@ -202,7 +202,7 @@ class MetricAlert(BaseAlert):
       content = ''
       try:
         if kerberos_principal is not None and kerberos_keytab is not None and 
security_enabled:
-          tmp_dir = Constants.AGENT_TMP_DIR
+          tmp_dir = AGENT_TMP_DIR
           if tmp_dir is None:
             tmp_dir = gettempdir()
 
diff --git a/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py 
b/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py
index 945a222..a6e19a6 100644
--- a/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py
+++ b/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py
@@ -25,7 +25,7 @@ import re
 from alerts.base_alert import BaseAlert
 from resource_management.core.environment import Environment
 from resource_management.libraries.functions.curl_krb_request import 
KERBEROS_KINIT_TIMER_PARAMETER
-from ambari_agent import Constants
+from ambari_commons.constants import AGENT_TMP_DIR
 
 logger = logging.getLogger("ambari_alerts")
 
@@ -111,7 +111,7 @@ class ScriptAlert(BaseAlert):
       matchObj = re.match( r'((.*)services(.*)package)', self.path_to_script)
       if matchObj:
         basedir = matchObj.group(1)
-        with Environment(basedir, tmp_dir=Constants.AGENT_TMP_DIR, 
logger=logging.getLogger('ambari_alerts')) as env:
+        with Environment(basedir, tmp_dir=AGENT_TMP_DIR, 
logger=logging.getLogger('ambari_alerts')) as env:
           result = cmd_module.execute(configurations, self.parameters, 
self.host_name)
       else:
         result = cmd_module.execute(configurations, self.parameters, 
self.host_name)
diff --git a/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py 
b/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py
index 6e01b89..e3a5839 100644
--- a/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py
+++ b/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py
@@ -32,7 +32,7 @@ from 
resource_management.libraries.functions.get_path_from_url import get_path_f
 from resource_management.libraries.functions.curl_krb_request import 
curl_krb_request
 from ambari_commons import OSCheck
 from ambari_commons.inet_utils import resolve_address, 
ensure_ssl_using_protocol, get_host_from_url
-from ambari_agent import Constants
+from ambari_commons.constants import AGENT_TMP_DIR
 from ambari_agent.AmbariConfig import AmbariConfig
 
 # hashlib is supplied as of Python 2.5 as the replacement interface for md5
@@ -190,7 +190,7 @@ class WebAlert(BaseAlert):
         # Create the kerberos credentials cache (ccache) file and set it in 
the environment to use
         # when executing curl. Use the md5 hash of the combination of the 
principal and keytab file
         # to generate a (relatively) unique cache filename so that we can use 
it as needed.
-        tmp_dir = Constants.AGENT_TMP_DIR
+        tmp_dir = AGENT_TMP_DIR
         if tmp_dir is None:
           tmp_dir = gettempdir()
 
diff --git a/ambari-common/src/main/python/ambari_commons/constants.py 
b/ambari-common/src/main/python/ambari_commons/constants.py
index b59ad53..31133fc 100644
--- a/ambari-common/src/main/python/ambari_commons/constants.py
+++ b/ambari-common/src/main/python/ambari_commons/constants.py
@@ -24,6 +24,7 @@ UPGRADE_TYPE_ROLLING = "rolling"
 UPGRADE_TYPE_NON_ROLLING = "nonrolling"
 UPGRADE_TYPE_HOST_ORDERED = "host_ordered"
 
+AGENT_TMP_DIR = "/var/lib/ambari-agent/tmp"
 
 class SERVICE:
   """
diff --git 
a/ambari-common/src/main/python/ambari_commons/kerberos/kerberos_common.py 
b/ambari-common/src/main/python/ambari_commons/kerberos/kerberos_common.py
index c0ac580..ee06204 100644
--- a/ambari-common/src/main/python/ambari_commons/kerberos/kerberos_common.py
+++ b/ambari-common/src/main/python/ambari_commons/kerberos/kerberos_common.py
@@ -21,7 +21,7 @@ import base64
 import getpass
 import os
 import stat
-from ambari_agent import Constants
+from ambari_commons.constants import AGENT_TMP_DIR
 from collections import namedtuple
 from resource_management.core import sudo
 from resource_management.core.logger import Logger
@@ -97,7 +97,7 @@ def write_krb5_conf(params):
 
 
 def clear_tmp_cache():
-  tmp_dir = Constants.AGENT_TMP_DIR
+  tmp_dir = AGENT_TMP_DIR
   if tmp_dir is None:
     tmp_dir = gettempdir()
   curl_krb_cache_path = os.path.join(tmp_dir, "curl_krb_cache")
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py
index d959f11..adb863c 100644
--- 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py
@@ -29,7 +29,7 @@ from tempfile import gettempdir
 from resource_management import *
 from utils import get_property_value
 from ambari_commons.os_utils import remove_file
-from ambari_agent import Constants
+from ambari_commons.constants import AGENT_TMP_DIR
 from collections import namedtuple
 from resource_management.core import sudo
 from resource_management.core.resources.klist import Klist
@@ -289,7 +289,7 @@ class KerberosScript(Script):
 
   @staticmethod
   def clear_tmp_cache():
-    tmp_dir = Constants.AGENT_TMP_DIR
+    tmp_dir = AGENT_TMP_DIR
     if tmp_dir is None:
       tmp_dir = gettempdir()
     curl_krb_cache_path = os.path.join(tmp_dir, "curl_krb_cache")

-- 
To stop receiving notification emails like this one, please contact
amag...@apache.org.

Reply via email to