Procházet zdrojové kódy

AMBARI-6076. Ambari server is not starting after upgrade (aonishuk)

Andrew Onishuk před 11 roky
rodič
revize
cfcfea9b19
27 změnil soubory, kde provedl 67 přidání a 100 odebrání
  1. 12 3
      ambari-agent/conf/unix/install-helper.sh
  2. 6 10
      ambari-agent/pom.xml
  3. 0 19
      ambari-agent/src/main/package/rpm/posttrans.sh
  4. 1 1
      ambari-agent/src/main/python/ambari_agent/Facter.py
  5. 1 1
      ambari-agent/src/main/python/ambari_agent/HostCleanup.py
  6. 1 1
      ambari-agent/src/main/python/ambari_agent/HostInfo.py
  7. 1 1
      ambari-agent/src/main/python/resource_management/core/system.py
  8. 1 1
      ambari-agent/src/main/python/resource_management/libraries/providers/repository.py
  9. 1 1
      ambari-agent/src/test/python/ambari_agent/TestController.py
  10. 1 1
      ambari-agent/src/test/python/ambari_agent/TestHardware.py
  11. 1 1
      ambari-agent/src/test/python/ambari_agent/TestHostCleanup.py
  12. 1 1
      ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
  13. 1 1
      ambari-agent/src/test/python/ambari_agent/TestRegistration.py
  14. 1 1
      ambari-common/src/main/python/ambari_commons/__init__.py
  15. 0 0
      ambari-common/src/main/python/ambari_commons/os_check.py
  16. 1 1
      ambari-common/src/main/unix/ambari-python-wrap
  17. 9 5
      ambari-server/conf/unix/install-helper.sh
  18. 6 10
      ambari-server/pom.xml
  19. 0 19
      ambari-server/src/main/package/rpm/posttrans.sh
  20. 1 1
      ambari-server/src/main/python/ambari-server.py
  21. 1 1
      ambari-server/src/main/python/ambari_server/utils.py
  22. 2 2
      ambari-server/src/main/python/bootstrap.py
  23. 1 1
      ambari-server/src/main/python/os_check_type.py
  24. 1 1
      ambari-server/src/main/python/setupAgent.py
  25. 1 1
      ambari-server/src/main/resources/scripts/kerberos-setup.sh
  26. 1 1
      ambari-server/src/test/python/TestOSCheck.py
  27. 14 14
      ambari-server/src/test/python/TestSetupAgent.py

+ 12 - 3
ambari-agent/conf/unix/install-helper.sh

@@ -18,15 +18,17 @@
 #                      AGENT INSTALL HELPER                      #
 ##################################################################
 
-COMMON_DIR="/usr/lib/python2.6/site-packages/common_functions"
+COMMON_DIR="/usr/lib/python2.6/site-packages/ambari_commons"
+OLD_COMMON_DIR="/usr/lib/python2.6/site-packages/common_functions"
 INSTALL_HELPER_SERVER="/var/lib/ambari-server/install-helper.sh"
-COMMON_DIR_AGENT="/usr/lib/ambari-agent/lib/common_functions"
+COMMON_DIR_AGENT="/usr/lib/ambari-agent/lib/ambari_commons"
 
 PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap"
 PYTHON_WRAPER_SOURCE="/var/lib/ambari-agent/ambari-python-wrap"
 
 do_install(){
-  # setting common_functions shared resource
+  # setting ambari_commons shared resource
+  rm -rf "$OLD_COMMON_DIR"
   if [ ! -d "$COMMON_DIR" ]; then
     ln -s "$COMMON_DIR_AGENT" "$COMMON_DIR"
   fi
@@ -51,6 +53,10 @@ do_remove(){
   fi
 }
 
+do_upgrade(){
+  do_install
+}
+
 
 case "$1" in
 install)
@@ -59,4 +65,7 @@ install)
 remove)
   do_remove
   ;;
