Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 04CA01764B for ; Tue, 7 Oct 2014 22:52:31 +0000 (UTC) Received: (qmail 63013 invoked by uid 500); 7 Oct 2014 22:52:30 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 62924 invoked by uid 500); 7 Oct 2014 22:52:30 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 62095 invoked by uid 99); 7 Oct 2014 22:52:30 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Oct 2014 22:52:30 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 2B13F905CB5; Tue, 7 Oct 2014 22:52:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yusaku@apache.org To: commits@ambari.apache.org Date: Tue, 07 Oct 2014 22:52:43 -0000 Message-Id: In-Reply-To: <478d9103dc2f4d60aae0f04f68dae6a1@git.apache.org> References: <478d9103dc2f4d60aae0f04f68dae6a1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [15/51] [partial] AMBARI-7621. Import initial contribution for Ambari support on Windows to branch-windows-dev. (Jayush Luniya and Florian Barca via yusaku) http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/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 deleted file mode 100644 index 4caaa78..0000000 --- a/ambari-common/src/main/python/resource_management/libraries/script/script.py +++ /dev/null @@ -1,280 +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. -''' -import tarfile -import tempfile - -__all__ = ["Script"] - -import os -import sys -import json -import logging -from contextlib import closing - - -from resource_management.libraries.resources import XmlConfig -from resource_management.core.resources import File, Directory -from resource_management.core.source import InlineTemplate - -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 - - -USAGE = """Usage: {0} - - command type (INSTALL/CONFIGURE/START/STOP/SERVICE_CHECK...) - path to command json file. Ex: /var/lib/ambari-agent/data/command-2.json - path to service metadata dir. Ex: /var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/HDFS - path to file with structured command output (file will be created). Ex:/tmp/my.txt - log level for stdout. Ex:DEBUG,INFO - temporary directory for executable scripts. Ex: /var/lib/ambari-agent/data/tmp -""" - -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) < 7: - logger.error("Script expects at least 6 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] - Script.tmp_dir = sys.argv[6] - - 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)) - 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_tmp_dir(): - """ - HACK. Uses static field to avoid "circular dependency" issue when - importing params.py. - """ - return Script.tmp_dir - - - 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() - - 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') - - def generate_configs_get_template_file_content(self, filename, dicts): - import params - content = '' - for dict in dicts.split(','): - if dict.strip() in params.config['configurations']: - content += params.config['configurations'][dict.strip()]['content'] - - return content - - def generate_configs_get_xml_file_content(self, filename, dict): - import params - return {'configurations':params.config['configurations'][dict], - 'configuration_attributes':params.config['configuration_attributes'][dict]} - - def generate_configs(self, env): - """ - Generates config files and stores them as an archive in tmp_dir - based on xml_configs_list and env_configs_list from commandParams - """ - import params - env.set_params(params) - xml_configs_list = params.config['commandParams']['xml_configs_list'] - env_configs_list = params.config['commandParams']['env_configs_list'] - conf_tmp_dir = tempfile.mkdtemp() - output_filename = os.path.join(self.get_tmp_dir(),params.config['commandParams']['output_file']) - - Directory(self.get_tmp_dir(), recursive=True) - for file_dict in xml_configs_list: - for filename, dict in file_dict.iteritems(): - XmlConfig(filename, - conf_dir=conf_tmp_dir, - **self.generate_configs_get_xml_file_content(filename, dict) - ) - for file_dict in env_configs_list: - for filename,dicts in file_dict.iteritems(): - File(os.path.join(conf_tmp_dir, filename), - content=InlineTemplate(self.generate_configs_get_template_file_content(filename, dicts))) - with closing(tarfile.open(output_filename, "w:gz")) as tar: - tar.add(conf_tmp_dir, arcname=os.path.basename(".")) - tar.close() - Directory(conf_tmp_dir, action="delete") http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-project/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-project/pom.xml b/ambari-project/pom.xml index 58e2e8f..e3502ae 100644 --- a/ambari-project/pom.xml +++ b/ambari-project/pom.xml @@ -25,17 +25,6 @@ 1.3.0-SNAPSHOT Apache Ambari Project POM Apache Ambari Project POM - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - jira - https://issues.apache.org/jira/browse/AMBARI - pom UTF-8 http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/conf/unix/ambari.properties ---------------------------------------------------------------------- diff --git a/ambari-server/conf/unix/ambari.properties b/ambari-server/conf/unix/ambari.properties index d37174f..b5816af 100644 --- a/ambari-server/conf/unix/ambari.properties +++ b/ambari-server/conf/unix/ambari.properties @@ -21,7 +21,7 @@ resources.dir = /var/lib/ambari-server/resources custom.action.definitions = /var/lib/ambari-server/resources/custom_action_definitions jdk1.6.url=http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-6u31-linux-x64.bin jce_policy1.6.url=http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-6.zip -jdk1.7.url=http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-7u67-linux-x64.tar.gz +jdk1.7.url=http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-7u45-linux-x64.tar.gz jce_policy1.7.url=http://public-repo-1.hortonworks.com/ARTIFACTS/UnlimitedJCEPolicyJDK7.zip metadata.path=/var/lib/ambari-server/resources/stacks server.version.file=/var/lib/ambari-server/resources/version @@ -29,10 +29,6 @@ webapp.dir=/usr/lib/ambari-server/web bootstrap.dir=/var/run/ambari-server/bootstrap bootstrap.script=/usr/lib/python2.6/site-packages/ambari_server/bootstrap.py bootstrap.setup_agent.script=/usr/lib/python2.6/site-packages/ambari_server/setupAgent.py -recommendations.dir=/var/run/ambari-server/stack-recommendations -stackadvisor.script=/var/lib/ambari-server/resources/scripts/stack_advisor.py -server.tmp.dir=/var/lib/ambari-server/tmp - api.authenticate=true server.connection.max.idle.millis=900000 server.fqdn.service.url=http://169.254.169.254/latest/meta-data/public-hostname @@ -53,6 +49,3 @@ agent.threadpool.size.max=25 # linux open-file limit ulimit.open.files=10000 - -# Server HTTP settings -server.http.session.inactive_timeout=1800 http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/conf/unix/install-helper.sh ---------------------------------------------------------------------- diff --git a/ambari-server/conf/unix/install-helper.sh b/ambari-server/conf/unix/install-helper.sh index 108f4c2..740c2cc 100644 --- a/ambari-server/conf/unix/install-helper.sh +++ b/ambari-server/conf/unix/install-helper.sh @@ -18,13 +18,9 @@ ################################################################## COMMON_DIR="/usr/lib/python2.6/site-packages/ambari_commons" -RESOURCE_MANAGEMENT_DIR="/usr/lib/python2.6/site-packages/resource_management" -JINJA_DIR="/usr/lib/python2.6/site-packages/ambari_jinja2" 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/ambari_commons" -RESOURCE_MANAGEMENT_DIR_SERVER="/usr/lib/ambari-server/lib/resource_management" -JINJA_SERVER_DIR="/usr/lib/ambari-server/lib/ambari_jinja2" PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap" PYTHON_WRAPER_SOURCE="/var/lib/ambari-server/ambari-python-wrap" @@ -35,14 +31,6 @@ do_install(){ if [ ! -d "$COMMON_DIR" ]; then ln -s "$COMMON_DIR_SERVER" "$COMMON_DIR" fi - # setting resource_management shared resource - if [ ! -d "$RESOURCE_MANAGEMENT_DIR" ]; then - ln -s "$RESOURCE_MANAGEMENT_DIR_SERVER" "$RESOURCE_MANAGEMENT_DIR" - fi - # setting jinja2 shared resource - if [ ! -d "$JINJA_DIR" ]; then - ln -s "$JINJA_SERVER_DIR" "$JINJA_DIR" - fi # setting python-wrapper script if [ ! -f "$PYTHON_WRAPER_TARGET" ]; then ln -s "$PYTHON_WRAPER_SOURCE" "$PYTHON_WRAPER_TARGET" @@ -51,6 +39,8 @@ do_install(){ do_remove(){ + rm -rf "$COMMON_DIR" + if [ -f "$PYTHON_WRAPER_TARGET" ]; then rm -f "$PYTHON_WRAPER_TARGET" fi http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/conf/windows/ambari-env.cmd ---------------------------------------------------------------------- diff --git a/ambari-server/conf/windows/ambari-env.cmd b/ambari-server/conf/windows/ambari-env.cmd new file mode 100644 index 0000000..23600d4 --- /dev/null +++ b/ambari-server/conf/windows/ambari-env.cmd @@ -0,0 +1,19 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + + +set AMBARI_PASSHPHRASE=DEV +set AMBARI_JVM_ARGS=%AMBARI_JVM_ARGS% -Xms512m -Xmx2048m -Djava.security.auth.login.config=conf\krb5JAASLogin.conf -Djava.security.krb5.conf=conf\krb5.conf -Djavax.security.auth.useSubjectCredsOnly=false http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/conf/windows/ambari.properties ---------------------------------------------------------------------- diff --git a/ambari-server/conf/windows/ambari.properties b/ambari-server/conf/windows/ambari.properties new file mode 100644 index 0000000..644bc68 --- /dev/null +++ b/ambari-server/conf/windows/ambari.properties @@ -0,0 +1,76 @@ +# Copyright 2011 The Apache Software Foundation +# +# 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. + +security.server.keys_dir=keystore +resources.dir=resources +custom.action.definitions=resources\\custom_action_definitions + +#Comma-separated list of JDK versions +#java.releases=jdk1.8.20,jdk1.6.31 +java.releases=jdk1.7.67 +jdk1.7.67.desc=Oracle JDK 1.7.67 +jdk1.7.67.url=http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-7u67-windows-x64.exe +jdk1.7.67.dest-file=jdk-7u67-windows-x64.exe +jdk1.7.67.jcpol-url=http://public-repo-1.hortonworks.com/ARTIFACTS/UnlimitedJCEPolicyJDK7.zip +jdk1.7.67.jcpol-file=UnlimitedJCEPolicyJDK7.zip +jdk1.7.67.home=C:\\jdk1.7.0_67 + +metadata.path=resources\\stacks +server.version.file=version +webapp.dir=web +bootstrap.dir=bootstrap +bootstrap.script=bootstrap\\bootstrap.py +bootstrap.setup_agent.script=bootstrap\\setupAgent.py +api.authenticate=true +server.connection.max.idle.millis=900000 +server.fqdn.service.url=http://127.0.0.1/latest/meta-data/public-hostname +server.stages.parallel=true + +# Scheduler settings +server.execution.scheduler.isClustered=false +server.execution.scheduler.maxThreads=5 +server.execution.scheduler.maxDbConnections=5 +server.execution.scheduler.misfire.toleration.minutes=480 + +# Default timeout in seconds before task is killed +agent.task.timeout=600 + +# thread pool maximums +client.threadpool.size.max=25 +agent.threadpool.size.max=25 + +# linux open-file limit +ulimit.open.files=10000 + +#java.home=C:\j2se1.8.0_05 + +#server.jdbc.rca.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver +#server.jdbc.rca.url=jdbc:sqlserver://localhost\\SQLEXPRESS;databaseName=ambari;integratedSecurity=true +##server.jdbc.rca.user.name=ambari +##server.jdbc.rca.user.passwd=etc\\ambari-server\\conf\\password.dat + +#server.jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver +#server.jdbc.driver.path=C:\\Program Files\\Microsoft JDBC DRIVER 4.0 for SQL Server\\sqljdbc_4.0\\enu\\sqljdbc4.jar +#server.jdbc.url=jdbc:sqlserver://localhost\\SQLEXPRESS;databaseName=ambari;integratedSecurity=true +#server.jdbc.schema=ambari +##server.jdbc.user.passwd=etc\\ambari-server\\conf\\password.dat +##server.jdbc.user.name=ambari +#scom.sink.db.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver +##scom.sink.db.url=jdbc:sqlserver://[server]:[port];databaseName=[databaseName];user=[user];password=[password] +#scom.sink.db.url=jdbc:sqlserver://localhost\\SQLEXPRESS;databaseName=HadoopMetrics;integratedSecurity=true + http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/conf/windows/ca.config ---------------------------------------------------------------------- diff --git a/ambari-server/conf/windows/ca.config b/ambari-server/conf/windows/ca.config new file mode 100644 index 0000000..c088bee --- /dev/null +++ b/ambari-server/conf/windows/ca.config @@ -0,0 +1,29 @@ +[ ca ] +default_ca = CA_CLIENT +[ CA_CLIENT ] +dir = keystore\\db +certs = $dir\\certs +new_certs_dir = $dir\\newcerts + +database = $dir\\index.txt +serial = $dir\\serial +default_days = 365 + +default_crl_days = 7 +default_md = md5 + +policy = policy_anything + +[ policy_anything ] +countryName = optional +stateOrProvinceName = optional +localityName = optional +organizationName = optional +organizationalUnitName = optional +commonName = optional +emailAddress = optional + +[ jdk7_ca ] +subjectKeyIdentifier = hash +authorityKeyIdentifier = keyid:always,issuer:always +basicConstraints = CA:true \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/conf/windows/install-helper.cmd ---------------------------------------------------------------------- diff --git a/ambari-server/conf/windows/install-helper.cmd b/ambari-server/conf/windows/install-helper.cmd new file mode 100644 index 0000000..3d4d688 --- /dev/null +++ b/ambari-server/conf/windows/install-helper.cmd @@ -0,0 +1,61 @@ +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information rega4rding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +rem ################################################################## +rem # SERVER INSTALL HELPER # +rem ################################################################## + +set COMMON_DIR="/usr/lib/python2.6/site-packages/common_functions" +set INSTALL_HELPER_AGENT="/var/lib/ambari-agent/install-helper.sh" +set COMMON_DIR_SERVER="/usr/lib/ambari-server/lib/common_functions" + +set PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap" +set PYTHON_WRAPER_SOURCE="/var/lib/ambari-server/ambari-python-wrap" + +do_install(){ + # setting common_functions shared resource + if [ ! -d "$COMMON_DIR" ]; then + ln -s "$COMMON_DIR_SERVER" "$COMMON_DIR" + fi + # setting python-wrapper script + if [ ! -f "$PYTHON_WRAPER_TARGET" ]; then + ln -s "$PYTHON_WRAPER_SOURCE" "$PYTHON_WRAPER_TARGET" + fi +} + +do_remove(){ + if [ -d "$COMMON_DIR" ]; then # common dir exists + rm -f "$COMMON_DIR" + fi + + if [ -f "$PYTHON_WRAPER_TARGET" ]; then + rm -f "$PYTHON_WRAPER_TARGET" + fi + + # if server package exists, restore their settings + if [ -f "$INSTALL_HELPER_AGENT" ]; then # call agent shared files installer + $INSTALL_HELPER_AGENT install + fi +} + + +case "$1" in +install) + do_install + ;; +remove) + do_remove + ;; +esac http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/conf/windows/krb5JAASLogin.conf ---------------------------------------------------------------------- diff --git a/ambari-server/conf/windows/krb5JAASLogin.conf b/ambari-server/conf/windows/krb5JAASLogin.conf new file mode 100644 index 0000000..0acb55c --- /dev/null +++ b/ambari-server/conf/windows/krb5JAASLogin.conf @@ -0,0 +1,13 @@ +com.sun.security.jgss.initiate { + com.sun.security.auth.module.Krb5LoginModule required + renewTGT=true + doNotPrompt=true + useKeyTab=true + keyTab="etc\\security\\keytabs\\ambari.keytab" + principal="ambari@EXAMPLE.COM" + isInitiator=true + storeKey=true + useTicketCache=true + client=true; +}; + http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/conf/windows/log4j.properties ---------------------------------------------------------------------- diff --git a/ambari-server/conf/windows/log4j.properties b/ambari-server/conf/windows/log4j.properties new file mode 100644 index 0000000..9189c6a --- /dev/null +++ b/ambari-server/conf/windows/log4j.properties @@ -0,0 +1,68 @@ +# Copyright 2011 The Apache Software Foundation +# +# 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. + +# Define some default values that can be overridden by system properties +ambari.root.logger=INFO,DRFA +ambari.log.dir=\\var\\log\\ambari-server-1.3.0-SNAPSHOT\\ +ambari.log.file=ambari-server.log +ambari.config-changes.file=ambari-config-changes.log + + +# Define the root logger to the system property "ambari.root.logger". +log4j.rootLogger=${ambari.root.logger} + +# Logging Threshold +log4j.threshhold=ALL + +# +# Daily Rolling File Appender +# + +log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender +log4j.appender.DRFA.File=${ambari.log.dir}\${ambari.log.file} + +# Rollver at midnight +log4j.appender.DRFA.DatePattern=.yyyy-MM-dd + +# 30-day backup +#log4j.appender.DRFA.MaxBackupIndex=30 +log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout + +# Pattern format: Date LogLevel LoggerName LogMessage +log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n +# Debugging Pattern format +#log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n + + +# +# console +# Add "console" to rootlogger above if you want to use this +# + +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.target=System.err +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n + +# Log config changes +log4j.logger.configchange=INFO,configchange +log4j.additivity.configchange=false +log4j.appender.configchange=org.apache.log4j.FileAppender +log4j.appender.configchange.File=${ambari.log.dir}\${ambari.config-changes.file} +log4j.appender.configchange.layout=org.apache.log4j.PatternLayout +log4j.appender.configchange.layout.ConversionPattern=%d{ISO8601} %5p - %m%n http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/docs/api/v1/clusters-cluster.md ---------------------------------------------------------------------- diff --git a/ambari-server/docs/api/v1/clusters-cluster.md b/ambari-server/docs/api/v1/clusters-cluster.md index 8da5b29..0a57e43 100644 --- a/ambari-server/docs/api/v1/clusters-cluster.md +++ b/ambari-server/docs/api/v1/clusters-cluster.md @@ -60,197 +60,105 @@ Returns information for the specified cluster identified by ":name" **Example** -Get information for the cluster "cluster001". +Get information for the cluster "c1". - GET /clusters/cluster001 + GET /clusters/c1 200 OK { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001", - "Clusters" : { - "cluster_id" : 9, - "cluster_name" : "cluster001", - "health_report" : { - "Host/stale_config" : 1, - "Host/maintenance_state" : 0, - "Host/host_state/HEALTHY" : 3, - "Host/host_state/UNHEALTHY" : 0, - "Host/host_state/HEARTBEAT_LOST" : 0, - "Host/host_state/INIT" : 0, - "Host/host_status/HEALTHY" : 3, - "Host/host_status/UNHEALTHY" : 0, - "Host/host_status/UNKNOWN" : 0, - "Host/host_status/ALERT" : 0 - }, - "provisioning_state" : "INIT", - "total_hosts" : 3, - "version" : "HDP-2.0", - "desired_configs" : { - "capacity-scheduler" : { - "user" : "admin", - "tag" : "version1408514705943" - }, - "core-site" : { - "user" : "admin", - "tag" : "version1409806913314" - }, - "global" : { - "user" : "admin", - "tag" : "version1409806913314" - }, - "hdfs-log4j" : { - "user" : "admin", - "tag" : "version1" - }, - "hdfs-site" : { - "user" : "admin", - "tag" : "version1407908591996" - }, - "mapred-site" : { - "user" : "admin", - "tag" : "version1408514705943" - }, - "mapreduce2-log4j" : { - "user" : "admin", - "tag" : "version1408514705943" - }, - "yarn-log4j" : { - "user" : "admin", - "tag" : "version1408514705943" - }, - "yarn-site" : { - "user" : "admin", - "tag" : "version1408514705943" - }, - "zoo.cfg" : { - "user" : "admin", - "tag" : "version1" - }, - "zookeeper-log4j" : { - "user" : "admin", - "tag" : "version1" - } - } - }, - "alerts" : { - "summary" : { - "CRITICAL" : 1, - "OK" : 2, - "PASSIVE" : 0, - "WARNING" : 0 - } - }, - "requests" : [ - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/requests/304", - "Requests" : { - "cluster_name" : "cluster001", - "id" : 304 - } - }, - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/requests/305", - "Requests" : { - "cluster_name" : "cluster001", - "id" : 305 - } - } - ], - "services" : [ - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/services/GANGLIA", - "ServiceInfo" : { - "cluster_name" : "cluster001", - "service_name" : "GANGLIA" - } - }, - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/services/HDFS", - "ServiceInfo" : { - "cluster_name" : "cluster001", - "service_name" : "HDFS" - } - }, - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/services/MAPREDUCE2", - "ServiceInfo" : { - "cluster_name" : "cluster001", - "service_name" : "MAPREDUCE2" - } - }, - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/services/ZOOKEEPER", - "ServiceInfo" : { - "cluster_name" : "cluster001", - "service_name" : "ZOOKEEPER" - } - } + "href" : "http://your.ambari.server/api/v1/clusters/c1", + "Clusters" : { + "cluster_name" : "c1", + "cluster_id" : 1, + "version" : "HDP-1.2.0" + }, + "services" : [ + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/services/NAGIOS", + "ServiceInfo" : { + "cluster_name" : "c1", + "service_name" : "NAGIOS" + } + }, + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/services/HCATALOG", + "ServiceInfo" : { + "cluster_name" : "c1", + "service_name" : "HCATALOG" + } + }, + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/services/PIG", + "ServiceInfo" : { + "cluster_name" : "c1", + "service_name" : "PIG" + } + }, + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/services/MAPREDUCE", + "ServiceInfo" : { + "cluster_name" : "c1", + "service_name" : "MAPREDUCE" + } + }, + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/services/GANGLIA", + "ServiceInfo" : { + "cluster_name" : "c1", + "service_name" : "GANGLIA" + } + }, + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/services/HIVE", + "ServiceInfo" : { + "cluster_name" : "c1", + "service_name" : "HIVE" + } + }, + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/services/HDFS", + "ServiceInfo" : { + "cluster_name" : "MyIE9", + "service_name" : "HDFS" + } + }, + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/services/ZOOKEEPER", + "ServiceInfo" : { + "cluster_name" : "c1", + "service_name" : "ZOOKEEPER" + } + }, + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/services/HBASE", + "ServiceInfo" : { + "cluster_name" : "c1", + "service_name" : "HBASE" + } + }, + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/services/OOZIE", + "ServiceInfo" : { + "cluster_name" : "c1", + "service_name" : "OOZIE" + } + } ], - "config_groups" : [ - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/config_groups/2", - "ConfigGroup" : { - "cluster_name" : "cluster001", - "id" : 2 - } - } - ], - "workflows" : [ ], - "hosts" : [ - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/hosts/host1.domain.com", - "Hosts" : { - "cluster_name" : "cluster001", - "host_name" : "host1.domain.com" - } - }, - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/hosts/host2.domain.com", - "Hosts" : { - "cluster_name" : "cluster001", - "host_name" : "host2.domain.com" - } - }, - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/hosts/host3.domain.com", - "Hosts" : { - "cluster_name" : "cluster001", - "host_name" : "host3.domain.com" - } - } - ], - "configurations" : [ - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/configurations?type=core-site&tag=version1", - "tag" : "version1", - "type" : "core-site", - "Config" : { - "cluster_name" : "cluster001" - } - }, - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/configurations?type=global&tag=version1", - "tag" : "version1", - "type" : "global", - "Config" : { - "cluster_name" : "cluster001" - } - }, - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/configurations?type=hdfs-site&tag=version1", - "tag" : "version1", - "type" : "hdfs-site", - "Config" : { - "cluster_name" : "cluster001" - } - }, - { - "href" : "http://your.ambari.server/api/v1/clusters/cluster001/configurations?type=zoo.cfg&tag=version1", - "tag" : "version1", - "type" : "zoo.cfg", - "Config" : { - "cluster_name" : "cluster001" - } - }, - ] + "hosts" : [ + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/hosts/some.host", + "Hosts" : { + "cluster_name" : "c1", + "host_name" : "some.host" + } + }, + { + "href" : "http://your.ambari.server/api/v1/clusters/c1/hosts/another.host", + "Hosts" : { + "cluster_name" : "c1", + "host_name" : "another.host" + } + } + ] } + http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/docs/api/v1/services.md ---------------------------------------------------------------------- diff --git a/ambari-server/docs/api/v1/services.md b/ambari-server/docs/api/v1/services.md index de5c203..8a9b68d 100644 --- a/ambari-server/docs/api/v1/services.md +++ b/ambari-server/docs/api/v1/services.md @@ -78,6 +78,13 @@ Get the collection of the services for the cluster named "c1". } }, { + "href" : "http://your.ambari.server/api/v1/clusters/c1/services/HCATALOG", + "ServiceInfo" : { + "cluster_name" : "c1", + "service_name" : "HCATALOG" + } + }, + { "href" : "http://your.ambari.server/api/v1/clusters/c1/services/PIG", "ServiceInfo" : { "cluster_name" : "c1", http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml index 8eeff3a..2228eb9 100644 --- a/ambari-server/pom.xml +++ b/ambari-server/pom.xml @@ -18,7 +18,7 @@ 4.0.0 org.apache.ambari ambari-server - jar + ${packagingFormat} Ambari Server 1.3.0-SNAPSHOT Ambari Server @@ -32,11 +32,8 @@ http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.1.1.0 http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json /usr/lib/ambari-server/lib/ambari_commons - /usr/lib/ambari-server/lib/resource_management - /usr/lib/ambari-server/lib/ambari_jinja2 ${basedir}/../ambari-web/public ${basedir}/../ambari-admin - ${basedir}/../contrib/views @@ -104,10 +101,35 @@ 3.0 + org.apache.maven.plugins + maven-antrun-plugin + 1.7 + + + package + + + + + + + + + + + + run + + + + + maven-assembly-plugin - src/main/assemblies/server.xml + ${assemblydescriptor} gnu @@ -137,16 +159,19 @@ src/main/resources/db/serial src/main/resources/db/index.txt src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/templates/exclude_hosts_list.j2 - src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer-err.log - src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer.log - src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/balancer-emulator/balancer.log - src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/balancer-emulator/balancer-err.log + src/main/windows/ambari-server.cmd + src/main/windows/ambari-server.ps1 conf/unix/ca.config conf/unix/krb5JAASLogin.conf + conf/windows/ca.config + conf/windows/krb5JAASLogin.conf + **/*.iml **/*.json **/*.sql + **/*.wxs **/repo_suse_rhel.j2 - **/repo_ubuntu.j2 + **/repo_debian.j2 + **/cluster.properties.j2 **/.pydev* @@ -154,6 +179,7 @@ src/main/resources/stacks/HDP/2.0._/services/HBASE/package/templates/regionservers.j2 + src/main/resources/stacks/HDPWIN/2.1/services/*/configuration/* src/test/resources/TestAmbaryServer.samples/** @@ -197,7 +223,6 @@ - org.codehaus.mojo rpm-maven-plugin @@ -215,7 +240,6 @@ 2012, Apache Software Foundation Development Maven Recipe: RPM Package. - no postgresql-server >= 8.1 openssl @@ -233,10 +257,6 @@ src/main/package/rpm/preremove.sh utf-8 - - src/main/package/rpm/posttrans_server.sh - utf-8 - 644 755 root @@ -276,29 +296,6 @@ - - ${resource_management.install.dir} - - - - ${project.basedir}/../ambari-common/src/main/python/resource_management - - - - - - ${jinja.install.dir} - root - root - - - ${project.basedir}/../ambari-common/src/main/python/ambari_jinja2/ambari_jinja2 - - ${project.basedir}/../ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite - - - - /usr/sbin 755 @@ -387,9 +384,6 @@ /var/run/ambari-server/bootstrap - /var/run/ambari-server/stack-recommendations - - /var/log/ambari-server @@ -420,21 +414,19 @@ src/main/resources/Ambari-DDL-MySQL-DROP.sql - ${project.build.directory}/DBConnectionVerification.jar + target/classes/Ambari-DDL-SQLServer-CREATE.sql - src/main/resources/role_command_order.json + target/classes/Ambari-DDL-SQLServer-CREATELOCAL.sql + + + src/main/resources/Ambari-DDL-SQLServer-DROP.sql - - - - /var/lib/ambari-server/resources/apps - 755 - root - root - - src/main/resources/slider_resources/README.txt + ${project.build.directory}/DBConnectionVerification.jar + + + src/main/resources/role_command_order.json @@ -455,10 +447,7 @@ 755 - ${ambari-admin-dir}/target - - *.jar - + ${ambari-admin-dir}/target/ambari-admin-${project.version}.jar @@ -482,21 +471,10 @@ - /var/lib/ambari-server/resources/stacks/${stack.distribution} - - - target/classes/stacks/${stack.distribution} - - - - - /var/lib/ambari-server/resources/stacks - 755 - root - root + /var/lib/ambari-server/resources/stacks/HDP - target/classes/stacks/stack_advisor.py + target/classes/stacks/HDP @@ -578,7 +556,6 @@ /usr/lib/ambari-server /var/run/ambari-server /var/run/ambari-server/bootstrap - /var/run/ambari-server/stack-recommendations /var/log/ambari-server /var/lib/ambari-server/resources/upgrade @@ -692,17 +669,6 @@ - src/main/resources/slider_resources/README.txt - file - - perm - /var/lib/ambari-server/resources/apps/ - root - root - 755 - - - conf/unix/ca.config file @@ -811,9 +777,8 @@ - ${ambari-admin-dir}/target - directory - *.jar + ${ambari-admin-dir}/target/ambari-admin-${project.version}.jar + file perm /var/lib/ambari-server/resources/views @@ -845,22 +810,11 @@ - target/classes/stacks/${stack.distribution} + target/classes/stacks/HDP directory perm - /var/lib/ambari-server/resources/stacks/${stack.distribution} - - - - target/classes/stacks/stack_advisor.py - file - - perm - /var/lib/ambari-server/resources/stacks - root - root - 755 + /var/lib/ambari-server/resources/stacks/HDP @@ -947,30 +901,6 @@ root - - - ${project.basedir}/../ambari-common/src/main/python/resource_management - - directory - - perm - ${resource_management.install.dir} - 755 - root - root - - - - ${project.basedir}/../ambari-common/src/main/python/ambari_jinja2/ambari_jinja2 - ${project.basedir}/../ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite - directory - - perm - ${jinja.install.dir} - root - root - - @@ -997,14 +927,14 @@ - ${project.basedir}/../ambari-common/src/main/unix/ambari-python-wrap + ${executable.python} src/test/python unitTests.py ${custom.tests} - ${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 + ${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 ${skipTests} @@ -1039,48 +969,6 @@ - - org.apache.maven.plugins - maven-antrun-plugin - 1.7 - - - package - - - - - - - - - - - - run - - - - - copy-view-jars - package - - run - - - - - - - - - - - - - @@ -1150,6 +1038,139 @@ + + windows + + + win + + + + win + \ + ; + python + cmd + cmd + .cmd + ${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 + src/main/assemblies/server-windows.xml + jar + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2 + + + run-heat + package + + exec + + + heat.exe + + dir + "." + -dr + "AMBARI_SERVER_1.3.0_SNAPSHOT" + -platform + Win64 + -cg + "AmbariServerGroup" + -gg + -ke + -srd + -o + ".\..\..\ambari-server-files.wxs" + + target/ambari-server-${project.version}-dist/ambari-server-${project.version} + + + + + + org.apache.npanday.plugins + wix-maven-plugin + 1.4.0-incubating + true + + + src/main/package/msi/ambari-server.wxs + target/ambari-server-files.wxs + + target + + target/ambari-server.wixobj + target/ambari-server-files.wixobj + + target/ambari-server-${project.version}.msi + + WixUIExtension + + + + + wix-candle + package + + candle + + + -arch x64 + + + + wix-light + package + + light + + + -b ${basedir}/target/ambari-server-${project.version}-dist/ambari-server-${project.version} + + + + + + + + + org.apache.npanday.plugins + wix-maven-plugin + 1.4.0-incubating + test + + + ${pom.groupId} + metrics-sink + 1.0.0 + + + + + linux + + + unix + + + + linux + / + : + ${project.basedir}/../ambari-common/src/main/unix/ambari-python-wrap + sh + sh + + ${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 + src/main/assemblies/server.xml + jar + + @@ -1446,12 +1467,4 @@ - - - - EclipseLink - http://download.eclipse.org/rt/eclipselink/maven.repo - - - http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/sbin/ambari-server ---------------------------------------------------------------------- diff --git a/ambari-server/sbin/ambari-server b/ambari-server/sbin/ambari-server index d4619e9..f4b66eb 100644 --- a/ambari-server/sbin/ambari-server +++ b/ambari-server/sbin/ambari-server @@ -115,10 +115,6 @@ case "$1" in echo -e "Setting up LDAP properties..." $PYTHON /usr/sbin/ambari-server.py $@ ;; - sync-ldap) - echo -e "Syncing with LDAP..." - $PYTHON /usr/sbin/ambari-server.py $@ - ;; setup-security) echo -e "Security setup options..." $PYTHON /usr/sbin/ambari-server.py $@ @@ -129,7 +125,7 @@ case "$1" in ;; *) echo "Usage: /usr/sbin/ambari-server - {start|stop|restart|setup|upgrade|status|upgradestack|setup-ldap|sync-ldap|setup-security|refresh-stack-hash} [options] + {start|stop|restart|setup|upgrade|status|upgradestack|setup-ldap|setup-security|refresh-stack-hash} [options] Use usr/sbin/ambari-server --help to get details on options available. Or, simply invoke ambari-server.py --help to print the options." exit 1 http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/assemblies/server-windows.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/assemblies/server-windows.xml b/ambari-server/src/main/assemblies/server-windows.xml new file mode 100644 index 0000000..08a4441 --- /dev/null +++ b/ambari-server/src/main/assemblies/server-windows.xml @@ -0,0 +1,166 @@ + + + + dist + + dir + + false + + + ${project.build.directory}/${artifact.artifactId}-${artifact.version}.jar + ambari-server-${project.version}/lib + + + ${project.build.directory}/DBConnectionVerification.jar + ambari-server-${project.version}/resources + + + ${basedir}/conf/windows/ambari.properties + /ambari-server-${project.version}/conf + + + ${basedir}/conf/windows/log4j.properties + /ambari-server-${project.version}/conf + + + ${basedir}/conf/windows/ca.config + /ambari-server-${project.version}/keystore + + + ${basedir}/src/main/python/ambari-server-windows.py + /ambari-server-${project.version}/sbin + + + ${basedir}/src/main/python/bootstrap.py + /ambari-server-${project.version}/bootstrap + + + ${basedir}/src/main/python/setupAgent.py + /ambari-server-${project.version}/bootstrap + + + ${basedir}/src/main/windows/ambari-server.cmd + /ambari-server-${project.version} + + + ${basedir}/src/main/windows/ambari-server.ps1 + /ambari-server-${project.version} + + + ${project.build.directory}/version + ambari-server-${project.version}/ + + + ${basedir}/../contrib/ambari-scom/metrics-sink/db/Hadoop-Metrics-SQLServer-CREATE.sql + /ambari-server-${project.version}/resources + + + ${basedir}/../contrib/ambari-scom/metrics-sink/db/Hadoop-Metrics-SQLServer-CREATELOCAL.sql + /ambari-server-${project.version}/resources + + + ${basedir}/../contrib/ambari-scom/metrics-sink/db/Hadoop-Metrics-SQLServer-DROP.sql + /ambari-server-${project.version}/resources + + + ${basedir}/../contrib/ambari-scom/metrics-sink/target/metrics-sink-1.0.0.jar + /ambari-server-${project.version}/resources + + + + + + ${basedir}/../ + ambari-server-${project.version}/ + + *.txt + + + + ${basedir}/src/main/python/ambari_server + ambari-server-${project.version}/sbin/ambari_server + + *.py + *.pyc + + + + ${basedir}/../ambari-common/src/main/python/ambari_commons + ambari-server-${project.version}/sbin/ambari_commons + + *.py + *.pyc + + + + + + ${basedir}/src/main/resources/ + /ambari-server-${project.version}/keystore + + db/* + pass.txt + + + + ${basedir}/../ambari-web/public + ambari-server-${project.version}/web + + ** + + + + ${basedir}/src/main/resources + /ambari-server-${project.version}/resources/ + + Ambari-DDL-SQLServer-*.sql + custom_action_definitions/** + custom_actions/** + scripts/** + stacks/HDPWIN/** + upgrade/** + + + + + + ambari-server-${project.version}/lib + false + compile + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/assemblies/server.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/assemblies/server.xml b/ambari-server/src/main/assemblies/server.xml index a5a1f79..f02b6f8 100644 --- a/ambari-server/src/main/assemblies/server.xml +++ b/ambari-server/src/main/assemblies/server.xml @@ -93,8 +93,7 @@ src/main/resources /ambari-server-${project.version}/var/lib/ambari-server/resources/ - stacks/stack_advisor.py - stacks/${stack.distribution}/** + stacks/HDP/** http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/DBConnectionVerification.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/DBConnectionVerification.java b/ambari-server/src/main/java/org/apache/ambari/server/DBConnectionVerification.java index 7c053f3..9ff04fb 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/DBConnectionVerification.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/DBConnectionVerification.java @@ -18,6 +18,8 @@ package org.apache.ambari.server; +import org.apache.commons.lang.StringUtils; + import java.sql.*; public class DBConnectionVerification { @@ -30,7 +32,11 @@ public class DBConnectionVerification { Connection conn = null; try { Class.forName(driver); - conn = DriverManager.getConnection(url, username, password); + if(url.contains("integratedSecurity=true")) { + conn = DriverManager.getConnection(url); + } else { + conn = DriverManager.getConnection(url, username, password); + } System.out.println("Connected to DB Successfully!"); } catch (Exception e) { System.out.println("ERROR: Unable to connect to the DB. Please check DB connection properties."); http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java index 1f99b4a..fd3e039 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java @@ -18,7 +18,6 @@ package org.apache.ambari.server.actionmanager; import com.google.inject.persist.Transactional; -import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.agent.CommandReport; import org.apache.ambari.server.agent.ExecutionCommand; @@ -67,7 +66,7 @@ public interface ActionDBAccessor { * @param request request object */ @Transactional - void persistActions(Request request) throws AmbariException; + void persistActions(Request request); @Transactional void startRequest(long requestId); http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java index 5e879cc..a6c59a7 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java @@ -23,7 +23,6 @@ import com.google.inject.Inject; import com.google.inject.Singleton; import com.google.inject.name.Named; import com.google.inject.persist.Transactional; -import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.agent.CommandReport; import org.apache.ambari.server.agent.ExecutionCommand; import org.apache.ambari.server.orm.dao.ClusterDAO; @@ -43,7 +42,6 @@ import org.apache.ambari.server.orm.entities.RequestScheduleEntity; import org.apache.ambari.server.orm.entities.RoleSuccessCriteriaEntity; import org.apache.ambari.server.orm.entities.StageEntity; import org.apache.ambari.server.state.Clusters; -import org.apache.ambari.server.state.Host; import org.apache.ambari.server.utils.StageUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -203,7 +201,7 @@ public class ActionDBAccessorImpl implements ActionDBAccessor { @Override @Transactional - public void persistActions(Request request) throws AmbariException { + public void persistActions(Request request) { RequestEntity requestEntity = request.constructNewPersistenceEntity(); @@ -239,31 +237,14 @@ public class ActionDBAccessorImpl implements ActionDBAccessor { if (hostEntity == null) { String msg = String.format("Host %s doesn't exist in database", hostRoleCommandEntity.getHostName()); LOG.error(msg); - throw new AmbariException(msg); + throw new RuntimeException(msg); } hostRoleCommandEntity.setHost(hostEntity); hostRoleCommandDAO.create(hostRoleCommandEntity); assert hostRoleCommandEntity.getTaskId() != null; - hostRoleCommand.setTaskId(hostRoleCommandEntity.getTaskId()); - - try { - // Get the in-memory host object and its prefix to construct the output and error log paths. - Host hostObject = clusters.getHost(hostRoleCommandEntity.getHostName()); - String prefix = hostObject.getPrefix(); - if (null != prefix && !prefix.isEmpty()) { - if (!prefix.endsWith("/")) { - prefix = prefix + "/"; - } - hostRoleCommand.setOutputLog(prefix + "output-" + hostRoleCommandEntity.getTaskId() + ".txt"); - hostRoleCommand.setErrorLog(prefix + "errors-" + hostRoleCommandEntity.getTaskId() + ".txt"); - hostRoleCommandEntity.setOutputLog(hostRoleCommand.getOutputLog()); - hostRoleCommandEntity.setErrorLog(hostRoleCommand.getErrorLog()); - } - } catch (AmbariException e) { - LOG.warn("Exception in getting prefix for host and setting output and error log files."); - } + hostRoleCommand.setTaskId(hostRoleCommandEntity.getTaskId()); ExecutionCommandEntity executionCommandEntity = hostRoleCommand.constructExecutionCommandEntity(); executionCommandEntity.setHostRoleCommand(hostRoleCommandEntity); @@ -346,18 +327,11 @@ public class ActionDBAccessorImpl implements ActionDBAccessor { long now = System.currentTimeMillis(); List requestsToCheck = new ArrayList(); - List abortedCommandUpdates = new ArrayList(); List commandEntities = hostRoleCommandDAO.findByPKs(taskReports.keySet()); for (HostRoleCommandEntity commandEntity : commandEntities) { CommandReport report = taskReports.get(commandEntity.getTaskId()); - if (commandEntity.getStatus() != HostRoleStatus.ABORTED) { - // We don't want to overwrite statuses for ABORTED tasks with - // statuses that have been received from the agent after aborting task - commandEntity.setStatus(HostRoleStatus.valueOf(report.getStatus())); - } else { - abortedCommandUpdates.add(commandEntity.getTaskId()); - } + commandEntity.setStatus(HostRoleStatus.valueOf(report.getStatus())); commandEntity.setStdOut(report.getStdOut().getBytes()); commandEntity.setStdError(report.getStdErr().getBytes()); commandEntity.setStructuredOut(report.getStructuredOut() == null ? null : @@ -378,8 +352,6 @@ public class ActionDBAccessorImpl implements ActionDBAccessor { } hostRoleCommandDAO.mergeAll(commandEntities); - // Invalidate cache because of updates to ABORTED commands - hostRoleCommandCache.invalidateAll(abortedCommandUpdates); for (Long requestId : requestsToCheck) { endRequestIfCompleted(requestId); http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java index e2fad5f..4bb9d1d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java @@ -36,7 +36,6 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Collection; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -85,7 +84,7 @@ public class ActionManager { sendActions(request, actionRequest); } - public void sendActions(Request request, ExecuteActionRequest executeActionRequest) throws AmbariException { + public void sendActions(Request request, ExecuteActionRequest executeActionRequest) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Persisting Request into DB: %s", request)); @@ -119,39 +118,28 @@ public class ActionManager { return db.getAllStages(requestId); } - public HostRoleCommand getTaskById(long taskId) { - return db.getTask(taskId); - } - /** * Persists command reports into the db - * @param reports command reports - * @param commands a list of commands that correspond to reports list (it should be - * a 1 to 1 matching). We use this list to avoid fetching commands from the DB - * twice */ - public void processTaskResponse(String hostname, List reports, - Collection commands) { + public void processTaskResponse(String hostname, List reports) { if (reports == null) { return; } List reportsToProcess = new ArrayList(); - Iterator commandIterator = commands.iterator(); //persist the action response into the db. for (CommandReport report : reports) { - HostRoleCommand command = commandIterator.next(); if (LOG.isDebugEnabled()) { LOG.debug("Processing command report : " + report.toString()); } + HostRoleCommand command = db.getTask(report.getTaskId()); if (command == null) { LOG.warn("The task " + report.getTaskId() + " is invalid"); continue; } - if (! command.getStatus().equals(HostRoleStatus.IN_PROGRESS) - && ! command.getStatus().equals(HostRoleStatus.QUEUED) - && ! command.getStatus().equals(HostRoleStatus.ABORTED)) { + if (!command.getStatus().equals(HostRoleStatus.IN_PROGRESS) + && !command.getStatus().equals(HostRoleStatus.QUEUED)) { LOG.warn("The task " + command.getTaskId() + " is not in progress, ignoring update"); continue; @@ -231,9 +219,4 @@ public class ActionManager { public String getRequestContext(long requestId) { return db.getRequestContext(requestId); } - - public void cancelRequest(long requestId, String reason) { - scheduler.scheduleCancellingRequest(requestId, reason); - scheduler.awake(); - } }