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

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


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new ea971eb  [AMBARI-22946]. Download client configs API failing with 500 
server err… (#308)
ea971eb is described below

commit ea971eb89fd02baa0b6a42dea901fdfa6bc2687d
Author: Attila Magyar <m.magy...@gmail.com>
AuthorDate: Fri Feb 9 15:28:55 2018 +0100

    [AMBARI-22946]. Download client configs API failing with 500 server err… 
(#308)
    
    * 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     |  3 +--
 .../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 +
 .../1.10.3-10/package/scripts/kerberos_common.py    |  4 ++--
 .../KERBEROS/package/scripts/kerberos_common.py     |  4 ++--
 .../KERBEROS/package/scripts/kerberos_common.py     |  4 ++--
 .../KERBEROS/package/scripts/kerberos_common.py     |  4 ++--
 11 files changed, 18 insertions(+), 39 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 f081c6e..7611cc8 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 58290ca..9183716 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
@@ -36,9 +36,8 @@ import shlex
 import datetime
 import tempfile
 from AmbariConfig import AmbariConfig
-from ambari_agent.Constants import AGENT_TMP_DIR
 from ambari_commons import OSCheck, OSConst
-from ambari_commons.constants import AMBARI_SUDO_BINARY
+from ambari_commons.constants import AMBARI_SUDO_BINARY, AGENT_TMP_DIR
 from ambari_commons.os_family_impl import OsFamilyImpl, OsFamilyFuncImpl
 
 logger = logging.getLogger()
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 803bdc6..9ba76a1 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
@@ -30,7 +30,7 @@ from alerts.base_alert import BaseAlert
 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_agent import Constants
+from ambari_commons.constants import AGENT_TMP_DIR
 
 logger = logging.getLogger()
 
@@ -200,7 +200,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 0e400f7..be743f6 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
@@ -34,7 +34,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
-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
@@ -192,7 +192,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-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py
 
b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py
index 2471432..24be170 100644
--- 
a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py
+++ 
b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/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
 
 class KerberosScript(Script):
   KRB5_REALM_PROPERTIES = [
@@ -285,7 +285,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")
diff --git 
a/ambari-server/src/main/resources/stacks/BigInsights/4.0/services/KERBEROS/package/scripts/kerberos_common.py
 
b/ambari-server/src/main/resources/stacks/BigInsights/4.0/services/KERBEROS/package/scripts/kerberos_common.py
index a05aead..df52e39 100755
--- 
a/ambari-server/src/main/resources/stacks/BigInsights/4.0/services/KERBEROS/package/scripts/kerberos_common.py
+++ 
b/ambari-server/src/main/resources/stacks/BigInsights/4.0/services/KERBEROS/package/scripts/kerberos_common.py
@@ -28,7 +28,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
 
 class KerberosScript(Script):
   KRB5_REALM_PROPERTIES = [
@@ -287,7 +287,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")
diff --git 
a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/KERBEROS/package/scripts/kerberos_common.py
 
b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/KERBEROS/package/scripts/kerberos_common.py
index e06b13f..3457141 100755
--- 
a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/KERBEROS/package/scripts/kerberos_common.py
+++ 
b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/KERBEROS/package/scripts/kerberos_common.py
@@ -28,7 +28,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
 
 class KerberosScript(Script):
   KRB5_REALM_PROPERTIES = [
@@ -287,7 +287,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")
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 abf58ee..81dba63 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
 
 class KerberosScript(Script):
   KRB5_REALM_PROPERTIES = [
@@ -286,7 +286,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