+upgrade)
+  do_upgrade
+;;
 esac

+ 6 - 10
ambari-agent/pom.xml

@@ -39,7 +39,7 @@
     <skipTests>false</skipTests>
     <agent.install.dir>/usr/lib/python2.6/site-packages/ambari_agent</agent.install.dir>
     <resmgmt.install.dir>/usr/lib/python2.6/site-packages/resource_management</resmgmt.install.dir>
-    <common_functions.install.dir>/usr/lib/ambari-agent/lib/common_functions</common_functions.install.dir>
+    <ambari_commons.install.dir>/usr/lib/ambari-agent/lib/ambari_commons</ambari_commons.install.dir>
     <jinja.install.dir>/usr/lib/python2.6/site-packages/jinja2</jinja.install.dir>
     <lib.dir>/usr/lib/ambari-agent/lib</lib.dir>
     <python.ver>python &gt;= 2.6</python.ver>
@@ -114,7 +114,7 @@
                 <argument>unitTests.py</argument>
               </arguments>
               <environmentVariables>
-                <PYTHONPATH>${project.basedir}/../ambari-common/src/main/python/jinja2:${project.basedir}/../ambari-common/src/main/python/common_functions:${project.basedir}/../ambari-common/src/test/python:${project.basedir}/../ambari-common/src/main/python:${project.basedir}/src/main/python/ambari_agent:${project.basedir}/src/main/python/resource_management:${project.basedir}/src/test/python/ambari_agent:${project.basedir}/src/test/python/resource_management:${project.basedir}/src/main/python:${project.basedir}/../ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/files:${project.basedir}/../ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/package/files:$PYTHONPATH</PYTHONPATH>
+                <PYTHONPATH>${project.basedir}/../ambari-common/src/main/python/jinja2:${project.basedir}/../ambari-common/src/main/python/ambari_commons:${project.basedir}/../ambari-common/src/test/python:${project.basedir}/../ambari-common/src/main/python:${project.basedir}/src/main/python/ambari_agent:${project.basedir}/src/main/python/resource_management:${project.basedir}/src/test/python/ambari_agent:${project.basedir}/src/test/python/resource_management:${project.basedir}/src/main/python:${project.basedir}/../ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/files:${project.basedir}/../ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/package/files:$PYTHONPATH</PYTHONPATH>
               </environmentVariables>
               <skip>${skipTests}</skip>
             </configuration>
@@ -198,10 +198,6 @@
             <scriptFile>src/main/package/rpm/preremove.sh</scriptFile>
             <fileEncoding>utf-8</fileEncoding>
           </preremoveScriptlet>
-          <posttransScriptlet>
-            <scriptFile>src/main/package/rpm/posttrans.sh</scriptFile>
-            <fileEncoding>utf-8</fileEncoding>
-          </posttransScriptlet>
 
           <needarch>x86_64</needarch>
           <autoRequires>false</autoRequires>
@@ -235,10 +231,10 @@
               </sources>
             </mapping>
             <mapping>
-              <directory>${common_functions.install.dir}</directory>
+              <directory>${ambari_commons.install.dir}</directory>
               <sources>
                 <source>
-                  <location>${project.basedir}/../ambari-common/src/main/python/common_functions</location>
+                  <location>${project.basedir}/../ambari-common/src/main/python/ambari_commons</location>
                 </source>
               </sources>
             </mapping>
@@ -528,12 +524,12 @@
             </data>
             <data>
               <src>
-                ${project.basedir}/../ambari-common/src/main/python/common_functions
+                ${project.basedir}/../ambari-common/src/main/python/ambari_commons
               </src>
               <type>directory</type>
               <mapper>
                 <type>perm</type>
-                <prefix>${common_functions.install.dir}</prefix>
+                <prefix>${ambari_commons.install.dir}</prefix>
                 <filemode>755</filemode>
                 <user>root</user>
                 <group>root</group>

