ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject ambari git commit: AMBARI-15090. [Ambari tarballs] ambari-server python scripts should support running from custom root (aonishuk)
Date Thu, 18 Feb 2016 17:24:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 260419bb8 -> fab9fa5d8


AMBARI-15090. [Ambari tarballs] ambari-server python scripts should support running from custom
root (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fab9fa5d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fab9fa5d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fab9fa5d

Branch: refs/heads/trunk
Commit: fab9fa5d89a188719aa1c873123a94995e1c8aa3
Parents: 260419b
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Thu Feb 18 19:23:54 2016 +0200
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Thu Feb 18 19:24:10 2016 +0200

----------------------------------------------------------------------
 ambari-server/src/main/python/ambari_server/ambariPath.py | 4 +++-
 ambari-server/src/test/python/TestAmbariServer.py         | 2 +-
 ambari-server/src/test/python/TestBackupRestore.py        | 3 +++
 ambari-server/src/test/python/TestResourceFilesKeeper.py  | 3 +++
 ambari-server/src/test/python/TestServerClassPath.py      | 3 +++
 ambari-server/src/test/python/TestServerUpgrade.py        | 2 ++
 ambari-server/src/test/python/TestServerUtils.py          | 3 +++
 7 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fab9fa5d/ambari-server/src/main/python/ambari_server/ambariPath.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/ambariPath.py b/ambari-server/src/main/python/ambari_server/ambariPath.py
index 9d68206..1d57558 100644
--- a/ambari-server/src/main/python/ambari_server/ambariPath.py
+++ b/ambari-server/src/main/python/ambari_server/ambariPath.py
@@ -21,6 +21,7 @@ Ambari Agent
 """
 
 import os
+import re
 
 AMBARI_SERVER_ROOT_ENV_VARIABLE = "ROOT"
 
@@ -34,6 +35,7 @@ class AmbariPath():
     Which is needed for the situations when ambari-server installed not in / but in other
folder like /opt.
     Not ambari paths like /var/run/postgresql SHOULD NOT wrapped by this call though.
     """
-    return os.path.realpath(AmbariPath.root_directory + os.sep + path)
+    #return os.path.realpath(AmbariPath.root_directory + os.sep + path) # realpath won't
replace slashes for python2.6
+    return re.sub('/+', '/', AmbariPath.root_directory + os.sep + path)
     
   
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/fab9fa5d/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 6c19d5e..c47cc67 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -34,6 +34,7 @@ import stat
 import StringIO
 import tempfile
 from unittest import TestCase
+os.environ["ROOT"] = ""
 
 from only_for_platform import get_platform, not_for_platform, only_for_platform, os_distro_value,
PLATFORM_LINUX, PLATFORM_WINDOWS
 
@@ -45,7 +46,6 @@ with patch("platform.linux_distribution", return_value = os_distro_value):
   with patch("os.symlink"):
     with patch("__builtin__.open"):
       with patch("glob.glob", return_value = ['/etc/init.d/postgresql-9.3']):
-        os.environ["ROOT"] = ""
         _ambari_server_ = __import__('ambari-server')
 
         from ambari_commons.firewall import Firewall

http://git-wip-us.apache.org/repos/asf/ambari/blob/fab9fa5d/ambari-server/src/test/python/TestBackupRestore.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestBackupRestore.py b/ambari-server/src/test/python/TestBackupRestore.py
index 8a377ec..ab37ca1 100644
--- a/ambari-server/src/test/python/TestBackupRestore.py
+++ b/ambari-server/src/test/python/TestBackupRestore.py
@@ -19,6 +19,9 @@ limitations under the License.
 
 import unittest
 
+import os
+os.environ["ROOT"] = ""
+
 import mock
 from mock.mock import MagicMock, patch
 from ambari_server import BackupRestore

http://git-wip-us.apache.org/repos/asf/ambari/blob/fab9fa5d/ambari-server/src/test/python/TestResourceFilesKeeper.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestResourceFilesKeeper.py b/ambari-server/src/test/python/TestResourceFilesKeeper.py
index f6efeb6..966d3b1 100644
--- a/ambari-server/src/test/python/TestResourceFilesKeeper.py
+++ b/ambari-server/src/test/python/TestResourceFilesKeeper.py
@@ -16,6 +16,9 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
+import os
+os.environ["ROOT"] = ""
+
 import time
 import subprocess
 import os

http://git-wip-us.apache.org/repos/asf/ambari/blob/fab9fa5d/ambari-server/src/test/python/TestServerClassPath.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestServerClassPath.py b/ambari-server/src/test/python/TestServerClassPath.py
index e6c5ca8..7ec36da 100644
--- a/ambari-server/src/test/python/TestServerClassPath.py
+++ b/ambari-server/src/test/python/TestServerClassPath.py
@@ -17,6 +17,9 @@ limitations under the License.
 '''
 
 import os
+os.environ["ROOT"] = ""
+
+import os
 from mock.mock import patch, MagicMock
 from unittest import TestCase
 from ambari_server.properties import Properties

http://git-wip-us.apache.org/repos/asf/ambari/blob/fab9fa5d/ambari-server/src/test/python/TestServerUpgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestServerUpgrade.py b/ambari-server/src/test/python/TestServerUpgrade.py
index f728669..05a7c6b 100644
--- a/ambari-server/src/test/python/TestServerUpgrade.py
+++ b/ambari-server/src/test/python/TestServerUpgrade.py
@@ -16,6 +16,8 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
+import os
+os.environ["ROOT"] = ""
 import StringIO
 import sys
 from ambari_commons.exceptions import FatalException

http://git-wip-us.apache.org/repos/asf/ambari/blob/fab9fa5d/ambari-server/src/test/python/TestServerUtils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestServerUtils.py b/ambari-server/src/test/python/TestServerUtils.py
index 474a83d..70d8f5a 100644
--- a/ambari-server/src/test/python/TestServerUtils.py
+++ b/ambari-server/src/test/python/TestServerUtils.py
@@ -16,6 +16,9 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
+import os
+os.environ["ROOT"] = ""
+
 from unittest import TestCase
 from ambari_server.serverUtils import get_ambari_server_api_base
 from ambari_server.serverConfiguration import CLIENT_API_PORT, CLIENT_API_PORT_PROPERTY,
SSL_API, DEFAULT_SSL_API_PORT, SSL_API_PORT


Mime
View raw message