You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2014/10/08 00:52:43 UTC
[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> <JSON_CONFIG> <BASEDIR> <STROUTPUT> <LOGGING_LEVEL> <TMP_DIR>
-
-<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
-<TMP_DIR> 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 @@
<version>1.3.0-SNAPSHOT</version>
<description>Apache Ambari Project POM</description>
<name>Apache Ambari Project POM</name>
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <issueManagement>
- <system>jira</system>
- <url>https://issues.apache.org/jira/browse/AMBARI</url>
- </issueManagement>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
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 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ambari</groupId>
<artifactId>ambari-server</artifactId>
- <packaging>jar</packaging>
+ <packaging>${packagingFormat}</packaging>
<name>Ambari Server</name>
<version>1.3.0-SNAPSHOT</version>
<description>Ambari Server</description>
@@ -32,11 +32,8 @@
<hdpUrlForCentos6>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.1.1.0</hdpUrlForCentos6>
<hdpLatestUrl>http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json</hdpLatestUrl>
<ambari_commons.install.dir>/usr/lib/ambari-server/lib/ambari_commons</ambari_commons.install.dir>
- <resource_management.install.dir>/usr/lib/ambari-server/lib/resource_management</resource_management.install.dir>
- <jinja.install.dir>/usr/lib/ambari-server/lib/ambari_jinja2</jinja.install.dir>
<ambari-web-dir>${basedir}/../ambari-web/public</ambari-web-dir>
<ambari-admin-dir>${basedir}/../ambari-admin</ambari-admin-dir>
- <contrib-views-dir>${basedir}/../contrib/views</contrib-views-dir>
</properties>
<build>
<plugins>
@@ -104,10 +101,35 @@
<version>3.0</version>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <jar destfile="target/DBConnectionVerification.jar">
+ <fileset dir="${basedir}/target/classes/"
+ includes="**/DBConnectionVerification.class" />
+ <manifest>
+ <attribute name="Main-Class"
+ value="org.apache.ambari.server.DBConnectionVerification" />
+ </manifest>
+ </jar>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
- <descriptor>src/main/assemblies/server.xml</descriptor>
+ <descriptor>${assemblydescriptor}</descriptor>
</descriptors>
<tarLongFileMode>gnu</tarLongFileMode>
</configuration>
@@ -137,16 +159,19 @@
<exclude>src/main/resources/db/serial</exclude>
<exclude>src/main/resources/db/index.txt</exclude>
<exclude>src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/templates/exclude_hosts_list.j2</exclude>
- <exclude>src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer-err.log</exclude>
- <exclude>src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer.log</exclude>
- <exclude>src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/balancer-emulator/balancer.log</exclude>
- <exclude>src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/balancer-emulator/balancer-err.log</exclude>
+ <exclude>src/main/windows/ambari-server.cmd</exclude>
+ <exclude>src/main/windows/ambari-server.ps1</exclude>
<exclude>conf/unix/ca.config</exclude>
<exclude>conf/unix/krb5JAASLogin.conf</exclude>
+ <exclude>conf/windows/ca.config</exclude>
+ <exclude>conf/windows/krb5JAASLogin.conf</exclude>
+ <exclude>**/*.iml</exclude>
<exclude>**/*.json</exclude>
<exclude>**/*.sql</exclude>
+ <exclude>**/*.wxs</exclude>
<exclude>**/repo_suse_rhel.j2</exclude>
- <exclude>**/repo_ubuntu.j2</exclude>
+ <exclude>**/repo_debian.j2</exclude>
+ <exclude>**/cluster.properties.j2</exclude>
<exclude>**/.pydev*</exclude>
<!--gitignore content -->
@@ -154,6 +179,7 @@
<!-- Stack definitions -->
<exclude>src/main/resources/stacks/HDP/2.0._/services/HBASE/package/templates/regionservers.j2</exclude>
+ <exclude>src/main/resources/stacks/HDPWIN/2.1/services/*/configuration/*</exclude>
<!--test samples -->
<exclude>src/test/resources/TestAmbaryServer.samples/**</exclude>
@@ -197,7 +223,6 @@
</dependency>
</dependencies>
</plugin>
-
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
@@ -215,7 +240,6 @@
<copyright>2012, Apache Software Foundation</copyright>
<group>Development</group>
<description>Maven Recipe: RPM Package.</description>
- <autoRequires>no</autoRequires>
<requires>
<require>postgresql-server >= 8.1</require>
<require>openssl</require>
@@ -233,10 +257,6 @@
<scriptFile>src/main/package/rpm/preremove.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</preremoveScriptlet>
- <posttransScriptlet>
- <scriptFile>src/main/package/rpm/posttrans_server.sh</scriptFile>
- <fileEncoding>utf-8</fileEncoding>
- </posttransScriptlet>
<defaultFilemode>644</defaultFilemode>
<defaultDirmode>755</defaultDirmode>
<defaultUsername>root</defaultUsername>
@@ -276,29 +296,6 @@
</source>
</sources>
</mapping>
- <mapping>
- <directory>${resource_management.install.dir}</directory>
- <sources>
- <source>
- <location>
- ${project.basedir}/../ambari-common/src/main/python/resource_management
- </location>
- </source>
- </sources>
- </mapping>
- <mapping>
- <directory>${jinja.install.dir}</directory>
- <username>root</username>
- <groupname>root</groupname>
- <sources>
- <source>
- <location>${project.basedir}/../ambari-common/src/main/python/ambari_jinja2/ambari_jinja2</location>
- <excludes>
- <exclude>${project.basedir}/../ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite</exclude>
- </excludes>
- </source>
- </sources>
- </mapping>
<mapping>
<directory>/usr/sbin</directory>
<filemode>755</filemode>
@@ -387,9 +384,6 @@
<directory>/var/run/ambari-server/bootstrap</directory>
</mapping>
<mapping>
- <directory>/var/run/ambari-server/stack-recommendations</directory>
- </mapping>
- <mapping>
<directory>/var/log/ambari-server</directory>
</mapping>
<mapping>
@@ -420,21 +414,19 @@
<location>src/main/resources/Ambari-DDL-MySQL-DROP.sql</location>
</source>
<source>
- <location>${project.build.directory}/DBConnectionVerification.jar</location>
+ <location>target/classes/Ambari-DDL-SQLServer-CREATE.sql</location>
</source>
<source>
- <location>src/main/resources/role_command_order.json</location>
+ <location>target/classes/Ambari-DDL-SQLServer-CREATELOCAL.sql</location>
+ </source>
+ <source>
+ <location>src/main/resources/Ambari-DDL-SQLServer-DROP.sql</location>
</source>
- </sources>
- </mapping>
- <mapping>
- <directory>/var/lib/ambari-server/resources/apps</directory>
- <filemode>755</filemode>
- <username>root</username>
- <groupname>root</groupname>
- <sources>
<source>
- <location>src/main/resources/slider_resources/README.txt</location>
+ <location>${project.build.directory}/DBConnectionVerification.jar</location>
+ </source>
+ <source>
+ <location>src/main/resources/role_command_order.json</location>
</source>
</sources>
</mapping>
@@ -455,10 +447,7 @@
<filemode>755</filemode>
<sources>
<source>
- <location>${ambari-admin-dir}/target</location>
- <includes>
- <include>*.jar</include>
- </includes>
+ <location>${ambari-admin-dir}/target/ambari-admin-${project.version}.jar</location>
</source>
</sources>
</mapping>
@@ -482,21 +471,10 @@
</sources>
</mapping>
<mapping>
- <directory>/var/lib/ambari-server/resources/stacks/${stack.distribution}</directory>
- <sources>
- <source>
- <location>target/classes/stacks/${stack.distribution}</location>
- </source>
- </sources>
- </mapping>
- <mapping>
- <directory>/var/lib/ambari-server/resources/stacks</directory>
- <filemode>755</filemode>
- <username>root</username>
- <groupname>root</groupname>
+ <directory>/var/lib/ambari-server/resources/stacks/HDP</directory>
<sources>
<source>
- <location>target/classes/stacks/stack_advisor.py</location>
+ <location>target/classes/stacks/HDP</location>
</source>
</sources>
</mapping>
@@ -578,7 +556,6 @@
<path>/usr/lib/ambari-server</path>
<path>/var/run/ambari-server</path>
<path>/var/run/ambari-server/bootstrap</path>
- <path>/var/run/ambari-server/stack-recommendations</path>
<path>/var/log/ambari-server</path>
<path>/var/lib/ambari-server/resources/upgrade</path>
</paths>
@@ -692,17 +669,6 @@
</mapper>
</data>
<data>
- <src>src/main/resources/slider_resources/README.txt</src>
- <type>file</type>
- <mapper>
- <type>perm</type>
- <prefix>/var/lib/ambari-server/resources/apps/</prefix>
- <user>root</user>
- <group>root</group>
- <filemode>755</filemode>
- </mapper>
- </data>
- <data>
<src>conf/unix/ca.config</src>
<type>file</type>
<mapper>
@@ -811,9 +777,8 @@
</mapper>
</data>
<data>
- <src>${ambari-admin-dir}/target</src>
- <type>directory</type>
- <includes>*.jar</includes>
+ <src>${ambari-admin-dir}/target/ambari-admin-${project.version}.jar</src>
+ <type>file</type>
<mapper>
<type>perm</type>
<prefix>/var/lib/ambari-server/resources/views</prefix>
@@ -845,22 +810,11 @@
</mapper>
</data>
<data>
- <src>target/classes/stacks/${stack.distribution}</src>
+ <src>target/classes/stacks/HDP</src>
<type>directory</type>
<mapper>
<type>perm</type>
- <prefix>/var/lib/ambari-server/resources/stacks/${stack.distribution}</prefix>
- </mapper>
- </data>
- <data>
- <src>target/classes/stacks/stack_advisor.py</src>
- <type>file</type>
- <mapper>
- <type>perm</type>
- <prefix>/var/lib/ambari-server/resources/stacks</prefix>
- <user>root</user>
- <group>root</group>
- <filemode>755</filemode>
+ <prefix>/var/lib/ambari-server/resources/stacks/HDP</prefix>
</mapper>
</data>
<data>
@@ -947,30 +901,6 @@
<group>root</group>
</mapper>
</data>
- <data>
- <src>
- ${project.basedir}/../ambari-common/src/main/python/resource_management
- </src>
- <type>directory</type>
- <mapper>
- <type>perm</type>
- <prefix>${resource_management.install.dir}</prefix>
- <filemode>755</filemode>
- <user>root</user>
- <group>root</group>
- </mapper>
- </data>
- <data>
- <src>${project.basedir}/../ambari-common/src/main/python/ambari_jinja2/ambari_jinja2</src>
- <excludes>${project.basedir}/../ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite</excludes>
- <type>directory</type>
- <mapper>
- <type>perm</type>
- <prefix>${jinja.install.dir}</prefix>
- <user>root</user>
- <group>root</group>
- </mapper>
- </data>
</dataSet>
</configuration>
</plugin>
@@ -997,14 +927,14 @@
<executions>
<execution>
<configuration>
- <executable>${project.basedir}/../ambari-common/src/main/unix/ambari-python-wrap</executable>
+ <executable>${executable.python}</executable>
<workingDirectory>src/test/python</workingDirectory>
<arguments>
<argument>unitTests.py</argument>
<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>${project.basedir}/../ambari-agent/src/main/python:${project.basedir}/../ambari-common/src/main/python/jinja2:${project.basedir}/../ambari-common/src/main/python:${project.basedir}/../ambari-common/src/main/python/ambari_commons:${project.basedir}/../ambari-common/src/test/python:${project.basedir}/src/main/python:${project.basedir}/src/main/python/ambari-server-state:${project.basedir}/src/test/python:$PYTHONPATH</PYTHONPATH>
</environmentVariables>
<skip>${skipTests}</skip>
</configuration>
@@ -1039,48 +969,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <phase>package</phase>
- <configuration>
- <tasks>
- <jar destfile="target/DBConnectionVerification.jar">
- <fileset dir="${basedir}/target/classes/"
- includes="**/DBConnectionVerification.class" />
- <manifest>
- <attribute name="Main-Class"
- value="org.apache.ambari.server.DBConnectionVerification" />
- </manifest>
- </jar>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <!-- Copies compiled views into known location for RPM builds -->
- <execution>
- <id>copy-view-jars</id>
- <phase>package</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <copy todir="${ambari-admin-dir}/target" flatten="true">
- <fileset dir="${contrib-views-dir}">
- <include name="*/target/*jar" />
- </fileset>
- </copy>
- </target>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
<resources>
<resource>
@@ -1150,6 +1038,139 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>windows</id>
+ <activation>
+ <os>
+ <family>win</family>
+ </os>
+ </activation>
+ <properties>
+ <envClassifier>win</envClassifier>
+ <dirsep>\</dirsep>
+ <pathsep>;</pathsep>
+ <executable.python>python</executable.python>
+ <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>
+ <assemblydescriptor>src/main/assemblies/server-windows.xml</assemblydescriptor>
+ <packagingFormat>jar</packagingFormat>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <id>run-heat</id>
+ <phase>package</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>heat.exe</executable>
+ <arguments>
+ <argument>dir</argument>
+ <argument>"."</argument>
+ <argument>-dr</argument>
+ <argument>"AMBARI_SERVER_1.3.0_SNAPSHOT"</argument>
+ <argument>-platform</argument>
+ <argument>Win64</argument>
+ <argument>-cg</argument>
+ <argument>"AmbariServerGroup"</argument>
+ <argument>-gg</argument>
+ <argument>-ke</argument>
+ <argument>-srd</argument>
+ <argument>-o</argument>
+ <argument>".\..\..\ambari-server-files.wxs"</argument>
+ </arguments>
+ <workingDirectory>target/ambari-server-${project.version}-dist/ambari-server-${project.version}</workingDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.npanday.plugins</groupId>
+ <artifactId>wix-maven-plugin</artifactId>
+ <version>1.4.0-incubating</version>
+ <extensions>true</extensions>
+ <configuration>
+ <sourceFiles>
+ <sourceFile>src/main/package/msi/ambari-server.wxs</sourceFile>
+ <sourceFile>target/ambari-server-files.wxs</sourceFile>
+ </sourceFiles>
+ <outputDirectory>target</outputDirectory>
+ <objectFiles>
+ <objectFile>target/ambari-server.wixobj</objectFile>
+ <objectFile>target/ambari-server-files.wixobj</objectFile>
+ </objectFiles>
+ <outputFile>target/ambari-server-${project.version}.msi</outputFile>
+ <extensions>
+ <extension>WixUIExtension</extension>
+ </extensions>
+ </configuration>
+ <executions>
+ <execution>
+ <id>wix-candle</id>
+ <phase>package</phase>
+ <goals>
+ <goal>candle</goal>
+ </goals>
+ <configuration>
+ <arguments>-arch x64</arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>wix-light</id>
+ <phase>package</phase>
+ <goals>
+ <goal>light</goal>
+ </goals>
+ <configuration>
+ <arguments>-b ${basedir}/target/ambari-server-${project.version}-dist/ambari-server-${project.version}</arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.npanday.plugins</groupId>
+ <artifactId>wix-maven-plugin</artifactId>
+ <version>1.4.0-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>metrics-sink</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>linux</id>
+ <activation>
+ <os>
+ <family>unix</family>
+ </os>
+ </activation>
+ <properties>
+ <envClassifier>linux</envClassifier>
+ <dirsep>/</dirsep>
+ <pathsep>:</pathsep>
+ <executable.python>${project.basedir}/../ambari-common/src/main/unix/ambari-python-wrap</executable.python>
+ <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>
+ <assemblydescriptor>src/main/assemblies/server.xml</assemblydescriptor>
+ <packagingFormat>jar</packagingFormat>
+ </properties>
+ </profile>
</profiles>
<dependencies>
<dependency>
@@ -1446,12 +1467,4 @@
<!--<reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId> <version>2.5.2</version> </plugin>
</plugins> </reporting> -->
-
- <pluginRepositories>
- <pluginRepository>
- <id>EclipseLink</id>
- <url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
- </pluginRepository>
- </pluginRepositories>
-
</project>
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 <action> --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 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<assembly>
+ <id>dist</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <files>
+ <file>
+ <source>${project.build.directory}/${artifact.artifactId}-${artifact.version}.jar</source>
+ <outputDirectory>ambari-server-${project.version}/lib</outputDirectory>
+ </file>
+ <file>
+ <source>${project.build.directory}/DBConnectionVerification.jar</source>
+ <outputDirectory>ambari-server-${project.version}/resources</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/conf/windows/ambari.properties</source>
+ <outputDirectory>/ambari-server-${project.version}/conf</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/conf/windows/log4j.properties</source>
+ <outputDirectory>/ambari-server-${project.version}/conf</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/conf/windows/ca.config</source>
+ <outputDirectory>/ambari-server-${project.version}/keystore</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/src/main/python/ambari-server-windows.py</source>
+ <outputDirectory>/ambari-server-${project.version}/sbin</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/src/main/python/bootstrap.py</source>
+ <outputDirectory>/ambari-server-${project.version}/bootstrap</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/src/main/python/setupAgent.py</source>
+ <outputDirectory>/ambari-server-${project.version}/bootstrap</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/src/main/windows/ambari-server.cmd</source>
+ <outputDirectory>/ambari-server-${project.version}</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/src/main/windows/ambari-server.ps1</source>
+ <outputDirectory>/ambari-server-${project.version}</outputDirectory>
+ </file>
+ <file>
+ <source>${project.build.directory}/version</source>
+ <outputDirectory>ambari-server-${project.version}/</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/../contrib/ambari-scom/metrics-sink/db/Hadoop-Metrics-SQLServer-CREATE.sql</source>
+ <outputDirectory>/ambari-server-${project.version}/resources</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/../contrib/ambari-scom/metrics-sink/db/Hadoop-Metrics-SQLServer-CREATELOCAL.sql</source>
+ <outputDirectory>/ambari-server-${project.version}/resources</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/../contrib/ambari-scom/metrics-sink/db/Hadoop-Metrics-SQLServer-DROP.sql</source>
+ <outputDirectory>/ambari-server-${project.version}/resources</outputDirectory>
+ </file>
+ <file>
+ <source>${basedir}/../contrib/ambari-scom/metrics-sink/target/metrics-sink-1.0.0.jar</source>
+ <outputDirectory>/ambari-server-${project.version}/resources</outputDirectory>
+ </file>
+ </files>
+ <fileSets>
+ <!-- Distro files, readme, licenses, etc -->
+ <fileSet>
+ <directory>${basedir}/../</directory>
+ <outputDirectory>ambari-server-${project.version}/</outputDirectory>
+ <includes>
+ <include>*.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/main/python/ambari_server</directory>
+ <outputDirectory>ambari-server-${project.version}/sbin/ambari_server</outputDirectory>
+ <includes>
+ <include>*.py</include>
+ <include>*.pyc</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/../ambari-common/src/main/python/ambari_commons</directory>
+ <outputDirectory>ambari-server-${project.version}/sbin/ambari_commons</outputDirectory>
+ <includes>
+ <include>*.py</include>
+ <include>*.pyc</include>
+ </includes>
+ </fileSet>
+ <!--
+ <fileSet>
+ <directory>${project.build.directory}/web/</directory>
+ <outputDirectory>ambari-server-${project.version}/web/</outputDirectory>
+ <includes>
+ <include>*</include>
+ </includes>
+ </fileSet>
+ -->
+ <!--
+ <fileSet>
+ <directory>${basedir}/src/main/bin</directory>
+ <outputDirectory>ambari-server-${project.version}/bin</outputDirectory>
+ <includes>
+ <include>*</include>
+ </includes>
+ <fileMode>0755</fileMode>
+ </fileSet>
+ -->
+ <fileSet>
+ <directory>${basedir}/src/main/resources/</directory>
+ <outputDirectory>/ambari-server-${project.version}/keystore</outputDirectory>
+ <includes>
+ <include>db/*</include>
+ <include>pass.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/../ambari-web/public</directory>
+ <outputDirectory>ambari-server-${project.version}/web</outputDirectory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/main/resources</directory>
+ <outputDirectory>/ambari-server-${project.version}/resources/</outputDirectory>
+ <includes>
+ <include>Ambari-DDL-SQLServer-*.sql</include>
+ <include>custom_action_definitions/**</include>
+ <include>custom_actions/**</include>
+ <include>scripts/**</include>
+ <include>stacks/HDPWIN/**</include>
+ <include>upgrade/**</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>ambari-server-${project.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <scope>compile</scope>
+ </dependencySet>
+ </dependencySets>
+</assembly>
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 @@
<directory>src/main/resources</directory>
<outputDirectory>/ambari-server-${project.version}/var/lib/ambari-server/resources/</outputDirectory>
<includes>
- <include>stacks/stack_advisor.py</include>
- <include>stacks/${stack.distribution}/**</include>
+ <include>stacks/HDP/**</include>
</includes>
</fileSet>
</fileSets>
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<Long> requestsToCheck = new ArrayList<Long>();
- List<Long> abortedCommandUpdates = new ArrayList<Long>();
List<HostRoleCommandEntity> 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<CommandReport> reports,
- Collection<HostRoleCommand> commands) {
+ public void processTaskResponse(String hostname, List<CommandReport> reports) {
if (reports == null) {
return;
}
List<CommandReport> reportsToProcess = new ArrayList<CommandReport>();
- Iterator<HostRoleCommand> 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();
- }
}