+ 0 - 19
ambari-agent/src/main/package/rpm/posttrans.sh

@@ -1,19 +0,0 @@
-# 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
-
-COMMON_DIR="/usr/lib/python2.6/site-packages/common_functions"
-COMMON_DIR_SERVER="/usr/lib/ambari-server/lib/common_functions"
-
-ln -s "$COMMON_DIR_SERVER" "$COMMON_DIR"

+ 1 - 1
ambari-agent/src/main/python/ambari_agent/Facter.py

@@ -30,7 +30,7 @@ import subprocess
 
 import time
 import uuid
-from common_functions import OSCheck
+from ambari_commons import OSCheck
 
 log = logging.getLogger()
 

+ 1 - 1
ambari-agent/src/main/python/ambari_agent/HostCleanup.py

@@ -31,7 +31,7 @@ import sys
 import datetime
 import AmbariConfig
 from pwd import getpwnam
-from common_functions import OSCheck
+from ambari_commons import OSCheck
 
 logger = logging.getLogger()
 configFile = "/etc/ambari-agent/conf/ambari-agent.ini"

+ 1 - 1
ambari-agent/src/main/python/ambari_agent/HostInfo.py

@@ -31,7 +31,7 @@ import platform
 from PackagesAnalyzer import PackagesAnalyzer
 from HostCheckReportFileHandler import HostCheckReportFileHandler
 from Hardware import Hardware
-from common_functions import OSCheck, OSConst
+from ambari_commons import OSCheck, OSConst
 import socket
 
 logger = logging.getLogger()

+ 1 - 1
ambari-agent/src/main/python/resource_management/core/system.py

@@ -28,7 +28,7 @@ import platform
 from resource_management.core import shell
 from resource_management.core.exceptions import Fail
 from functools import wraps
-from common_functions import OSCheck
+from ambari_commons import OSCheck
 
 def lazy_property(undecorated):
   name = '_' + undecorated.__name__

+ 1 - 1
ambari-agent/src/main/python/resource_management/libraries/providers/repository.py

@@ -23,7 +23,7 @@ Ambari Agent
 import os
 import filecmp
 import tempfile
-from common_functions import OSCheck
+from ambari_commons import OSCheck
 from resource_management import *
 
 class RhelSuseRepositoryProvider(Provider):

+ 1 - 1
ambari-agent/src/test/python/ambari_agent/TestController.py

@@ -33,7 +33,7 @@ with patch("platform.linux_distribution", return_value = ('Suse','11','Final')):
   from ambari_agent import Controller, ActionQueue
   from ambari_agent import hostname
   from ambari_agent.Controller import AGENT_AUTO_RESTART_EXIT_CODE
-  from common_functions import OSCheck
+  from ambari_commons import OSCheck
 
 @patch.object(platform, "linux_distribution", new = ('Suse','11','Final'))
 class TestController(unittest.TestCase):

+ 1 - 1
ambari-agent/src/test/python/ambari_agent/TestHardware.py

@@ -27,7 +27,7 @@ with patch("platform.linux_distribution", return_value = ('Suse','11','Final')):
   from ambari_agent import hostname
   from ambari_agent.Hardware import Hardware
   from ambari_agent.Facter import Facter
-  from common_functions import OSCheck
+  from ambari_commons import OSCheck
 
 @patch.object(platform,"linux_distribution", new = ('Suse','11','Final'))
 class TestHardware(TestCase):

+ 1 - 1
ambari-agent/src/test/python/ambari_agent/TestHostCleanup.py

@@ -28,7 +28,7 @@ import tempfile
 import os.path
 import optparse
 import logging
-from common_functions import OSCheck
+from ambari_commons import OSCheck
 
 PACKAGE_SECTION = "packages"
 PACKAGE_KEY = "pkg_list"

+ 1 - 1
ambari-agent/src/test/python/ambari_agent/TestHostInfo.py

