Repository: ambari Updated Branches: refs/heads/branch-windows-dev f96e1d0dd -> f2bed3b75
AMBARI-7957. ambari-server python-test hangs in branch-windows-dev. (Florian Barca via yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f2bed3b7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f2bed3b7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f2bed3b7 Branch: refs/heads/branch-windows-dev Commit: f2bed3b75d4d08edd3c72ecd0994c8348a530d83 Parents: f96e1d0 Author: Yusaku Sako <[email protected]> Authored: Thu Oct 30 13:20:53 2014 -0700 Committer: Yusaku Sako <[email protected]> Committed: Thu Oct 30 13:20:53 2014 -0700 ---------------------------------------------------------------------- ambari-agent/conf/windows/service_wrapper.py | 2 +- ambari-agent/pom.xml | 11 +- .../src/main/python/ambari_agent/Facter.py | 22 +- .../ambari_agent/HeartbeatStopHandler_linux.py | 3 +- .../main/python/ambari_commons/inet_utils.py | 2 +- .../src/main/python/ambari_commons/logging.py | 49 ---- .../main/python/ambari_commons/logging_utils.py | 49 ++++ .../src/main/python/ambari_commons/os_check.py | 3 +- .../src/main/python/ambari_commons/os_linux.py | 2 +- .../src/main/python/ambari_commons/os_utils.py | 2 +- .../main/python/ambari_commons/os_windows.py | 8 +- .../libraries/functions/__init__.py | 12 +- .../libraries/script/script.py | 39 +-- .../libraries/script/script.py.orig | 250 ------------------- ambari-server/pom.xml | 13 +- .../src/main/python/ambari-server-windows.py | 2 + .../python/ambari_server/dbConfiguration.py | 2 +- .../ambari_server/dbConfiguration_linux.py | 3 +- .../ambari_server/dbConfiguration_windows.py | 2 +- .../python/ambari_server/serverConfiguration.py | 2 +- .../main/python/ambari_server/serverSetup.py | 2 +- .../python/ambari_server/serverSetup_linux.py | 2 +- .../python/ambari_server/serverSetup_windows.py | 2 +- .../src/main/python/ambari_server/userInput.py | 2 +- .../src/test/python/TestAmbariServer.py | 2 + ambari-server/src/test/python/TestBootstrap.py | 1 + ambari-server/src/test/python/TestCheckHost.py | 2 + .../python/stacks/1.3.2/HDFS/test_datanode.py | 2 - .../1.3.2/hooks/before-ANY/test_before_any.py | 2 +- .../hooks/before-INSTALL/test_before_install.py | 2 +- .../hooks/before-START/test_before_start.py | 2 +- .../python/stacks/2.0.6/HDFS/test_datanode.py | 2 +- .../2.0.6/hooks/before-ANY/test_before_any.py | 2 +- .../hooks/before-INSTALL/test_before_install.py | 2 +- .../hooks/before-START/test_before_start.py | 2 +- 35 files changed, 150 insertions(+), 357 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-agent/conf/windows/service_wrapper.py ---------------------------------------------------------------------- diff --git a/ambari-agent/conf/windows/service_wrapper.py b/ambari-agent/conf/windows/service_wrapper.py index 422106d..0d2159f 100644 --- a/ambari-agent/conf/windows/service_wrapper.py +++ b/ambari-agent/conf/windows/service_wrapper.py @@ -26,7 +26,7 @@ import win32service from ambari_commons.ambari_service import AmbariService from ambari_commons.exceptions import * -from ambari_commons.logging import * +from ambari_commons.logging_utils import * from ambari_commons.os_windows import WinServiceController from ambari_agent.AmbariConfig import * from ambari_agent.HeartbeatHandlers_windows import HeartbeatStopHandler http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-agent/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml index 6429176..106efc5 100644 --- a/ambari-agent/pom.xml +++ b/ambari-agent/pom.xml @@ -103,6 +103,13 @@ </executions> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skip>${skipSurefireTests}</skip> + </configuration> + </plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2</version> @@ -687,7 +694,7 @@ <executable.shell>cmd</executable.shell> <fileextension.shell>cmd</fileextension.shell> <fileextension.dot.shell-default>.cmd</fileextension.dot.shell-default> - <path.python.1>${project.basedir}\..\ambari-common\src\main\python\ambari_jinja2:${project.basedir}\..\ambari-common\src\main\python\ambari_commons:${project.basedir}\..\ambari-common\src\main\python\resource_management:${project.basedir}\..\ambari-common\src\test\python:${project.basedir}\..\ambari-common\src\main\python:${project.basedir}\src\main\python\ambari_agent:${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</path.python.1> + <path.python.1>${project.basedir}\..\ambari-common\src\main\python;${project.basedir}\..\ambari-agent\src\main\python;${project.basedir}\..\ambari-common\src\main\python\ambari_jinja2;${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_agent;${project.basedir}\src\main\python\resource_management;${project.basedir}\src\test\python;${project.basedir}\src\test\python\ambari_agent;${project.basedir}\src\test\python\resource_management;${project.basedir}\..\ambari-server\src\test\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</path.python.1> </properties> </profile> <profile> @@ -706,7 +713,7 @@ <executable.shell>sh</executable.shell> <fileextension.shell>sh</fileextension.shell> <fileextension.dot.shell-default></fileextension.dot.shell-default> - <path.python.1>${project.basedir}/../ambari-common/src/main/python/ambari_jinja2:${project.basedir}/../ambari-common/src/main/python/ambari_commons:${project.basedir}/../ambari-common/src/main/python/resource_management:${project.basedir}/../ambari-common/src/test/python:${project.basedir}/../ambari-common/src/main/python:${project.basedir}/src/main/python/ambari_agent:${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</path.python.1> + <path.python.1>${project.basedir}/../ambari-common/src/main/python:${project.basedir}/../ambari-agent/src/main/python:${project.basedir}/../ambari-common/src/main/python/ambari_jinja2:${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_agent:${project.basedir}/src/main/python/resource_management:${project.basedir}/src/test/python:${project.basedir}/src/test/python/ambari_agent:${project.basedir}/src/test/python/resource_management:${project.basedir}/../ambari-server/src/test/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</path.python.1> </properties> </profile> <profile> http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-agent/src/main/python/ambari_agent/Facter.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/Facter.py b/ambari-agent/src/main/python/ambari_agent/Facter.py index a8d8836..8547e61 100644 --- a/ambari-agent/src/main/python/ambari_agent/Facter.py +++ b/ambari-agent/src/main/python/ambari_agent/Facter.py @@ -170,6 +170,16 @@ class FacterBase(): return facterInfo + #Convert kB to GB + @staticmethod + def convertSizeKbToGb(size): + return "%0.2f GB" % round(float(size) / (1024.0 * 1024.0), 2) + + #Convert MB to GB + @staticmethod + def convertSizeMbToGb(size): + return "%0.2f GB" % round(float(size) / (1024.0), 2) + class FacterWindows(FacterBase): GET_SYSTEM_INFO_CMD = "systeminfo" @@ -177,10 +187,6 @@ class FacterWindows(FacterBase): GET_PAGE_FILE_INFO = '$pgo=(Get-WmiObject Win32_PageFileUsage); echo "$($pgo.AllocatedBaseSize) $($pgo.AllocatedBaseSize-$pgo.CurrentUsage)"' GET_UPTIME_CMD = 'echo $([int]((get-date)-[system.management.managementdatetimeconverter]::todatetime((get-wmiobject -class win32_operatingsystem).Lastbootuptime)).TotalSeconds)' - #Convert MB to GB - def convertSizeMbToGb(self, size): - return "%0.2f GB" % round(float(size) / (1024.0), 2) - # Return first ip adress def getIpAddress(self): #TODO check if we need ipconfig @@ -269,8 +275,8 @@ class FacterWindows(FacterBase): def facterInfo(self): facterInfo = FacterBase.facterInfo(self) - facterInfo['swapsize'] = self.convertSizeMbToGb(self.getSwapSize()) - facterInfo['swapfree'] = self.convertSizeMbToGb(self.getSwapFree()) + facterInfo['swapsize'] = FacterBase.convertSizeMbToGb(self.getSwapSize()) + facterInfo['swapfree'] = FacterBase.convertSizeMbToGb(self.getSwapFree()) return facterInfo @@ -438,8 +444,8 @@ class FacterLinux(FacterBase): def facterInfo(self): facterInfo = FacterBase.facterInfo(self) facterInfo['selinux'] = self.isSeLinux() - facterInfo['swapsize'] = self.convertSizeKbToGb(self.getSwapSize()) - facterInfo['swapfree'] = self.convertSizeKbToGb(self.getSwapFree()) + facterInfo['swapsize'] = FacterBase.convertSizeKbToGb(self.getSwapSize()) + facterInfo['swapfree'] = FacterBase.convertSizeKbToGb(self.getSwapFree()) return facterInfo http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-agent/src/main/python/ambari_agent/HeartbeatStopHandler_linux.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/HeartbeatStopHandler_linux.py b/ambari-agent/src/main/python/ambari_agent/HeartbeatStopHandler_linux.py index bd1dc9a..2ef8c7f 100644 --- a/ambari-agent/src/main/python/ambari_agent/HeartbeatStopHandler_linux.py +++ b/ambari-agent/src/main/python/ambari_agent/HeartbeatStopHandler_linux.py @@ -19,12 +19,11 @@ limitations under the License. ''' import os +import logging import signal import threading import traceback -from ambari_commons import logging - logger = logging.getLogger() http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-common/src/main/python/ambari_commons/inet_utils.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/ambari_commons/inet_utils.py b/ambari-common/src/main/python/ambari_commons/inet_utils.py index 6ccb742..2a54cb6 100644 --- a/ambari-common/src/main/python/ambari_commons/inet_utils.py +++ b/ambari-common/src/main/python/ambari_commons/inet_utils.py @@ -23,7 +23,7 @@ import sys import urllib2 from exceptions import * -from logging import * +from logging_utils import * def download_file(link, destination, chunk_size=16 * 1024): print_info_msg("Downloading {0} to {1}".format(link, destination)) http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-common/src/main/python/ambari_commons/logging.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/ambari_commons/logging.py b/ambari-common/src/main/python/ambari_commons/logging.py deleted file mode 100644 index 9d45fdb..0000000 --- a/ambari-common/src/main/python/ambari_commons/logging.py +++ /dev/null @@ -1,49 +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. -''' - -VERBOSE = False -SILENT = False -DEBUG_MODE = False - -# terminal styles -BOLD_ON = '\033[1m' -BOLD_OFF = '\033[0m' - -# -# Prints an "info" messsage. -# -def print_info_msg(msg): - if VERBOSE: - print("INFO: " + msg) - -# -# Prints an "error" messsage. -# -def print_error_msg(msg): - print("ERROR: " + msg) - -# -# Prints a "warning" messsage. -# -def print_warning_msg(msg, bold=False): - if bold: - print(BOLD_ON + "WARNING: " + msg + BOLD_OFF) - else: - print("WARNING: " + msg) http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-common/src/main/python/ambari_commons/logging_utils.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/ambari_commons/logging_utils.py b/ambari-common/src/main/python/ambari_commons/logging_utils.py new file mode 100644 index 0000000..9d45fdb --- /dev/null +++ b/ambari-common/src/main/python/ambari_commons/logging_utils.py @@ -0,0 +1,49 @@ +#!/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. +''' + +VERBOSE = False +SILENT = False +DEBUG_MODE = False + +# terminal styles +BOLD_ON = '\033[1m' +BOLD_OFF = '\033[0m' + +# +# Prints an "info" messsage. +# +def print_info_msg(msg): + if VERBOSE: + print("INFO: " + msg) + +# +# Prints an "error" messsage. +# +def print_error_msg(msg): + print("ERROR: " + msg) + +# +# Prints a "warning" messsage. +# +def print_warning_msg(msg, bold=False): + if bold: + print(BOLD_ON + "WARNING: " + msg + BOLD_OFF) + else: + print("WARNING: " + msg) http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-common/src/main/python/ambari_commons/os_check.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/ambari_commons/os_check.py b/ambari-common/src/main/python/ambari_commons/os_check.py index 23ef4a9..03e94c4 100644 --- a/ambari-common/src/main/python/ambari_commons/os_check.py +++ b/ambari-common/src/main/python/ambari_commons/os_check.py @@ -38,7 +38,7 @@ def linux_distribution(): if PYTHON_VER < 26: (distname, version, id) = platform.dist() elif os.path.exists('/etc/redhat-release'): - (distname, version, id) = platform.dist() + (distname, version, id) = platform.dist() else: (distname, version, id) = platform.linux_distribution() @@ -315,6 +315,7 @@ class OSCheck: pass return False + @staticmethod def is_redhat7(): """ Return true if it is so or false if not http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-common/src/main/python/ambari_commons/os_linux.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/ambari_commons/os_linux.py b/ambari-common/src/main/python/ambari_commons/os_linux.py index 9e7c9a3..38f3fb9 100644 --- a/ambari-common/src/main/python/ambari_commons/os_linux.py +++ b/ambari-common/src/main/python/ambari_commons/os_linux.py @@ -24,7 +24,7 @@ import pwd import shlex import subprocess -from logging import * +from logging_utils import * NR_CHMOD_CMD = 'chmod {0} {1} {2}' http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-common/src/main/python/ambari_commons/os_utils.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/ambari_commons/os_utils.py b/ambari-common/src/main/python/ambari_commons/os_utils.py index df51f09..9ea423f 100644 --- a/ambari-common/src/main/python/ambari_commons/os_utils.py +++ b/ambari-common/src/main/python/ambari_commons/os_utils.py @@ -29,7 +29,7 @@ else: # MacOS not supported from os_linux import * -from logging import * +from logging_utils import * from exceptions import FatalException http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-common/src/main/python/ambari_commons/os_windows.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/ambari_commons/os_windows.py b/ambari-common/src/main/python/ambari_commons/os_windows.py index 8c59063..2fb98e4 100644 --- a/ambari-common/src/main/python/ambari_commons/os_windows.py +++ b/ambari-common/src/main/python/ambari_commons/os_windows.py @@ -41,11 +41,11 @@ from win32process import GetExitCodeProcess, STARTF_USESTDHANDLES, STARTUPINFO, from win32event import WaitForSingleObject, INFINITE import msvcrt import tempfile -import logging from win32event import * from win32api import CloseHandle from ambari_commons.exceptions import * +from logging_utils import * from win32security import LsaOpenPolicy, POLICY_CREATE_ACCOUNT, POLICY_LOOKUP_NAMES, LookupAccountName, \ LsaAddAccountRights, LsaRemoveAccountRights, SE_SERVICE_LOGON_NAME @@ -203,7 +203,7 @@ def os_is_root(): retcode, out, err = run_os_command(WHOAMI_GROUPS) if retcode != 0: err_msg = "Unable to check the current user's group memberships. Command {0} returned exit code {1} with message: {2}".format(WHOAMI_GROUPS, retcode, err) - logging.print_warning_msg(err_msg) + print_warning_msg(err_msg) raise FatalException(retcode, err_msg) #Check for Administrators group membership @@ -427,7 +427,7 @@ class WinService(win32serviceutil.ServiceFramework): pass def DefCtrlCHandler(self): - logging.print_info_msg("Ctrl+C handler invoked. Stopping.") + print_info_msg("Ctrl+C handler invoked. Stopping.") win32event.SetEvent(self._heventSvcStop) pass @@ -495,7 +495,7 @@ class WinService(win32serviceutil.ServiceFramework): # Must brutally terminate the child process. Sorry Java. childProcess.terminate() except OSError, e: - logging.print_info_msg("Unable to stop Ambari Server - " + str(e)) + print_info_msg("Unable to stop Ambari Server - " + str(e)) return False return True http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py index 6d3910f..a113fe4 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py @@ -20,6 +20,8 @@ Ambari Agent """ +import platform + from resource_management.libraries.functions.default import * from resource_management.libraries.functions.format import * from resource_management.libraries.functions.get_kinit_path import * @@ -29,6 +31,10 @@ from resource_management.libraries.functions.is_empty import * from resource_management.libraries.functions.substitute_vars import * from resource_management.libraries.functions.get_port_from_url import * from resource_management.libraries.functions.hive_check import * -from resource_management.libraries.functions.windows_service_utils import * -from resource_management.libraries.functions.install_hdp_msi import * -from resource_management.libraries.functions.reload_windows_env import * + +IS_WINDOWS = platform.system() == "Windows" + +if IS_WINDOWS: + from resource_management.libraries.functions.windows_service_utils import * + from resource_management.libraries.functions.install_hdp_msi import * + from resource_management.libraries.functions.reload_windows_env import * http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-common/src/main/python/resource_management/libraries/script/script.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py index c7e6121..059dd57 100644 --- a/ambari-common/src/main/python/resource_management/libraries/script/script.py +++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py @@ -36,8 +36,11 @@ from resource_management.core.environment import Environment from resource_management.core.exceptions import Fail, ClientComponentHasNoStatus, ComponentIsNotRunning from resource_management.core.resources.packaging import Package from resource_management.libraries.script.config_dictionary import ConfigDictionary, UnknownConfiguration -from resource_management.libraries.functions.install_hdp_msi import install_windows_msi -from resource_management.libraries.functions.reload_windows_env import reload_windows_env + +IS_WINDOWS = platform.system() == "Windows" +if IS_WINDOWS: + from resource_management.libraries.functions.install_hdp_msi import install_windows_msi + from resource_management.libraries.functions.reload_windows_env import reload_windows_env USAGE = """Usage: {0} <COMMAND> <JSON_CONFIG> <BASEDIR> <STROUTPUT> <LOGGING_LEVEL> <TMP_DIR> @@ -197,17 +200,14 @@ class Script(object): self.install_packages(env) - def install_packages(self, env, exclude_packages=[]): - """ - List of packages that are required< by service is received from the server - as a command parameter. The method installs all packages - from this list - """ - config = self.get_config() - if platform.system() == "Windows": - install_windows_msi(os.path.join(config['hostLevelParams']['jdk_location'], "hdp.msi"), - config["hostLevelParams"]["agentCacheDir"], "hdp.msi", self.get_password("hadoop")) - else: + if not IS_WINDOWS: + def install_packages(self, env, exclude_packages=[]): + """ + List of packages that are required< by service is received from the server + as a command parameter. The method installs all packages + from this list + """ + config = self.get_config() try: package_list_str = config['hostLevelParams']['package_list'] if isinstance(package_list_str, basestring) and len(package_list_str) > 0: @@ -220,8 +220,19 @@ class Script(object): pass # No reason to worry # RepoInstaller.remove_repos(config) + pass + else: + def install_packages(self, env, exclude_packages=[]): + """ + List of packages that are required< by service is received from the server + as a command parameter. The method installs all packages + from this list + """ + config = self.get_config() - + install_windows_msi(os.path.join(config['hostLevelParams']['jdk_location'], "hdp.msi"), + config["hostLevelParams"]["agentCacheDir"], "hdp.msi", self.get_password("hadoop")) + pass def fail_with_error(self, message): """ http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-common/src/main/python/resource_management/libraries/script/script.py.orig ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py.orig b/ambari-common/src/main/python/resource_management/libraries/script/script.py.orig deleted file mode 100644 index 82860c5..0000000 --- a/ambari-common/src/main/python/resource_management/libraries/script/script.py.orig +++ /dev/null @@ -1,250 +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. -''' - -__all__ = ["Script"] - -import os -import sys -import json -import logging -import platform - -from resource_management.core.environment import Environment -from resource_management.core.exceptions import Fail, ClientComponentHasNoStatus, ComponentIsNotRunning -from resource_management.core.resources.packaging import Package -from resource_management.libraries.script.config_dictionary import ConfigDictionary, UnknownConfiguration -from resource_management.libraries.functions.install_hdp_msi import install_windows_msi - - -USAGE = """Usage: {0} <COMMAND> <JSON_CONFIG> <BASEDIR> <STROUTPUT> <LOGGING_LEVEL> - -<COMMAND> command type (INSTALL/CONFIGURE/START/STOP/SERVICE_CHECK...) -<JSON_CONFIG> path to command json file. Ex: /var/lib/ambari-agent/data/command-2.json -<BASEDIR> path to service metadata dir. Ex: /var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/HDFS -<STROUTPUT> path to file with structured command output (file will be created). Ex:/tmp/my.txt -<LOGGING_LEVEL> log level for stdout. Ex:DEBUG,INFO -""" - -_PASSWORD_MAP = {"/configurations/cluster-env/hadoop.user.name":"/configurations/cluster-env/hadoop.user.password"} - -def get_path_form_configuration(name, configuration): - subdicts = filter(None, name.split('/')) - - for x in subdicts: - if x in configuration: - configuration = configuration[x] - else: - return None - - return configuration - -class Script(object): - """ - Executes a command for custom service. stdout and stderr are written to - tmpoutfile and to tmperrfile respectively. - Script instances share configuration as a class parameter and therefore - different Script instances can not be used from different threads at - the same time within a single python process - - Accepted command line arguments mapping: - 1 command type (START/STOP/...) - 2 path to command json file - 3 path to service metadata dir (Directory "package" inside service directory) - 4 path to file with structured command output (file will be created) - """ - structuredOut = {} - - def put_structured_out(self, sout): - Script.structuredOut.update(sout) - try: - with open(self.stroutfile, 'w') as fp: - json.dump(Script.structuredOut, fp) - except IOError: - Script.structuredOut.update({"errMsg" : "Unable to write to " + self.stroutfile}) - - def execute(self): - """ - Sets up logging; - Parses command parameters and executes method relevant to command type - """ - # set up logging (two separate loggers for stderr and stdout with different loglevels) - logger = logging.getLogger('resource_management') - logger.setLevel(logging.DEBUG) - formatter = logging.Formatter('%(asctime)s - %(message)s') - chout = logging.StreamHandler(sys.stdout) - chout.setLevel(logging.INFO) - chout.setFormatter(formatter) - cherr = logging.StreamHandler(sys.stderr) - cherr.setLevel(logging.ERROR) - cherr.setFormatter(formatter) - logger.addHandler(cherr) - logger.addHandler(chout) - - # parse arguments - if len(sys.argv) < 6: - logger.error("Script expects at least 5 arguments") - print USAGE.format(os.path.basename(sys.argv[0])) # print to stdout - sys.exit(1) - - command_name = str.lower(sys.argv[1]) - command_data_file = sys.argv[2] - basedir = sys.argv[3] - self.stroutfile = sys.argv[4] - logging_level = sys.argv[5] - - logging_level_str = logging._levelNames[logging_level] - chout.setLevel(logging_level_str) - logger.setLevel(logging_level_str) - - try: - with open(command_data_file, "r") as f: - pass - Script.config = ConfigDictionary(json.load(f)) - #load passwords here(used on windows to impersonate different users) - Script.passwords = {} - for k, v in _PASSWORD_MAP.iteritems(): - if get_path_form_configuration(k,Script.config) and get_path_form_configuration(v,Script.config ): - Script.passwords[get_path_form_configuration(k,Script.config)] = get_path_form_configuration(v,Script.config) - - except IOError: - logger.exception("Can not read json file with command parameters: ") - sys.exit(1) - # Run class method depending on a command type - try: - method = self.choose_method_to_execute(command_name) - with Environment(basedir) as env: - method(env) - except ClientComponentHasNoStatus or ComponentIsNotRunning: - # Support of component status checks. - # Non-zero exit code is interpreted as an INSTALLED status of a component - sys.exit(1) - except Fail: - logger.exception("Error while executing command '{0}':".format(command_name)) - sys.exit(1) - - - def choose_method_to_execute(self, command_name): - """ - Returns a callable object that should be executed for a given command. - """ - self_methods = dir(self) - if not command_name in self_methods: - raise Fail("Script '{0}' has no method '{1}'".format(sys.argv[0], command_name)) - method = getattr(self, command_name) - return method - - - @staticmethod - def get_config(): - """ - HACK. Uses static field to store configuration. This is a workaround for - "circular dependency" issue when importing params.py file and passing to - it a configuration instance. - """ - return Script.config - - @staticmethod - def get_password(user): - return Script.passwords[user] - - def install(self, env): - """ - Default implementation of install command is to install all packages - from a list, received from the server. - Feel free to override install() method with your implementation. It - usually makes sense to call install_packages() manually in this case - """ - self.install_packages(env) - - - def install_packages(self, env, exclude_packages=[]): - """ - List of packages that are required< by service is received from the server - as a command parameter. The method installs all packages - from this list - """ - config = self.get_config() - if platform.system() == "Windows": - install_windows_msi(os.path.join(config['hostLevelParams']['jdk_location'], "hdp.msi"), -<<<<<<< HEAD - config["hostLevelParams"]["agentCacheDir"], "hdp.msi") -======= - config["hostLevelParams"]["agentCacheDir"], "hdp.msi", self.get_password("hadoop")) ->>>>>>> da12124c4425f3f87e15c06795c51cbde97beacb - else: - try: - package_list_str = config['hostLevelParams']['package_list'] - if isinstance(package_list_str, basestring) and len(package_list_str) > 0: - package_list = json.loads(package_list_str) - for package in package_list: - if not package['name'] in exclude_packages: - name = package['name'] - Package(name) - except KeyError: - pass # No reason to worry - - # RepoInstaller.remove_repos(config) - - - - def fail_with_error(self, message): - """ - Prints error message and exits with non-zero exit code - """ - print("Error: " + message) - sys.stderr.write("Error: " + message) - sys.exit(1) - - def start(self, env): - """ - To be overridden by subclasses - """ - self.fail_with_error('start method isn\'t implemented') - - def stop(self, env): - """ - To be overridden by subclasses - """ - self.fail_with_error('stop method isn\'t implemented') - - def restart(self, env): - """ - Default implementation of restart command is to call stop and start methods - Feel free to override restart() method with your implementation. - For client components we call install - """ - config = self.get_config() - componentCategory = None - try : - componentCategory = config['roleParams']['component_category'] - except KeyError: - pass - - if componentCategory and componentCategory.strip().lower() == 'CLIENT'.lower(): - self.install(env) - else: - self.stop(env) - self.start(env) - - def configure(self, env): - """ - To be overridden by subclasses - """ - self.fail_with_error('configure method isn\'t implemented') http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml index 7397fc3..955dd88 100644 --- a/ambari-server/pom.xml +++ b/ambari-server/pom.xml @@ -1036,6 +1036,13 @@ </executions> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skip>${skipSurefireTests}</skip> + </configuration> + </plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2</version> @@ -1049,7 +1056,7 @@ <argument>${custom.tests}</argument> </arguments> <environmentVariables> - <PYTHONPATH>${project.basedir}/../ambari-common/src/main/python:${project.basedir}/../ambari-agent/src/main/python:${project.basedir}/../ambari-common/src/main/python/ambari_jinja2:${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> + <PYTHONPATH>${path.python.1}${pathsep}$PYTHONPATH</PYTHONPATH> </environmentVariables> <skip>${skipTests}</skip> </configuration> @@ -1210,7 +1217,7 @@ <executable.shell>cmd</executable.shell> <fileextension.shell>cmd</fileextension.shell> <fileextension.dot.shell-default>.cmd</fileextension.dot.shell-default> - <path.python.1>${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</path.python.1> + <path.python.1>${project.basedir}\..\ambari-common\src\main\python;${project.basedir}\..\ambari-agent\src\main\python;${project.basedir}\..\ambari-common\src\main\python\ambari_jinja2;${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\main\resources\custom_actions;${project.basedir}\src\main\resources\scripts;${project.basedir}\src\test\python</path.python.1> <assemblydescriptor>src/main/assemblies/server-windows.xml</assemblydescriptor> <packagingFormat>jar</packagingFormat> </properties> @@ -1323,7 +1330,7 @@ <executable.shell>sh</executable.shell> <fileextension.shell>sh</fileextension.shell> <fileextension.dot.shell-default></fileextension.dot.shell-default> - <path.python.1>${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</path.python.1> + <path.python.1>${project.basedir}/../ambari-common/src/main/python:${project.basedir}/../ambari-agent/src/main/python:${project.basedir}/../ambari-common/src/main/python/ambari_jinja2:${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/main/resources/custom_actions:${project.basedir}/src/main/resources/scripts:${project.basedir}/src/test/python</path.python.1> <assemblydescriptor>src/main/assemblies/server.xml</assemblydescriptor> <packagingFormat>jar</packagingFormat> </properties> http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/main/python/ambari-server-windows.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari-server-windows.py b/ambari-server/src/main/python/ambari-server-windows.py index 5f05fdd..039069c 100644 --- a/ambari-server/src/main/python/ambari-server-windows.py +++ b/ambari-server/src/main/python/ambari-server-windows.py @@ -21,6 +21,7 @@ limitations under the License. import optparse from ambari_commons.ambari_service import AmbariService +from ambari_commons.logging_utils import * from ambari_commons.os_utils import remove_file from ambari_commons.os_windows import SvcStatusCallback @@ -32,6 +33,7 @@ from ambari_server.serverSetup import setup, reset, is_server_running, upgrade from ambari_server.setupActions import * from ambari_server.setupSecurity import * from ambari_server.serverSetup_windows import SERVICE_PASSWORD_KEY, SERVICE_USERNAME_KEY + # debug settings SERVER_START_DEBUG = False SUSPEND_START_MODE = False http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/main/python/ambari_server/dbConfiguration.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration.py b/ambari-server/src/main/python/ambari_server/dbConfiguration.py index 0aef8c0..b9d4e4e 100644 --- a/ambari-server/src/main/python/ambari_server/dbConfiguration.py +++ b/ambari-server/src/main/python/ambari_server/dbConfiguration.py @@ -20,7 +20,7 @@ limitations under the License. from ambari_commons import OSCheck from ambari_commons.exceptions import FatalException -from ambari_commons.logging import print_error_msg +from ambari_commons.logging_utils import print_error_msg from ambari_server.setupSecurity import SECURITY_IS_ENCRYPTION_ENABLED from serverConfiguration import get_ambari_properties http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py index 9796872..ce47fae 100644 --- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py +++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py @@ -20,7 +20,8 @@ limitations under the License. import shutil -from common_functions import OSConst +from ambari_commons import OSConst +from ambari_commons.logging_utils import * from exceptions import * from dbConfiguration import * from utils import * http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py b/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py index fdc2f38..647a940 100644 --- a/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py +++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py @@ -23,7 +23,7 @@ import string import win32api from ambari_commons.exceptions import * -from ambari_commons.logging import print_warning_msg +from ambari_commons.logging_utils import print_warning_msg from ambari_commons.os_utils import search_file from ambari_commons.os_windows import * from ambari_commons.str_utils import compress_backslashes, ensure_double_backslashes http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/main/python/ambari_server/serverConfiguration.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py b/ambari-server/src/main/python/ambari_server/serverConfiguration.py index 90dd5db..e189e91 100644 --- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py +++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py @@ -23,7 +23,7 @@ import glob import re from ambari_commons.os_utils import * -from ambari_commons.logging import print_warning_msg, print_info_msg, print_error_msg +from ambari_commons.logging_utils import print_warning_msg, print_info_msg, print_error_msg from properties import Properties if OSCheck.is_windows_os(): http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/main/python/ambari_server/serverSetup.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/serverSetup.py b/ambari-server/src/main/python/ambari_server/serverSetup.py index d6a00bd..059400e 100644 --- a/ambari-server/src/main/python/ambari_server/serverSetup.py +++ b/ambari-server/src/main/python/ambari_server/serverSetup.py @@ -22,7 +22,7 @@ import socket import sys import urllib2 from ambari_commons.inet_utils import force_download_file -from ambari_commons.logging import print_warning_msg, print_error_msg +from ambari_commons.logging_utils import print_warning_msg, print_error_msg from serverConfiguration import * from setupSecurity import adjust_directory_permissions, get_is_secure, store_password_file, encrypt_password, \ http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/main/python/ambari_server/serverSetup_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/serverSetup_linux.py b/ambari-server/src/main/python/ambari_server/serverSetup_linux.py index 679bfdc..b5436e0 100644 --- a/ambari-server/src/main/python/ambari_server/serverSetup_linux.py +++ b/ambari-server/src/main/python/ambari_server/serverSetup_linux.py @@ -25,7 +25,7 @@ import re import socket from ambari_commons.exceptions import * -from ambari_commons.logging import * +from ambari_commons.logging_utils import * from ambari_commons.os_linux import run_os_command from ambari_server.dbConfiguration_linux import SERVICE_CMD, PG_HBA_CONF_FILE_BACKUP from ambari_server.serverConfiguration import * http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/main/python/ambari_server/serverSetup_windows.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/serverSetup_windows.py b/ambari-server/src/main/python/ambari_server/serverSetup_windows.py index 85a6a0f..a906ef5 100644 --- a/ambari-server/src/main/python/ambari_server/serverSetup_windows.py +++ b/ambari-server/src/main/python/ambari_server/serverSetup_windows.py @@ -29,7 +29,7 @@ from _winreg import (OpenKey, EnumValue, HKEY_LOCAL_MACHINE, KEY_READ, CloseKey, from ambari_commons import os_utils from ambari_commons.exceptions import * -from ambari_commons.logging import * +from ambari_commons.logging_utils import * from ambari_commons.os_windows import run_os_command, UserHelper from ambari_server.dbConfiguration import DBMSConfig from ambari_server.serverConfiguration import * http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/main/python/ambari_server/userInput.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/userInput.py b/ambari-server/src/main/python/ambari_server/userInput.py index a5618a1..7a35831 100644 --- a/ambari-server/src/main/python/ambari_server/userInput.py +++ b/ambari-server/src/main/python/ambari_server/userInput.py @@ -22,7 +22,7 @@ import os import getpass import re -from ambari_commons.logging import * +from ambari_commons.logging_utils import * # http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/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 45a9fc1..5b10790 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -16,6 +16,8 @@ See the License for the specific language governing permissions and limitations under the License. ''' +from stacks.utils.RMFTestCase import * + import StringIO import re from unittest import TestCase http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/test/python/TestBootstrap.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/TestBootstrap.py b/ambari-server/src/test/python/TestBootstrap.py index 6bcc94f..d0295a2 100644 --- a/ambari-server/src/test/python/TestBootstrap.py +++ b/ambari-server/src/test/python/TestBootstrap.py @@ -16,6 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. ''' +from stacks.utils.RMFTestCase import * import bootstrap import time import subprocess http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/test/python/TestCheckHost.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/TestCheckHost.py b/ambari-server/src/test/python/TestCheckHost.py index 6a471ec..d4fbeb1 100644 --- a/ambari-server/src/test/python/TestCheckHost.py +++ b/ambari-server/src/test/python/TestCheckHost.py @@ -17,6 +17,8 @@ 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. ''' + +from stacks.utils.RMFTestCase import * import json import os import socket http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/test/python/stacks/1.3.2/HDFS/test_datanode.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/1.3.2/HDFS/test_datanode.py b/ambari-server/src/test/python/stacks/1.3.2/HDFS/test_datanode.py index 845476f..b2cc0cd 100644 --- a/ambari-server/src/test/python/stacks/1.3.2/HDFS/test_datanode.py +++ b/ambari-server/src/test/python/stacks/1.3.2/HDFS/test_datanode.py @@ -17,8 +17,6 @@ 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. ''' -from ambari_commons import OSCheck -from mock.mock import MagicMock, patch from stacks.utils.RMFTestCase import * class TestDatanode(RMFTestCase): http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py index 836274a..2d4735a 100644 --- a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py +++ b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py @@ -18,9 +18,9 @@ See the License for the specific language governing permissions and limitations under the License. ''' +from stacks.utils.RMFTestCase import * from mock.mock import MagicMock, call, patch from resource_management import * -from stacks.utils.RMFTestCase import * @patch.object(Hook, "run_custom_hook", new = MagicMock()) class TestHookBeforeInstall(RMFTestCase): http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py index 1f508c7..904c469 100644 --- a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py +++ b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py @@ -18,9 +18,9 @@ See the License for the specific language governing permissions and limitations under the License. ''' +from stacks.utils.RMFTestCase import * from mock.mock import MagicMock, call, patch from resource_management import * -from stacks.utils.RMFTestCase import * @patch.object(Hook, "run_custom_hook", new = MagicMock()) class TestHookBeforeInstall(RMFTestCase): http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/test/python/stacks/1.3.2/hooks/before-START/test_before_start.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-START/test_before_start.py b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-START/test_before_start.py index d569a95..92227c7 100644 --- a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-START/test_before_start.py +++ b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-START/test_before_start.py @@ -18,9 +18,9 @@ See the License for the specific language governing permissions and limitations under the License. ''' +from stacks.utils.RMFTestCase import * from mock.mock import MagicMock, call, patch from resource_management import * -from stacks.utils.RMFTestCase import * @patch("os.path.exists", new = MagicMock(return_value=True)) @patch.object(Hook, "run_custom_hook") http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py index 3ee7c98..689a0f4 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py @@ -17,10 +17,10 @@ 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. ''' +from stacks.utils.RMFTestCase import * from ambari_commons import OSCheck import json from mock.mock import MagicMock, patch -from stacks.utils.RMFTestCase import * class TestDatanode(RMFTestCase): http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py index 6ca1377..5d4d3f5 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py +++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py @@ -18,9 +18,9 @@ See the License for the specific language governing permissions and limitations under the License. ''' +from stacks.utils.RMFTestCase import * from mock.mock import MagicMock, call, patch from resource_management import * -from stacks.utils.RMFTestCase import * @patch.object(Hook, "run_custom_hook", new = MagicMock()) class TestHookBeforeInstall(RMFTestCase): http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py index 1ae0e60..cec41b7 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py +++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py @@ -18,9 +18,9 @@ See the License for the specific language governing permissions and limitations under the License. ''' +from stacks.utils.RMFTestCase import * from mock.mock import MagicMock, call, patch from resource_management import * -from stacks.utils.RMFTestCase import * @patch.object(Hook, "run_custom_hook", new = MagicMock()) class TestHookBeforeInstall(RMFTestCase): http://git-wip-us.apache.org/repos/asf/ambari/blob/f2bed3b7/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py index 54b956e..4cf314f 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py +++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py @@ -18,9 +18,9 @@ See the License for the specific language governing permissions and limitations under the License. ''' +from stacks.utils.RMFTestCase import * from mock.mock import MagicMock, call, patch from resource_management import * -from stacks.utils.RMFTestCase import * @patch("os.path.exists", new = MagicMock(return_value=True)) @patch.object(Hook, "run_custom_hook", new = MagicMock())
