Repository: ambari Updated Branches: refs/heads/branch-2.2 ec788ece6 -> 3e04c3943
Revert "AMBARI-16154. RU/EU fails due to changes in script.py arguments (aonishuk)" This reverts commit ec788ece66354540122e8772598e861c7c9cb98f. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3e04c394 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3e04c394 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3e04c394 Branch: refs/heads/branch-2.2 Commit: 3e04c3943bdb446611e4d85d3b4a7bfdeff3f938 Parents: ec788ec Author: Matt <[email protected]> Authored: Thu Apr 28 15:10:20 2016 -0700 Committer: Matt <[email protected]> Committed: Thu Apr 28 15:10:20 2016 -0700 ---------------------------------------------------------------------- .../ambari_agent/CustomServiceOrchestrator.py | 6 +----- .../resource_management/libraries/script/script.py | 16 +++++----------- 2 files changed, 6 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/3e04c394/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py index c77e094..fb5f78e 100644 --- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py +++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py @@ -189,11 +189,7 @@ class CustomServiceOrchestrator(): python_executor = self.get_py_executor(forced_command_name) for py_file, current_base_dir in filtered_py_file_list: log_info_on_failure = not command_name in self.DONT_DEBUG_FAILURES_FOR_COMMANDS - script_params = [command_name, json_path, current_base_dir, tmpstrucoutfile, logger_level, self.exec_tmp_dir] - - if log_out_files: - script_params.append("-o") - + script_params = [command_name, json_path, current_base_dir, tmpstrucoutfile, logger_level, self.exec_tmp_dir, str(log_out_files)] ret = python_executor.run_file(py_file, script_params, tmpoutfile, tmperrfile, timeout, tmpstrucoutfile, self.map_task_to_process, http://git-wip-us.apache.org/repos/asf/ambari/blob/3e04c394/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 9c95d40..5c06d5e 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 @@ -28,7 +28,6 @@ import logging import platform import inspect import tarfile -from optparse import OptionParse from ambari_commons import OSCheck, OSConst from ambari_commons.constants import UPGRADE_TYPE_NON_ROLLING, UPGRADE_TYPE_ROLLING from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl @@ -59,7 +58,7 @@ if OSCheck.is_windows_family(): else: from resource_management.libraries.functions.tar_archive import archive_dir -USAGE = """Usage: {0} <COMMAND> <JSON_CONFIG> <BASEDIR> <STROUTPUT> <LOGGING_LEVEL> <TMP_DIR> +USAGE = """Usage: {0} <COMMAND> <JSON_CONFIG> <BASEDIR> <STROUTPUT> <LOGGING_LEVEL> <TMP_DIR> <LOG_OUT_FILES> <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 @@ -67,6 +66,7 @@ USAGE = """Usage: {0} <COMMAND> <JSON_CONFIG> <BASEDIR> <STROUTPUT> <LOGGING_LEV <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 <TMP_DIR> temporary directory for executable scripts. Ex: /var/lib/ambari-agent/tmp +<LOG_OUT_FILES> before start is done, should the service *.out files content be logged. Ex: false """ _PASSWORD_MAP = {"/configurations/cluster-env/hadoop.user.name":"/configurations/cluster-env/hadoop.user.password"} @@ -179,16 +179,9 @@ class Script(object): Sets up logging; Parses command parameters and executes method relevant to command type """ - parser = OptionParser() - parser.add_option("-o", "--out-files-logging", dest="log_out_files", action="store_true", - help="use this option to enable outputting *.out files of the service pre-start") - (self.options, args) = parser.parse_args() - - self.log_out_files = self.options.log_out_files - # parse arguments - if len(args) < 6: - print "Script expects at least 6 arguments" + if len(sys.argv) < 8: + print "Script expects at least 7 arguments" print USAGE.format(os.path.basename(sys.argv[0])) # print to stdout sys.exit(1) @@ -199,6 +192,7 @@ class Script(object): self.load_structured_out() self.logging_level = sys.argv[5] Script.tmp_dir = sys.argv[6] + self.log_out_files = sys.argv[7].lower() == "true" logging_level_str = logging._levelNames[self.logging_level] Logger.initialize_logger(__name__, logging_level=logging_level_str)