@@ -36,7 +36,7 @@ with patch("platform.linux_distribution", return_value = ('redhat','11','Final')
   from ambari_agent.Hardware import Hardware
   from ambari_agent.AmbariConfig import AmbariConfig
   from resource_management.core.system import System
-  from common_functions import OSCheck
+  from ambari_commons import OSCheck
 
 @patch.object(System, "os_family", new = 'redhat')
 class TestHostInfo(TestCase):

+ 1 - 1
ambari-agent/src/test/python/ambari_agent/TestRegistration.py

@@ -29,7 +29,7 @@ with patch("platform.linux_distribution", return_value = ('Suse','11','Final')):
   from ambari_agent.AmbariConfig import AmbariConfig
   from ambari_agent.HostInfo import HostInfo
   from ambari_agent.HostInfo import FirewallChecks
-  from common_functions import OSCheck
+  from ambari_commons import OSCheck
 
 class TestRegistration(TestCase):
   @patch.object(FirewallChecks, "run_os_command")

+ 1 - 1
ambari-common/src/main/python/common_functions/__init__.py → ambari-common/src/main/python/ambari_commons/__init__.py

@@ -18,7 +18,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
-from common_functions.os_check import OSCheck, OSConst
+from ambari_commons.os_check import OSCheck, OSConst
 
 __all__ = [
   'OSCheck',

+ 0 - 0
ambari-common/src/main/python/common_functions/os_check.py → ambari-common/src/main/python/ambari_commons/os_check.py


+ 1 - 1
ambari-common/src/main/unix/ambari-python-wrap

@@ -17,7 +17,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-export PYTHONPATH=/usr/lib/python2.6/site-packages/common_functions:$PYTHONPATH
+export PYTHONPATH=/usr/lib/python2.6/site-packages/ambari_commons:$PYTHONPATH
 
 # reset settings
 unset PYTHON

+ 9 - 5
ambari-server/conf/unix/install-helper.sh

@@ -13,20 +13,24 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-##################################################################
+#########################################postinstall.sh#########################
 #                      SERVER INSTALL HELPER                     #
 ##################################################################
 
-COMMON_DIR="/usr/lib/python2.6/site-packages/common_functions"
+COMMON_DIR="/usr/lib/python2.6/site-packages/ambari_commons"
+OLD_COMMON_DIR="/usr/lib/python2.6/site-packages/common_functions"
 INSTALL_HELPER_AGENT="/var/lib/ambari-agent/install-helper.sh"
-COMMON_DIR_SERVER="/usr/lib/ambari-server/lib/common_functions"
+COMMON_DIR_SERVER="/usr/lib/ambari-server/lib/ambari_commons"
 
 PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap"
 PYTHON_WRAPER_SOURCE="/var/lib/ambari-server/ambari-python-wrap"
 
 do_install(){
-  # setting common_functions shared resource
-  rm -rf "$COMMON_DIR"
+  # setting ambari_commons shared resource
+  rm -rf "$OLD_COMMON_DIR"
+  if [ ! -d "$COMMON_DIR" ]; then
+    ln -s "$COMMON_DIR_AGENT" "$COMMON_DIR"
+  fi
   # setting python-wrapper script
   if [ ! -f "$PYTHON_WRAPER_TARGET" ]; then
     ln -s "$PYTHON_WRAPER_SOURCE" "$PYTHON_WRAPER_TARGET"

+ 6 - 10
ambari-server/pom.xml

@@ -31,7 +31,7 @@
     <custom.tests>false</custom.tests>
     <hdpUrlForCentos6>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.1.1.0</hdpUrlForCentos6>
     <hdpLatestUrl>http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json</hdpLatestUrl>
-    <common_functions.install.dir>/usr/lib/ambari-server/lib/common_functions</common_functions.install.dir>
+    <ambari_commons.install.dir>/usr/lib/ambari-server/lib/ambari_commons</ambari_commons.install.dir>
     <ambari-web-dir>${basedir}/../ambari-web/public</ambari-web-dir>
   </properties>
   <build>
@@ -221,10 +221,6 @@
             <scriptFile>src/main/package/rpm/preremove.sh</scriptFile>
             <fileEncoding>utf-8</fileEncoding>
           </preremoveScriptlet>
-          <posttransScriptlet>
-            <scriptFile>src/main/package/rpm/posttrans.sh</scriptFile>
-            <fileEncoding>utf-8</fileEncoding>
-          </posttransScriptlet>
           <defaultFilemode>644</defaultFilemode>
           <defaultDirmode>755</defaultDirmode>
           <defaultUsername>root</defaultUsername>
@@ -255,11 +251,11 @@
               </sources>
             </mapping>
             <mapping>
-              <directory>${common_functions.install.dir}</directory>
+              <directory>${ambari_commons.install.dir}</directory>
               <sources>
                 <source>
                   <location>
-                    ${project.basedir}/../ambari-common/src/main/python/common_functions
+                    ${project.basedir}/../ambari-common/src/main/python/ambari_commons
                   </location>
                 </source>
               </sources>
@@ -832,12 +828,12 @@
           </data>
             <data>
               <src>
-                ${project.basedir}/../ambari-common/src/main/python/common_functions
+                ${project.basedir}/../ambari-common/src/main/python/ambari_commons
               </src>
               <type>directory</type>
               <mapper>
                 <type>perm</type>
-                <prefix>${common_functions.install.dir}</prefix>
+                <prefix>${ambari_commons.install.dir}</prefix>
                 <filemode>755</filemode>
                 <user>root</user>
                 <group>root</group>
@@ -876,7 +872,7 @@
                 <argument>${custom.tests}</argument>
               </arguments>
               <environmentVariables>
-                  <PYTHONPATH>${project.basedir}/../ambari-agent/src/main/python:${project.basedir}/../ambari-common/src/main/python/jinja2:${project.basedir}/../ambari-common/src/main/python:${project.basedir}/../ambari-common/src/main/python/common_functions:${project.basedir}/../ambari-common/src/test/python:${project.basedir}/src/main/python:${project.basedir}/src/main/python/ambari-server-state:${project.basedir}/src/test/python:$PYTHONPATH</PYTHONPATH>
+                  <PYTHONPATH>${project.basedir}/../ambari-agent/src/main/python:${project.basedir}/../ambari-common/src/main/python/jinja2:${project.basedir}/../ambari-common/src/main/python:${project.basedir}/../ambari-common/src/main/python/ambari_commons:${project.basedir}/../ambari-common/src/test/python:${project.basedir}/src/main/python:${project.basedir}/src/main/python/ambari-server-state:${project.basedir}/src/test/python:$PYTHONPATH</PYTHONPATH>
               </environmentVariables>
               <skip>${skipTests}</skip>
             </configuration>

+ 0 - 19
ambari-server/src/main/package/rpm/posttrans.sh

@@ -1,19 +0,0 @@
-# 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
-
-COMMON_DIR="/usr/lib/python2.6/site-packages/common_functions"
-COMMON_DIR_SERVER="/usr/lib/ambari-server/lib/common_functions"
-
-ln -s "$COMMON_DIR_SERVER" "$COMMON_DIR"

+ 1 - 1
ambari-server/src/main/python/ambari-server.py

@@ -41,7 +41,7 @@ import random
 import pwd
 from ambari_server.resourceFilesKeeper import ResourceFilesKeeper, KeeperException
 import json
-from common_functions import OSCheck, OSConst
+from ambari_commons import OSCheck, OSConst
 from ambari_server import utils
 
 # debug settings

+ 1 - 1
ambari-server/src/main/python/ambari_server/utils.py

@@ -20,7 +20,7 @@ limitations under the License.
 import os
 import signal
 import time
-from common_functions import OSConst
+from ambari_commons import OSConst
 
 #PostgreSQL settings
 UBUNTU_PG_HBA_ROOT = "/etc/postgresql"

+ 2 - 2
ambari-server/src/main/python/bootstrap.py

@@ -147,7 +147,7 @@ class Bootstrap(threading.Thread):
   AMBARI_REPO_FILENAME = "ambari"
   SETUP_SCRIPT_FILENAME = "setupAgent.py"
   PASSWORD_FILENAME = "host_pass"
-  COMMON_FUNCTIONS="/usr/lib/python2.6/site-packages/common_functions"
+  ambari_commons="/usr/lib/python2.6/site-packages/ambari_commons"
 
   def __init__(self, host, shared_state):
     threading.Thread.__init__(self)
@@ -250,7 +250,7 @@ class Bootstrap(threading.Thread):
 
   def copyCommonFunctions(self):
     # Copying the os check script file
-    fileToCopy = self.COMMON_FUNCTIONS
+    fileToCopy = self.ambari_commons
     target = self.getCommonFunctionsRemoteLocation()
     params = self.shared_state
     self.host_log.write("==========================\n")

+ 1 - 1
ambari-server/src/main/python/os_check_type.py

@@ -19,7 +19,7 @@ limitations under the License.
 '''
 
 import sys
-from common_functions import OSCheck
+from ambari_commons import OSCheck
 
 def main(argv=None):
   # Same logic that was in "os_type_check.sh"

+ 1 - 1
ambari-server/src/main/python/setupAgent.py

@@ -29,7 +29,7 @@ import threading
 import traceback
 import stat
 from pprint import pformat
-from common_functions import OSCheck
+from ambari_commons import OSCheck
 
 AMBARI_PASSPHRASE_VAR = "AMBARI_PASSPHRASE"
 

+ 1 - 1
ambari-server/src/main/resources/scripts/kerberos-setup.sh

@@ -264,7 +264,7 @@ distributeKeytabs () {
 ## getEnvironmentCMD () : get linux distribution type and package manager
 ########################
 getEnvironmentCMD () {
-  os=`python -c 'import sys; sys.path.append("/usr/lib/python2.6/site-packages/"); from common_functions import OSCheck; print OSCheck.get_os_family()'`
+  os=`python -c 'import sys; sys.path.append("/usr/lib/python2.6/site-packages/"); from ambari_commons import OSCheck; print OSCheck.get_os_family()'`
   case $os in
   'debian' )
     pkgmgr='apt-get'

+ 1 - 1
ambari-server/src/test/python/TestOSCheck.py

@@ -27,7 +27,7 @@ import sys
 from unittest import TestCase
 from mock.mock import patch
 
-from common_functions import OSCheck, OSConst
+from ambari_commons import OSCheck, OSConst
 import os_check_type
 
 with patch("platform.linux_distribution", return_value=('Suse', '11', 'Final')):

+ 14 - 14
ambari-server/src/test/python/TestSetupAgent.py

@@ -87,8 +87,8 @@ class TestSetupAgent(TestCase):
     execOsCommand_mock.reset_mock()
 
   @patch.object(setup_agent, 'getAvaliableAgentPackageVersions')
-  @patch('common_functions.OSCheck.is_suse_family')
-  @patch('common_functions.OSCheck.is_debian_family')
+  @patch('ambari_commons.OSCheck.is_suse_family')
+  @patch('ambari_commons.OSCheck.is_debian_family')
   @patch.object(setup_agent, 'findNearestAgentPackageVersion')
   def test_returned_optimal_version_is_initial_on_suse(self, findNearestAgentPackageVersion_method, is_debian_family_method,
                                                        is_suse_family_method, getAvaliableAgentPackageVersions_method):
@@ -103,8 +103,8 @@ class TestSetupAgent(TestCase):
     pass
 
   @patch.object(setup_agent, 'getAvaliableAgentPackageVersions')
-  @patch('common_functions.OSCheck.is_suse_family')
-  @patch('common_functions.OSCheck.is_debian_family')
+  @patch('ambari_commons.OSCheck.is_suse_family')
+  @patch('ambari_commons.OSCheck.is_debian_family')
   @patch.object(setup_agent, 'findNearestAgentPackageVersion')
   def test_returned_optimal_version_is_initial_on_debian(self, findNearestAgentPackageVersion_method, is_debian_family_method,
                                                        is_suse_family_method, getAvaliableAgentPackageVersions_method):
@@ -118,8 +118,8 @@ class TestSetupAgent(TestCase):
     self.assertTrue(result_version["exitstatus"] == 1)
     pass
 
-  @patch('common_functions.OSCheck.is_suse_family')
-  @patch('common_functions.OSCheck.is_debian_family')
+  @patch('ambari_commons.OSCheck.is_suse_family')
+  @patch('ambari_commons.OSCheck.is_debian_family')
   @patch.object(setup_agent, 'findNearestAgentPackageVersion')
   def test_returned_optimal_version_is_nearest_on_suse(self, findNearestAgentPackageVersion_method,
                                                        is_debian_family_method,
@@ -139,8 +139,8 @@ class TestSetupAgent(TestCase):
     self.assertTrue(result_version["exitstatus"] == 1)
     pass
 
-  @patch('common_functions.OSCheck.is_suse_family')
-  @patch('common_functions.OSCheck.is_debian_family')
+  @patch('ambari_commons.OSCheck.is_suse_family')
+  @patch('ambari_commons.OSCheck.is_debian_family')
   @patch.object(setup_agent, 'findNearestAgentPackageVersion')
   def test_returned_optimal_version_is_nearest_on_debian(self, findNearestAgentPackageVersion_method,
                                                        is_debian_family_method,
@@ -161,8 +161,8 @@ class TestSetupAgent(TestCase):
     pass
 
   @patch.object(setup_agent, 'getAvaliableAgentPackageVersions')
-  @patch('common_functions.OSCheck.is_suse_family')
-  @patch('common_functions.OSCheck.is_debian_family')
+  @patch('ambari_commons.OSCheck.is_suse_family')
+  @patch('ambari_commons.OSCheck.is_debian_family')
   @patch.object(setup_agent, 'findNearestAgentPackageVersion')
   def test_returned_optimal_version_is_initial(self, findNearestAgentPackageVersion_method,
                                                is_debian_family_method,
@@ -178,8 +178,8 @@ class TestSetupAgent(TestCase):
     pass
 
   @patch.object(setup_agent, 'getAvaliableAgentPackageVersions')
-  @patch('common_functions.OSCheck.is_suse_family')
-  @patch('common_functions.OSCheck.is_debian_family')
+  @patch('ambari_commons.OSCheck.is_suse_family')
+  @patch('ambari_commons.OSCheck.is_debian_family')
   @patch.object(setup_agent, 'findNearestAgentPackageVersion')
   def test_returned_optimal_version_is_default(self, findNearestAgentPackageVersion_method,
                                                is_debian_family_method,
@@ -206,8 +206,8 @@ class TestSetupAgent(TestCase):
   @patch.object(setup_agent, 'runAgent')
   @patch.object(setup_agent, 'configureAgent')
   @patch.object(setup_agent, 'installAgent')
-  @patch('common_functions.OSCheck.is_suse_family')
-  @patch('common_functions.OSCheck.is_debian_family')
+  @patch('ambari_commons.OSCheck.is_suse_family')
+  @patch('ambari_commons.OSCheck.is_debian_family')
   @patch.object(setup_agent, 'getOptimalVersion')
   @patch.object(setup_agent, 'checkServerReachability')
   @patch("sys.exit")