http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server.py new file mode 100644 index 0000000..9320bc3 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server.py @@ -0,0 +1,163 @@ +#!/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. + +""" + +from resource_management.core import Logger +from resource_management.libraries.script import Script +from resource_management.libraries.functions import conf_select +from resource_management.libraries.functions import stack_select +from resource_management.libraries.functions import StackFeature +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions.format import format +from resource_management.libraries.functions import default +from resource_management.libraries.functions.constants import Direction +from resource_management.libraries.functions.security_commons import build_expectations +from resource_management.libraries.functions.security_commons import cached_kinit_executor +from resource_management.libraries.functions.security_commons import get_params_from_filesystem +from resource_management.libraries.functions.security_commons import validate_security_config_properties +from resource_management.libraries.functions.security_commons import FILE_TYPE_XML + +from ambari_commons import OSConst +from ambari_commons.os_family_impl import OsFamilyImpl +from ambari_commons.constants import UPGRADE_TYPE_NON_ROLLING, UPGRADE_TYPE_ROLLING + +from oozie import oozie +from oozie_service import oozie_service +from oozie_server_upgrade import OozieUpgrade + +from check_oozie_server_status import check_oozie_server_status +from resource_management.core.resources.zkmigrator import ZkMigrator + +class OozieServer(Script): + + def get_component_name(self): + return "oozie-server" + + def install(self, env): + self.install_packages(env) + + def configure(self, env, upgrade_type=None): + import params + + # The configure command doesn't actually receive the upgrade_type from Script.py, so get it from the config dictionary + if upgrade_type is None: + upgrade_type = Script.get_upgrade_type(default("/commandParams/upgrade_type", "")) + + if upgrade_type is not None and params.upgrade_direction == Direction.UPGRADE and params.version is not None: + Logger.info(format("Configuring Oozie during upgrade type: {upgrade_type}, direction: {params.upgrade_direction}, and version {params.version}")) + if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version): + # In order for the "<stack-root>/current/oozie-<client/server>" point to the new version of + # oozie, we need to create the symlinks both for server and client. + # This is required as both need to be pointing to new installed oozie version. + + # Sets the symlink : eg: <stack-root>/current/oozie-client -> <stack-root>/a.b.c.d-<version>/oozie + stack_select.select("oozie-client", params.version) + # Sets the symlink : eg: <stack-root>/current/oozie-server -> <stack-root>/a.b.c.d-<version>/oozie + stack_select.select("oozie-server", params.version) + + if params.version and check_stack_feature(StackFeature.CONFIG_VERSIONING, params.version): + conf_select.select(params.stack_name, "oozie", params.version) + + env.set_params(params) + oozie(is_server=True) + + def start(self, env, upgrade_type=None): + import params + env.set_params(params) + + self.configure(env) + + # preparing the WAR file must run after configure since configure writes out + # oozie-env.sh which is needed to have the right environment directories setup! + if upgrade_type is not None: + OozieUpgrade.prepare_warfile() + + oozie_service(action='start', upgrade_type=upgrade_type) + + def stop(self, env, upgrade_type=None): + import params + env.set_params(params) + oozie_service(action='stop', upgrade_type=upgrade_type) + + + def status(self, env): + import status_params + env.set_params(status_params) + check_oozie_server_status() + + +@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) +class OozieServerDefault(OozieServer): + + def pre_upgrade_restart(self, env, upgrade_type=None): + """ + Performs the tasks that should be done before an upgrade of oozie. This includes: + - backing up configurations + - running <stack-selector-tool> and <conf-selector-tool> + - restoring configurations + - preparing the libext directory + :param env: + :return: + """ + import params + env.set_params(params) + + # this function should not execute if the version can't be determined or + # the stack does not support rolling upgrade + if not (params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version)): + return + + Logger.info("Executing Oozie Server Stack Upgrade pre-restart") + + if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version): + conf_select.select(params.stack_name, "oozie", params.version) + stack_select.select("oozie-server", params.version) + + OozieUpgrade.prepare_libext_directory() + + def disable_security(self, env): + import params + if not params.stack_supports_zk_security: + Logger.info("Stack doesn't support zookeeper security") + return + if not params.zk_connection_string: + Logger.info("No zookeeper connection string. Skipping reverting ACL") + return + zkmigrator = ZkMigrator(params.zk_connection_string, params.java_exec, params.java64_home, params.jaas_file, params.oozie_user) + zkmigrator.set_acls(params.zk_namespace if params.zk_namespace.startswith('/') else '/' + params.zk_namespace, 'world:anyone:crdwa') + + def get_log_folder(self): + import params + return params.oozie_log_dir + + def get_user(self): + import params + return params.oozie_user + + def get_pid_files(self): + import status_params + return [status_params.pid_file] + + +@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY) +class OozieServerWindows(OozieServer): + pass + +if __name__ == "__main__": + OozieServer().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py new file mode 100644 index 0000000..402c7cb --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py @@ -0,0 +1,237 @@ +""" +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 glob +import os +import shutil + +from resource_management.core.logger import Logger +from resource_management.core.exceptions import Fail +from resource_management.core.resources.system import Execute +from resource_management.core.resources.system import Directory +from resource_management.core.resources.system import File +from resource_management.libraries.functions import Direction +from resource_management.libraries.functions import format +from resource_management.libraries.functions import stack_select +from resource_management.libraries.functions.oozie_prepare_war import prepare_war +from resource_management.libraries.script.script import Script +from resource_management.libraries.functions import StackFeature +from resource_management.libraries.functions.stack_features import check_stack_feature + +import oozie + +BACKUP_TEMP_DIR = "oozie-upgrade-backup" +BACKUP_CONF_ARCHIVE = "oozie-conf-backup.tar" + +class OozieUpgrade(Script): + + @staticmethod + def prepare_libext_directory(): + """ + Performs the following actions on libext: + - creates <stack-root>/current/oozie/libext and recursively + - set 777 permissions on it and its parents. + - downloads JDBC driver JAR if needed + - copies Falcon JAR for the Oozie WAR if needed + """ + import params + + # some stack versions don't need the lzo compression libraries + target_version_needs_compression_libraries = params.version and check_stack_feature(StackFeature.LZO, params.version) + + # ensure the directory exists + Directory(params.oozie_libext_dir, mode = 0777) + + # get all hadooplzo* JAR files + # <stack-selector-tool> set hadoop-client has not run yet, therefore we cannot use + # <stack-root>/current/hadoop-client ; we must use params.version directly + # however, this only works when upgrading beyond 2.2.0.0; don't do this + # for downgrade to 2.2.0.0 since hadoop-lzo will not be present + # This can also be called during a Downgrade. + # When a version is Installed, it is responsible for downloading the hadoop-lzo packages + # if lzo is enabled. + if params.lzo_enabled and (params.upgrade_direction == Direction.UPGRADE or target_version_needs_compression_libraries): + hadoop_lzo_pattern = 'hadoop-lzo*.jar' + hadoop_client_new_lib_dir = format("{stack_root}/{version}/hadoop/lib") + + files = glob.iglob(os.path.join(hadoop_client_new_lib_dir, hadoop_lzo_pattern)) + if not files: + raise Fail("There are no files at {0} matching {1}".format( + hadoop_client_new_lib_dir, hadoop_lzo_pattern)) + + # copy files into libext + files_copied = False + for file in files: + if os.path.isfile(file): + Logger.info("Copying {0} to {1}".format(str(file), params.oozie_libext_dir)) + shutil.copy2(file, params.oozie_libext_dir) + files_copied = True + + if not files_copied: + raise Fail("There are no files at {0} matching {1}".format( + hadoop_client_new_lib_dir, hadoop_lzo_pattern)) + + # copy ext ZIP to libext dir + oozie_ext_zip_file = params.ext_js_path + + # something like <stack-root>/current/oozie-server/libext/ext-2.2.zip + oozie_ext_zip_target_path = os.path.join(params.oozie_libext_dir, params.ext_js_file) + + if not os.path.isfile(oozie_ext_zip_file): + raise Fail("Unable to copy {0} because it does not exist".format(oozie_ext_zip_file)) + + Logger.info("Copying {0} to {1}".format(oozie_ext_zip_file, params.oozie_libext_dir)) + Execute(("cp", oozie_ext_zip_file, params.oozie_libext_dir), sudo=True) + Execute(("chown", format("{oozie_user}:{user_group}"), oozie_ext_zip_target_path), sudo=True) + File(oozie_ext_zip_target_path, + mode=0644 + ) + + # Redownload jdbc driver to a new current location + oozie.download_database_library_if_needed() + + # get the upgrade version in the event that it's needed + upgrade_stack = stack_select._get_upgrade_stack() + if upgrade_stack is None or len(upgrade_stack) < 2 or upgrade_stack[1] is None: + raise Fail("Unable to determine the stack that is being upgraded to or downgraded to.") + + stack_version = upgrade_stack[1] + + # copy the Falcon JAR if needed; falcon has not upgraded yet, so we must + # use the versioned falcon directory + if params.has_falcon_host: + versioned_falcon_jar_directory = "{0}/{1}/falcon/oozie/ext/falcon-oozie-el-extension-*.jar".format(params.stack_root, stack_version) + Logger.info("Copying {0} to {1}".format(versioned_falcon_jar_directory, params.oozie_libext_dir)) + + Execute(format('{sudo} cp {versioned_falcon_jar_directory} {oozie_libext_dir}')) + Execute(format('{sudo} chown {oozie_user}:{user_group} {oozie_libext_dir}/falcon-oozie-el-extension-*.jar')) + + + @staticmethod + def prepare_warfile(): + """ + Invokes the 'prepare-war' command in Oozie in order to create the WAR. + The prepare-war command uses the input WAR from ${OOZIE_HOME}/oozie.war and + outputs the prepared WAR to ${CATALINA_BASE}/webapps/oozie.war - because of this, + both of these environment variables must point to the upgraded oozie-server path and + not oozie-client since it was not yet updated. + + This method will also perform a kinit if necessary. + :return: + """ + import params + + # get the kerberos token if necessary to execute commands as oozie + if params.security_enabled: + oozie_principal_with_host = params.oozie_principal.replace("_HOST", params.hostname) + command = format("{kinit_path_local} -kt {oozie_keytab} {oozie_principal_with_host}") + Execute(command, user=params.oozie_user, logoutput=True) + + prepare_war(params) + + + def upgrade_oozie_database_and_sharelib(self, env): + """ + Performs the creation and upload of the sharelib and the upgrade of the + database. This method will also perform a kinit if necessary. + It is run before the upgrade of oozie begins exactly once as part of the + upgrade orchestration. + + Since this runs before the upgrade has occurred, it should not use any + "current" directories since they will still be pointing to the older + version of Oozie. Instead, it should use versioned directories to ensure + that the commands running are from the oozie version about to be upgraded to. + :return: + """ + import params + env.set_params(params) + + Logger.info("Will upgrade the Oozie database") + + # get the kerberos token if necessary to execute commands as oozie + if params.security_enabled: + oozie_principal_with_host = params.oozie_principal.replace("_HOST", params.hostname) + command = format("{kinit_path_local} -kt {oozie_keytab} {oozie_principal_with_host}") + Execute(command, user=params.oozie_user, logoutput=True) + + upgrade_stack = stack_select._get_upgrade_stack() + if upgrade_stack is None or len(upgrade_stack) < 2 or upgrade_stack[1] is None: + raise Fail("Unable to determine the stack that is being upgraded to or downgraded to.") + + stack_version = upgrade_stack[1] + + # upgrade oozie DB + Logger.info(format('Upgrading the Oozie database, using version {stack_version}')) + + # the database upgrade requires the db driver JAR, but since we have + # not yet run <stack-selector-tool> to upgrade the current points, we have to use + # the versioned libext directory as the location[[-vufdtffr, + versioned_libext_dir = "{0}/{1}/oozie/libext".format(params.stack_root, stack_version) + oozie.download_database_library_if_needed(target_directory=versioned_libext_dir) + + database_upgrade_command = "{0}/{1}/oozie/bin/ooziedb.sh upgrade -run".format(params.stack_root, stack_version) + Execute(database_upgrade_command, user=params.oozie_user, logoutput=True) + + # install new sharelib to HDFS + self.create_sharelib(env) + + + def create_sharelib(self, env): + """ + Performs the creation and upload of the sharelib. + This method will also perform a kinit if necessary. + It is run before the upgrade of oozie begins exactly once as part of the + upgrade orchestration. + + Since this runs before the upgrade has occurred, it should not use any + "current" directories since they will still be pointing to the older + version of Oozie. Instead, it should use versioned directories to ensure + that the commands running are from the oozie version about to be upgraded to. + :param env: + :return: + """ + import params + env.set_params(params) + + Logger.info('Creating a new sharelib and uploading it to HDFS...') + + # ensure the oozie directory exists for the sharelib + params.HdfsResource(format("{oozie_hdfs_user_dir}/share"), + action = "create_on_execute", + type = "directory", + owner = params.oozie_user, + group = params.user_group, + mode = 0755, + recursive_chmod = True) + + params.HdfsResource(None, action = "execute") + + upgrade_stack = stack_select._get_upgrade_stack() + if upgrade_stack is None or upgrade_stack[1] is None: + raise Fail("Unable to determine the stack that is being upgraded to or downgraded to.") + + stack_version = upgrade_stack[1] + + # install new sharelib to HDFS + sharelib_command = "{0}/{1}/oozie/bin/oozie-setup.sh sharelib create -fs {2}".format( + params.stack_root, stack_version, params.fs_root) + + Execute(sharelib_command, user=params.oozie_user, logoutput=True) + +if __name__ == "__main__": + OozieUpgrade().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_service.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_service.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_service.py new file mode 100644 index 0000000..5fcbf45 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_service.py @@ -0,0 +1,188 @@ +#!/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. + +""" +# Python Imports +import os + +# Local Imports +from oozie import copy_atlas_hive_hook_to_dfs_share_lib + +# Resource Managemente Imports +from resource_management.core import shell, sudo +from resource_management.core.shell import as_user +from resource_management.core.logger import Logger +from resource_management.core.resources.service import Service +from resource_management.core.resources.system import Execute, File, Directory +from resource_management.libraries.functions.format import format +from resource_management.libraries.functions.show_logs import show_logs +from resource_management.libraries.providers.hdfs_resource import WebHDFSUtil +from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl +from ambari_commons import OSConst + +from resource_management.core import Logger + +@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY) +def oozie_service(action='start', upgrade_type=None): + import params + + if action == 'start': + cmd = format("cmd /C \"cd /d {oozie_tmp_dir} && {oozie_home}\\bin\\ooziedb.cmd create -sqlfile oozie.sql -run\"") + Execute(cmd, user=params.oozie_user, ignore_failures=True) + Service(params.oozie_server_win_service_name, action="start") + elif action == 'stop': + Service(params.oozie_server_win_service_name, action="stop") + +@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT) +def oozie_service(action = 'start', upgrade_type=None): + """ + Starts or stops the Oozie service + :param action: 'start' or 'stop' + :param upgrade_type: type of upgrade, either "rolling" or "non_rolling" + skipped since a variation of them was performed during the rolling upgrade + :return: + """ + import params + + environment={'OOZIE_CONFIG': params.conf_dir} + + if params.security_enabled: + if params.oozie_principal is None: + oozie_principal_with_host = 'missing_principal' + else: + oozie_principal_with_host = params.oozie_principal.replace("_HOST", params.hostname) + kinit_if_needed = format("{kinit_path_local} -kt {oozie_keytab} {oozie_principal_with_host};") + else: + kinit_if_needed = "" + + no_op_test = as_user(format("ls {pid_file} >/dev/null 2>&1 && ps -p `cat {pid_file}` >/dev/null 2>&1"), user=params.oozie_user) + + if action == 'start': + start_cmd = format("cd {oozie_tmp_dir} && {oozie_home}/bin/oozie-start.sh") + path_to_jdbc = params.target + + if params.jdbc_driver_name == "com.mysql.jdbc.Driver" or \ + params.jdbc_driver_name == "com.microsoft.sqlserver.jdbc.SQLServerDriver" or \ + params.jdbc_driver_name == "org.postgresql.Driver" or \ + params.jdbc_driver_name == "oracle.jdbc.driver.OracleDriver": + + if not params.jdbc_driver_jar: + path_to_jdbc = format("{oozie_libext_dir}/") + \ + params.default_connectors_map[params.jdbc_driver_name] if params.jdbc_driver_name in params.default_connectors_map else None + if not os.path.isfile(path_to_jdbc): + path_to_jdbc = format("{oozie_libext_dir}/") + "*" + error_message = "Error! Sorry, but we can't find jdbc driver with default name " + params.default_connectors_map[params.jdbc_driver_name] + \ + " in oozie lib dir. So, db connection check can fail. Please run 'ambari-server setup --jdbc-db={db_name} --jdbc-driver={path_to_jdbc} on server host.'" + Logger.error(error_message) + + db_connection_check_command = format("{java_home}/bin/java -cp {check_db_connection_jar}:{path_to_jdbc} org.apache.ambari.server.DBConnectionVerification '{oozie_jdbc_connection_url}' {oozie_metastore_user_name} {oozie_metastore_user_passwd!p} {jdbc_driver_name}") + else: + db_connection_check_command = None + + if upgrade_type is None: + if not os.path.isfile(path_to_jdbc) and params.jdbc_driver_name == "org.postgresql.Driver": + print format("ERROR: jdbc file {target} is unavailable. Please, follow next steps:\n" \ + "1) Download postgresql-9.0-801.jdbc4.jar.\n2) Create needed directory: mkdir -p {oozie_home}/libserver/\n" \ + "3) Copy postgresql-9.0-801.jdbc4.jar to newly created dir: cp /path/to/jdbc/postgresql-9.0-801.jdbc4.jar " \ + "{oozie_home}/libserver/\n4) Copy postgresql-9.0-801.jdbc4.jar to libext: cp " \ + "/path/to/jdbc/postgresql-9.0-801.jdbc4.jar {oozie_home}/libext/\n") + exit(1) + + if db_connection_check_command: + sudo.chmod(params.check_db_connection_jar, 0755) + Execute( db_connection_check_command, + tries=5, + try_sleep=10, + user=params.oozie_user, + ) + + Execute( format("cd {oozie_tmp_dir} && {oozie_home}/bin/ooziedb.sh create -sqlfile oozie.sql -run"), + user = params.oozie_user, not_if = no_op_test, + ignore_failures = True + ) + + if params.security_enabled: + Execute(kinit_if_needed, + user = params.oozie_user, + ) + + if params.sysprep_skip_copy_oozie_share_lib_to_hdfs: + Logger.info("Skipping creation of oozie sharelib as host is sys prepped") + # Copy current hive-site to hdfs:/user/oozie/share/lib/spark/ + params.HdfsResource(format("{hdfs_share_dir}/lib/spark/hive-site.xml"), + action="create_on_execute", + type = 'file', + mode=0444, + owner=params.oozie_user, + group=params.user_group, + source=format("{hive_conf_dir}/hive-site.xml"), + ) + params.HdfsResource(None, action="execute") + + hdfs_share_dir_exists = True # skip time-expensive hadoop fs -ls check + elif WebHDFSUtil.is_webhdfs_available(params.is_webhdfs_enabled, params.default_fs): + # check with webhdfs is much faster than executing hadoop fs -ls. + util = WebHDFSUtil(params.hdfs_site, params.oozie_user, params.security_enabled) + list_status = util.run_command(params.hdfs_share_dir, 'GETFILESTATUS', method='GET', ignore_status_codes=['404'], assertable_result=False) + hdfs_share_dir_exists = ('FileStatus' in list_status) + else: + # have to do time expensive hadoop fs -ls check. + hdfs_share_dir_exists = shell.call(format("{kinit_if_needed} hadoop --config {hadoop_conf_dir} dfs -ls {hdfs_share_dir} | awk 'BEGIN {{count=0;}} /share/ {{count++}} END {{if (count > 0) {{exit 0}} else {{exit 1}}}}'"), + user=params.oozie_user)[0] + + if not hdfs_share_dir_exists: + Execute( params.put_shared_lib_to_hdfs_cmd, + user = params.oozie_user, + path = params.execute_path + ) + params.HdfsResource(format("{oozie_hdfs_user_dir}/share"), + type="directory", + action="create_on_execute", + mode=0755, + recursive_chmod=True, + ) + params.HdfsResource(None, action="execute") + + + try: + # start oozie + Execute( start_cmd, environment=environment, user = params.oozie_user, + not_if = no_op_test ) + + copy_atlas_hive_hook_to_dfs_share_lib(upgrade_type, params.upgrade_direction) + except: + show_logs(params.oozie_log_dir, params.oozie_user) + raise + + elif action == 'stop': + Directory(params.oozie_tmp_dir, + owner=params.oozie_user, + create_parents = True, + ) + + stop_cmd = format("cd {oozie_tmp_dir} && {oozie_home}/bin/oozied.sh stop 60 -force") + + try: + # stop oozie + Execute(stop_cmd, environment=environment, only_if = no_op_test, + user = params.oozie_user) + except: + show_logs(params.oozie_log_dir, params.oozie_user) + raise + + File(params.pid_file, action = "delete") http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params.py new file mode 100644 index 0000000..f39d632 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params.py @@ -0,0 +1,39 @@ +#!/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. + +""" +from ambari_commons import OSCheck +from resource_management.libraries.functions.default import default +from resource_management.libraries.functions.expect import expect +from resource_management.libraries.functions.copy_tarball import get_sysprep_skip_copy_tarballs_hdfs + +if OSCheck.is_windows_family(): + from params_windows import * +else: + from params_linux import * + +java_home = config['hostLevelParams']['java_home'] +java_version = expect("/hostLevelParams/java_version", int) + + +host_sys_prepped = default("/hostLevelParams/host_sys_prepped", False) + +# By default, copy the tarballs to HDFS. If the cluster is sysprepped, then set based on the config. +sysprep_skip_copy_oozie_share_lib_to_hdfs = False +if host_sys_prepped: + sysprep_skip_copy_oozie_share_lib_to_hdfs = default("/configurations/cluster-env/sysprep_skip_copy_oozie_share_lib_to_hdfs", False) http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params_linux.py new file mode 100644 index 0000000..d30a465 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params_linux.py @@ -0,0 +1,374 @@ +#!/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. + +""" +from ambari_commons.constants import AMBARI_SUDO_BINARY +from resource_management.libraries.functions import format +from resource_management.libraries.functions import conf_select, stack_select +from resource_management.libraries.functions.constants import StackFeature +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions.default import default +from resource_management.libraries.functions import get_kinit_path +from resource_management.libraries.functions import get_port_from_url +from resource_management.libraries.functions.get_not_managed_resources import get_not_managed_resources +from resource_management.libraries.functions.setup_atlas_hook import has_atlas_in_cluster +from resource_management.libraries.script.script import Script +from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages +from resource_management.libraries.functions.expect import expect +from resource_management.libraries.resources.hdfs_resource import HdfsResource +from resource_management.libraries.functions.get_architecture import get_architecture +from resource_management.libraries.functions.stack_features import get_stack_feature_version + +from resource_management.core.utils import PasswordString +from ambari_commons.credential_store_helper import get_password_from_credential_store +from urlparse import urlparse + +import status_params +import os +import re + +# server configurations +config = Script.get_config() +tmp_dir = Script.get_tmp_dir() +sudo = AMBARI_SUDO_BINARY + +architecture = get_architecture() + + +# Needed since this writes out the Atlas Hive Hook config file. +cluster_name = config['clusterName'] + +hostname = config["hostname"] + +# New Cluster Stack Version that is defined during the RESTART of a Rolling Upgrade +version = default("/commandParams/version", None) +stack_name = status_params.stack_name +stack_name_uppercase = stack_name.upper() +upgrade_direction = default("/commandParams/upgrade_direction", None) +agent_stack_retry_on_unavailability = config['hostLevelParams']['agent_stack_retry_on_unavailability'] +agent_stack_retry_count = expect("/hostLevelParams/agent_stack_retry_count", int) + +stack_root = status_params.stack_root +stack_version_unformatted = status_params.stack_version_unformatted +stack_version_formatted = status_params.stack_version_formatted +version_for_stack_feature_checks = get_stack_feature_version(config) + +hadoop_conf_dir = conf_select.get_hadoop_conf_dir() +hadoop_bin_dir = stack_select.get_hadoop_dir("bin") +hadoop_lib_home = stack_select.get_hadoop_dir("lib") + +#spark_conf +spark_conf_dir = format("{stack_root}/current/spark-client/conf") + +#hadoop params +if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE,stack_version_formatted): + stack_version = None + upgrade_stack = stack_select._get_upgrade_stack() + if upgrade_stack is not None and len(upgrade_stack) == 2 and upgrade_stack[1] is not None: + stack_version = upgrade_stack[1] + + # oozie-server or oozie-client, depending on role + oozie_root = status_params.component_directory + + # using the correct oozie root dir, format the correct location + oozie_lib_dir = format("{stack_root}/current/{oozie_root}") + oozie_setup_sh = format("{stack_root}/current/{oozie_root}/bin/oozie-setup.sh") + oozie_webapps_dir = format("{stack_root}/current/{oozie_root}/oozie-server/webapps") + oozie_webapps_conf_dir = format("{stack_root}/current/{oozie_root}/oozie-server/conf") + oozie_libext_dir = format("{stack_root}/current/{oozie_root}/libext") + oozie_server_dir = format("{stack_root}/current/{oozie_root}/oozie-server") + oozie_shared_lib = format("{stack_root}/current/{oozie_root}/share") + oozie_home = format("{stack_root}/current/{oozie_root}") + oozie_bin_dir = format("{stack_root}/current/{oozie_root}/bin") + oozie_examples_regex = format("{stack_root}/current/{oozie_root}/doc") + + # set the falcon home for copying JARs; if in an upgrade, then use the version of falcon that + # matches the version of oozie + falcon_home = format("{stack_root}/current/falcon-client") + if stack_version is not None: + falcon_home = '{0}/{1}/falcon'.format(stack_root, stack_version) + + conf_dir = format("{stack_root}/current/{oozie_root}/conf") + hive_conf_dir = format("{conf_dir}/action-conf/hive") + +else: + oozie_lib_dir = "/var/lib/oozie" + oozie_setup_sh = "/usr/lib/oozie/bin/oozie-setup.sh" + oozie_webapps_dir = "/var/lib/oozie/oozie-server/webapps/" + oozie_webapps_conf_dir = "/var/lib/oozie/oozie-server/conf" + oozie_libext_dir = "/usr/lib/oozie/libext" + oozie_server_dir = "/var/lib/oozie/oozie-server" + oozie_shared_lib = "/usr/lib/oozie/share" + oozie_home = "/usr/lib/oozie" + oozie_bin_dir = "/usr/bin" + falcon_home = '/usr/lib/falcon' + conf_dir = "/etc/oozie/conf" + hive_conf_dir = "/etc/oozie/conf/action-conf/hive" + oozie_examples_regex = "/usr/share/doc/oozie-*" + +execute_path = oozie_bin_dir + os.pathsep + hadoop_bin_dir + +oozie_user = config['configurations']['oozie-env']['oozie_user'] +smokeuser = config['configurations']['cluster-env']['smokeuser'] +smokeuser_principal = config['configurations']['cluster-env']['smokeuser_principal_name'] +smoke_hdfs_user_mode = 0770 +service_check_queue_name = default('/configurations/yarn-env/service_check.queue.name', 'default') + +# This config actually contains {oozie_user} +oozie_admin_users = format(config['configurations']['oozie-env']['oozie_admin_users']) + +user_group = config['configurations']['cluster-env']['user_group'] +jdk_location = config['hostLevelParams']['jdk_location'] +check_db_connection_jar_name = "DBConnectionVerification.jar" +check_db_connection_jar = format("/usr/lib/ambari-agent/{check_db_connection_jar_name}") +oozie_tmp_dir = default("configurations/oozie-env/oozie_tmp_dir", "/var/tmp/oozie") +oozie_hdfs_user_dir = format("/user/{oozie_user}") +oozie_pid_dir = status_params.oozie_pid_dir +pid_file = status_params.pid_file +hadoop_jar_location = "/usr/lib/hadoop/" +java_share_dir = "/usr/share/java" +java64_home = config['hostLevelParams']['java_home'] +java_exec = format("{java64_home}/bin/java") +ext_js_file = "ext-2.2.zip" +ext_js_path = format("/usr/share/{stack_name_uppercase}-oozie/{ext_js_file}") +security_enabled = config['configurations']['cluster-env']['security_enabled'] +oozie_heapsize = config['configurations']['oozie-env']['oozie_heapsize'] +oozie_permsize = config['configurations']['oozie-env']['oozie_permsize'] + +limits_conf_dir = "/etc/security/limits.d" + +oozie_user_nofile_limit = default('/configurations/oozie-env/oozie_user_nofile_limit', 32000) +oozie_user_nproc_limit = default('/configurations/oozie-env/oozie_user_nproc_limit', 16000) + +kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None)) +oozie_service_keytab = config['configurations']['oozie-site']['oozie.service.HadoopAccessorService.keytab.file'] +oozie_principal = config['configurations']['oozie-site']['oozie.service.HadoopAccessorService.kerberos.principal'] +http_principal = config['configurations']['oozie-site']['oozie.authentication.kerberos.principal'] +oozie_site = config['configurations']['oozie-site'] +# Need this for yarn.nodemanager.recovery.dir in yarn-site +yarn_log_dir_prefix = config['configurations']['yarn-env']['yarn_log_dir_prefix'] +yarn_resourcemanager_address = config['configurations']['yarn-site']['yarn.resourcemanager.address'] +zk_namespace = default('/configurations/oozie-site/oozie.zookeeper.namespace', 'oozie') +zk_connection_string = default('/configurations/oozie-site/oozie.zookeeper.connection.string', None) +jaas_file = os.path.join(conf_dir, 'zkmigrator_jaas.conf') +stack_supports_zk_security = check_stack_feature(StackFeature.SECURE_ZOOKEEPER, version_for_stack_feature_checks) + +credential_store_enabled = False +if 'credentialStoreEnabled' in config: + credential_store_enabled = config['credentialStoreEnabled'] + +if security_enabled: + oozie_site = dict(config['configurations']['oozie-site']) + oozie_principal_with_host = oozie_principal.replace('_HOST', hostname) + + # If a user-supplied oozie.ha.authentication.kerberos.principal property exists in oozie-site, + # use it to replace the existing oozie.authentication.kerberos.principal value. This is to ensure + # that any special principal name needed for HA is used rather than the Ambari-generated value + if "oozie.ha.authentication.kerberos.principal" in oozie_site: + oozie_site['oozie.authentication.kerberos.principal'] = oozie_site['oozie.ha.authentication.kerberos.principal'] + http_principal = oozie_site['oozie.authentication.kerberos.principal'] + + # If a user-supplied oozie.ha.authentication.kerberos.keytab property exists in oozie-site, + # use it to replace the existing oozie.authentication.kerberos.keytab value. This is to ensure + # that any special keytab file needed for HA is used rather than the Ambari-generated value + if "oozie.ha.authentication.kerberos.keytab" in oozie_site: + oozie_site['oozie.authentication.kerberos.keytab'] = oozie_site['oozie.ha.authentication.kerberos.keytab'] + + if stack_version_formatted and check_stack_feature(StackFeature.OOZIE_HOST_KERBEROS, stack_version_formatted): + #older versions of oozie have problems when using _HOST in principal + oozie_site['oozie.service.HadoopAccessorService.kerberos.principal'] = oozie_principal_with_host + oozie_site['oozie.authentication.kerberos.principal'] = http_principal.replace('_HOST', hostname) + +smokeuser_keytab = config['configurations']['cluster-env']['smokeuser_keytab'] +oozie_keytab = default("/configurations/oozie-env/oozie_keytab", oozie_service_keytab) +oozie_env_sh_template = config['configurations']['oozie-env']['content'] + +oracle_driver_jar_name = "ojdbc6.jar" + +oozie_metastore_user_name = config['configurations']['oozie-site']['oozie.service.JPAService.jdbc.username'] + +if credential_store_enabled: + if 'hadoop.security.credential.provider.path' in config['configurations']['oozie-site']: + cs_lib_path = config['configurations']['oozie-site']['credentialStoreClassPath'] + java_home = config['hostLevelParams']['java_home'] + alias = 'oozie.service.JPAService.jdbc.password' + provider_path = config['configurations']['oozie-site']['hadoop.security.credential.provider.path'] + oozie_metastore_user_passwd = PasswordString(get_password_from_credential_store(alias, provider_path, cs_lib_path, java_home, jdk_location)) + else: + raise Exception("hadoop.security.credential.provider.path property should be set") +else: + oozie_metastore_user_passwd = default("/configurations/oozie-site/oozie.service.JPAService.jdbc.password","") + +oozie_jdbc_connection_url = default("/configurations/oozie-site/oozie.service.JPAService.jdbc.url", "") +oozie_log_dir = config['configurations']['oozie-env']['oozie_log_dir'] +oozie_data_dir = config['configurations']['oozie-env']['oozie_data_dir'] +oozie_server_port = get_port_from_url(config['configurations']['oozie-site']['oozie.base.url']) +oozie_server_admin_port = config['configurations']['oozie-env']['oozie_admin_port'] +if 'export OOZIE_HTTPS_PORT' in oozie_env_sh_template or 'oozie.https.port' in config['configurations']['oozie-site'] or 'oozie.https.keystore.file' in config['configurations']['oozie-site'] or 'oozie.https.keystore.pass' in config['configurations']['oozie-site']: + oozie_secure = '-secure' +else: + oozie_secure = '' + +https_port = None +# try to get https port form oozie-env content +for line in oozie_env_sh_template.splitlines(): + result = re.match(r"export\s+OOZIE_HTTPS_PORT=(\d+)", line) + if result is not None: + https_port = result.group(1) +# or from oozie-site.xml +if https_port is None and 'oozie.https.port' in config['configurations']['oozie-site']: + https_port = config['configurations']['oozie-site']['oozie.https.port'] + +oozie_base_url = config['configurations']['oozie-site']['oozie.base.url'] + +service_check_job_name = default("/configurations/oozie-env/service_check_job_name", "no-op") + +# construct proper url for https +if https_port is not None: + parsed_url = urlparse(oozie_base_url) + oozie_base_url = oozie_base_url.replace(parsed_url.scheme, "https") + if parsed_url.port is None: + oozie_base_url.replace(parsed_url.hostname, ":".join([parsed_url.hostname, str(https_port)])) + else: + oozie_base_url = oozie_base_url.replace(str(parsed_url.port), str(https_port)) + +oozie_setup_sh_current = oozie_setup_sh + +hdfs_site = config['configurations']['hdfs-site'] +fs_root = config['configurations']['core-site']['fs.defaultFS'] + +if stack_version_formatted and check_stack_feature(StackFeature.OOZIE_SETUP_SHARED_LIB, stack_version_formatted): + put_shared_lib_to_hdfs_cmd = format("{oozie_setup_sh} sharelib create -fs {fs_root} -locallib {oozie_shared_lib}") + # for older +else: + put_shared_lib_to_hdfs_cmd = format("hadoop --config {hadoop_conf_dir} dfs -put {oozie_shared_lib} {oozie_hdfs_user_dir}") + +default_connectors_map = { "com.microsoft.sqlserver.jdbc.SQLServerDriver":"sqljdbc4.jar", + "com.mysql.jdbc.Driver":"mysql-connector-java.jar", + "org.postgresql.Driver":"postgresql-jdbc.jar", + "oracle.jdbc.driver.OracleDriver":"ojdbc.jar", + "sap.jdbc4.sqlanywhere.IDriver":"sajdbc4.jar"} + +jdbc_driver_name = default("/configurations/oozie-site/oozie.service.JPAService.jdbc.driver", "") +# NOT SURE THAT IT'S A GOOD IDEA TO USE PATH TO CLASS IN DRIVER, MAYBE IT WILL BE BETTER TO USE DB TYPE. +# BECAUSE PATH TO CLASSES COULD BE CHANGED +sqla_db_used = False +previous_jdbc_jar_name = None +if jdbc_driver_name == "com.microsoft.sqlserver.jdbc.SQLServerDriver": + jdbc_driver_jar = default("/hostLevelParams/custom_mssql_jdbc_name", None) + previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_mssql_jdbc_name", None) +elif jdbc_driver_name == "com.mysql.jdbc.Driver": + jdbc_driver_jar = default("/hostLevelParams/custom_mysql_jdbc_name", None) + previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_mysql_jdbc_name", None) +elif jdbc_driver_name == "org.postgresql.Driver": + jdbc_driver_jar = format("{oozie_home}/libserver/postgresql-9.0-801.jdbc4.jar") #oozie using it's own postgres jdbc + previous_jdbc_jar_name = None +elif jdbc_driver_name == "oracle.jdbc.driver.OracleDriver": + jdbc_driver_jar = default("/hostLevelParams/custom_oracle_jdbc_name", None) + previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_oracle_jdbc_name", None) +elif jdbc_driver_name == "sap.jdbc4.sqlanywhere.IDriver": + jdbc_driver_jar = default("/hostLevelParams/custom_sqlanywhere_jdbc_name", None) + previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_sqlanywhere_jdbc_name", None) + sqla_db_used = True +else: + jdbc_driver_jar = "" + jdbc_symlink_name = "" + previous_jdbc_jar_name = None + +default("/hostLevelParams/custom_sqlanywhere_jdbc_name", None) +driver_curl_source = format("{jdk_location}/{jdbc_driver_jar}") +downloaded_custom_connector = format("{tmp_dir}/{jdbc_driver_jar}") +if jdbc_driver_name == "org.postgresql.Driver": + target = jdbc_driver_jar + previous_jdbc_jar = None +else: + target = format("{oozie_libext_dir}/{jdbc_driver_jar}") + previous_jdbc_jar = format("{oozie_libext_dir}/{previous_jdbc_jar_name}") + +#constants for type2 jdbc +jdbc_libs_dir = format("{oozie_libext_dir}/native/lib64") +lib_dir_available = os.path.exists(jdbc_libs_dir) + +if sqla_db_used: + jars_path_in_archive = format("{tmp_dir}/sqla-client-jdbc/java/*") + libs_path_in_archive = format("{tmp_dir}/sqla-client-jdbc/native/lib64/*") + downloaded_custom_connector = format("{tmp_dir}/{jdbc_driver_jar}") + +hdfs_share_dir = format("{oozie_hdfs_user_dir}/share") +ambari_server_hostname = config['clusterHostInfo']['ambari_server_host'][0] +falcon_host = default("/clusterHostInfo/falcon_server_hosts", []) +has_falcon_host = not len(falcon_host) == 0 + +oozie_server_hostnames = default("/clusterHostInfo/oozie_server", []) +oozie_server_hostnames = sorted(oozie_server_hostnames) + +oozie_log_maxhistory = default('configurations/oozie-log4j/oozie_log_maxhistory',720) + +#oozie-log4j.properties +if (('oozie-log4j' in config['configurations']) and ('content' in config['configurations']['oozie-log4j'])): + log4j_props = config['configurations']['oozie-log4j']['content'] +else: + log4j_props = None + +oozie_hdfs_user_mode = 0775 +hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab'] +hdfs_user = config['configurations']['hadoop-env']['hdfs_user'] +hdfs_principal_name = config['configurations']['hadoop-env']['hdfs_principal_name'] + +hdfs_site = config['configurations']['hdfs-site'] +default_fs = config['configurations']['core-site']['fs.defaultFS'] + +dfs_type = default("/commandParams/dfs_type", "") + + +######################################################## +############# Atlas related params ##################### +######################################################## +#region Atlas Hooks needed by Hive on Oozie +hive_atlas_application_properties = default('/configurations/hive-atlas-application.properties', {}) + +if has_atlas_in_cluster(): + atlas_hook_filename = default('/configurations/atlas-env/metadata_conf_file', 'atlas-application.properties') +#endregion + +import functools +#create partial functions with common arguments for every HdfsResource call +#to create/delete hdfs directory/file/copyfromlocal we need to call params.HdfsResource in code +HdfsResource = functools.partial( + HdfsResource, + user=hdfs_user, + hdfs_resource_ignore_file = "/var/lib/ambari-agent/data/.hdfs_resource_ignore", + security_enabled = security_enabled, + keytab = hdfs_user_keytab, + kinit_path_local = kinit_path_local, + hadoop_bin_dir = hadoop_bin_dir, + hadoop_conf_dir = hadoop_conf_dir, + principal_name = hdfs_principal_name, + hdfs_site = hdfs_site, + default_fs = default_fs, + immutable_paths = get_not_managed_resources(), + dfs_type = dfs_type +) + +is_webhdfs_enabled = config['configurations']['hdfs-site']['dfs.webhdfs.enabled'] + +# The logic for LZO also exists in HDFS' params.py +io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None) +lzo_enabled = io_compression_codecs is not None and "com.hadoop.compression.lzo" in io_compression_codecs.lower() + +all_lzo_packages = get_lzo_packages(stack_version_unformatted) http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params_windows.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params_windows.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params_windows.py new file mode 100644 index 0000000..1f939d4 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/params_windows.py @@ -0,0 +1,34 @@ +""" +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. + +""" + +from resource_management.libraries.script.script import Script +import os +from status_params import * + +config = Script.get_config() + +hadoop_user = config["configurations"]["cluster-env"]["hadoop.user.name"] +stack_root = os.path.abspath(os.path.join(os.environ["HADOOP_HOME"], "..")) +oozie_root = os.environ['OOZIE_ROOT'] +oozie_home = os.environ['OOZIE_HOME'] +oozie_conf_dir = os.path.join(oozie_home,'conf') +oozie_user = hadoop_user +oozie_tmp_dir = "c:\\hadoop\\temp\\oozie" + +oozie_env_cmd_template = config['configurations']['oozie-env']['content'] http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/service_check.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/service_check.py new file mode 100644 index 0000000..ae7cb21 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/service_check.py @@ -0,0 +1,140 @@ +#!/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 os +import glob + +from resource_management.core.resources.system import Execute +from resource_management.core.resources import File +from resource_management.core.source import StaticFile +from resource_management.core.system import System +from resource_management.libraries.functions import format +from resource_management.libraries.script import Script +from ambari_commons.os_family_impl import OsFamilyImpl +from ambari_commons import OSConst + +from resource_management.core.logger import Logger + +NO_DOCS_FOLDER_MESSAGE = "Cannot find {oozie_examples_regex}. Possible reason is that /etc/yum.conf contains" \ +" tsflags=nodocs which prevents this folder from being installed along with oozie-client package." \ +" If this is the case, please fix /etc/yum.conf and re-install the package." + +class OozieServiceCheck(Script): + pass + +@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) +class OozieServiceCheckDefault(OozieServiceCheck): + + def service_check(self, env): + import params + env.set_params(params) + + # on HDP1 this file is different + prepare_hdfs_file_name = 'prepareOozieHdfsDirectories.sh' + smoke_test_file_name = 'oozieSmoke2.sh' + + OozieServiceCheckDefault.oozie_smoke_shell_file(smoke_test_file_name, prepare_hdfs_file_name) + + @staticmethod + def oozie_smoke_shell_file(file_name, prepare_hdfs_file_name): + import params + + File(format("{tmp_dir}/{file_name}"), + content=StaticFile(file_name), + mode=0755 + ) + File(format("{tmp_dir}/{prepare_hdfs_file_name}"), + content=StaticFile(prepare_hdfs_file_name), + mode=0755 + ) + + os_family = System.get_instance().os_family + oozie_examples_dir_regex_matches = glob.glob(params.oozie_examples_regex) + if not oozie_examples_dir_regex_matches: + raise Fail(format(NO_DOCS_FOLDER_MESSAGE)) + oozie_examples_dir = oozie_examples_dir_regex_matches[0] + + Execute((format("{tmp_dir}/{prepare_hdfs_file_name}"), params.conf_dir, oozie_examples_dir, params.hadoop_conf_dir, params.yarn_resourcemanager_address, params.fs_root, params.service_check_queue_name, params.service_check_job_name), + tries=3, + try_sleep=5, + logoutput=True + ) + + params.HdfsResource(format("/user/{smokeuser}"), + type="directory", + action="create_on_execute", + owner=params.smokeuser, + mode=params.smoke_hdfs_user_mode, + ) + + examples_dir = format('/user/{smokeuser}/examples') + params.HdfsResource(examples_dir, + action = "delete_on_execute", + type = "directory" + ) + params.HdfsResource(examples_dir, + action = "create_on_execute", + type = "directory", + source = format("{oozie_examples_dir}/examples"), + owner = params.smokeuser, + group = params.user_group + ) + + input_data_dir = format('/user/{smokeuser}/input-data') + params.HdfsResource(input_data_dir, + action = "delete_on_execute", + type = "directory" + ) + params.HdfsResource(input_data_dir, + action = "create_on_execute", + type = "directory", + source = format("{oozie_examples_dir}/examples/input-data"), + owner = params.smokeuser, + group = params.user_group + ) + params.HdfsResource(None, action="execute") + + if params.security_enabled: + sh_cmd = format( + "{tmp_dir}/{file_name} {os_family} {oozie_lib_dir} {conf_dir} {oozie_bin_dir} {oozie_base_url} {oozie_examples_dir} {hadoop_conf_dir} {hadoop_bin_dir} {smokeuser} {service_check_job_name} {security_enabled} {smokeuser_keytab} {kinit_path_local} {smokeuser_principal}") + else: + sh_cmd = format( + "{tmp_dir}/{file_name} {os_family} {oozie_lib_dir} {conf_dir} {oozie_bin_dir} {oozie_base_url} {oozie_examples_dir} {hadoop_conf_dir} {hadoop_bin_dir} {smokeuser} {service_check_job_name} {security_enabled}") + + Execute(sh_cmd, + path=params.execute_path, + tries=3, + try_sleep=5, + logoutput=True + ) + +@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY) +class OozieServiceCheckWindows(OozieServiceCheck): + + def service_check(self, env): + import params + + env.set_params(params) + smoke_cmd = os.path.join(params.stack_root, "Run-SmokeTests.cmd") + service = "OOZIE" + Execute(format("cmd /C {smoke_cmd} {service}"), logoutput=True) + +if __name__ == "__main__": + OozieServiceCheck().execute() + http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/status_params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/status_params.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/status_params.py new file mode 100644 index 0000000..ce990cf --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/status_params.py @@ -0,0 +1,65 @@ +#!/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. + +""" + +from ambari_commons.os_check import OSCheck +from resource_management.libraries.functions import format +from resource_management.libraries.functions.default import default +from resource_management.libraries.functions import get_kinit_path +from resource_management.libraries.script.script import Script +from resource_management.libraries.functions import StackFeature +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions.version import format_stack_version + +# a map of the Ambari role to the component name +# for use with <stack-root>/current/<component> +SERVER_ROLE_DIRECTORY_MAP = { + 'OOZIE_SERVER' : 'oozie-server', + 'OOZIE_CLIENT' : 'oozie-client', + 'OOZIE_SERVICE_CHECK' : 'oozie-client', + 'ru_execute_tasks' : 'oozie-server' +} + +component_directory = Script.get_component_from_role(SERVER_ROLE_DIRECTORY_MAP, "OOZIE_CLIENT") + +config = Script.get_config() +stack_root = Script.get_stack_root() + +stack_version_unformatted = config['hostLevelParams']['stack_version'] +stack_version_formatted = format_stack_version(stack_version_unformatted) + +if OSCheck.is_windows_family(): + # windows service mapping + oozie_server_win_service_name = "oozieservice" +else: + oozie_pid_dir = config['configurations']['oozie-env']['oozie_pid_dir'] + pid_file = format("{oozie_pid_dir}/oozie.pid") + + security_enabled = config['configurations']['cluster-env']['security_enabled'] + kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None)) + + conf_dir = "/etc/oozie/conf" + if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted): + conf_dir = format("{stack_root}/current/{component_directory}/conf") + + tmp_dir = Script.get_tmp_dir() + oozie_user = config['configurations']['oozie-env']['oozie_user'] + hostname = config["hostname"] + +stack_name = default("/hostLevelParams/stack_name", None) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/adminusers.txt.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/adminusers.txt.j2 b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/adminusers.txt.j2 new file mode 100644 index 0000000..2a0f7b2 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/adminusers.txt.j2 @@ -0,0 +1,28 @@ +# +# 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. +# + +# Users should be set using following rules: +# +# One user name per line +# Empty lines and lines starting with '#' are ignored + +{% if oozie_admin_users %} +{% for oozie_admin_user in oozie_admin_users.split(',') %} +{{oozie_admin_user|trim}} +{% endfor %} +{% endif %} http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/input.config-oozie.json.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/input.config-oozie.json.j2 b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/input.config-oozie.json.j2 new file mode 100644 index 0000000..4a54f74 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/input.config-oozie.json.j2 @@ -0,0 +1,48 @@ +{# + # 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. + #} +{ + "input":[ + { + "type":"oozie_app", + "rowtype":"service", + "path":"{{default('/configurations/oozie-env/oozie_log_dir', '/var/log/oozie')}}/oozie.log" + } + ], + "filter":[ + { + "filter":"grok", + "conditions":{ + "fields":{ + "type":[ + "oozie_app" + ] + } + }, + "log4j_format":"%d{ISO8601} %5p %c{1}:%L - SERVER[${oozie.instance.id}] %m%n", + "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})", + "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{DATA:logger_name}:%{INT:line_number}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}", + "post_map_values":{ + "logtime":{ + "map_date":{ + "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS" + } + } + } + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/oozie-log4j.properties.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/oozie-log4j.properties.j2 b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/oozie-log4j.properties.j2 new file mode 100644 index 0000000..e39428f --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/oozie-log4j.properties.j2 @@ -0,0 +1,93 @@ +{# +# 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. +#} + +# +# 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. +# + +# 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. See accompanying LICENSE file. +# + +# If the Java System property 'oozie.log.dir' is not defined at Oozie start up time +# XLogService sets its value to '${oozie.home}/logs' + +log4j.appender.oozie=org.apache.log4j.DailyRollingFileAppender +log4j.appender.oozie.File=${oozie.log.dir}/oozie.log +log4j.appender.oozie.Append=true +log4j.appender.oozie.layout=org.apache.log4j.PatternLayout +log4j.appender.oozie.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - SERVER[${oozie.instance.id}] %m%n +log4j.appender.oozie.RollingPolicy.FileNamePattern=${log4j.appender.oozie.File}-%d{yyyy-MM-dd} +log4j.appender.oozie.DatePattern='.'yyyy-MM-dd + +log4j.appender.oozieops=org.apache.log4j.DailyRollingFileAppender +log4j.appender.oozieops.DatePattern='.'yyyy-MM-dd +log4j.appender.oozieops.File=${oozie.log.dir}/oozie-ops.log +log4j.appender.oozieops.Append=true +log4j.appender.oozieops.layout=org.apache.log4j.PatternLayout +log4j.appender.oozieops.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - %m%n + +log4j.appender.oozieinstrumentation=org.apache.log4j.DailyRollingFileAppender +log4j.appender.oozieinstrumentation.DatePattern='.'yyyy-MM-dd +log4j.appender.oozieinstrumentation.File=${oozie.log.dir}/oozie-instrumentation.log +log4j.appender.oozieinstrumentation.Append=true +log4j.appender.oozieinstrumentation.layout=org.apache.log4j.PatternLayout +log4j.appender.oozieinstrumentation.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - %m%n + +log4j.appender.oozieaudit=org.apache.log4j.DailyRollingFileAppender +log4j.appender.oozieaudit.DatePattern='.'yyyy-MM-dd +log4j.appender.oozieaudit.File=${oozie.log.dir}/oozie-audit.log +log4j.appender.oozieaudit.Append=true +log4j.appender.oozieaudit.layout=org.apache.log4j.PatternLayout +log4j.appender.oozieaudit.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - %m%n + +log4j.appender.openjpa=org.apache.log4j.DailyRollingFileAppender +log4j.appender.openjpa.DatePattern='.'yyyy-MM-dd +log4j.appender.openjpa.File=${oozie.log.dir}/oozie-jpa.log +log4j.appender.openjpa.Append=true +log4j.appender.openjpa.layout=org.apache.log4j.PatternLayout +log4j.appender.openjpa.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - %m%n + +log4j.logger.openjpa=INFO, openjpa +log4j.logger.oozieops=INFO, oozieops +log4j.logger.oozieinstrumentation=ALL, oozieinstrumentation +log4j.logger.oozieaudit=ALL, oozieaudit +log4j.logger.org.apache.oozie=INFO, oozie +log4j.logger.org.apache.hadoop=WARN, oozie +log4j.logger.org.mortbay=WARN, oozie +log4j.logger.org.hsqldb=WARN, oozie +log4j.logger.org.apache.hadoop.security.authentication.server=INFO, oozie http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/oozie.conf.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/oozie.conf.j2 b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/oozie.conf.j2 new file mode 100644 index 0000000..1f99e49 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/oozie.conf.j2 @@ -0,0 +1,35 @@ +{# +# 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. +#} + +# 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. + +{{oozie_user}} - nofile {{oozie_user_nofile_limit}} +{{oozie_user}} - nproc {{oozie_user_nproc_limit}} http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/zkmigrator_jaas.conf.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/zkmigrator_jaas.conf.j2 b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/zkmigrator_jaas.conf.j2 new file mode 100644 index 0000000..fbc0ce5 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/templates/zkmigrator_jaas.conf.j2 @@ -0,0 +1,26 @@ +{# +# 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. +#} + +Client { + com.sun.security.auth.module.Krb5LoginModule required + useKeyTab=true + storeKey=true + useTicketCache=false + keyTab="{{oozie_keytab}}" + principal="{{oozie_principal_with_host}}"; +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/quicklinks/quicklinks.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/quicklinks/quicklinks.json b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/quicklinks/quicklinks.json new file mode 100644 index 0000000..81e7cbe --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/quicklinks/quicklinks.json @@ -0,0 +1,45 @@ +{ + "name": "default", + "description": "default quick links configuration", + "configuration": { + "protocol": + { + "type":"https", + "checks":[ + { + "property":"oozie.https.port", + "desired":"EXISTS", + "site":"oozie-site" + }, + { + "property":"oozie.https.keystore.file", + "desired":"EXISTS", + "site":"oozie-site" + }, + { + "property":"oozie.https.keystore.pass", + "desired":"EXISTS", + "site":"oozie-site" + } + ] + }, + + "links": [ + { + "name": "oozie_server_ui", + "component_name": "OOZIE_SERVER", + "label": "Oozie Web UI", + "requires_user_name": "true", + "url":"%@://%@:%@/oozie?user.name=%@", + "port":{ + "http_property": "oozie.base.url", + "http_default_port": "11000", + "https_property": "oozie.base.url", + "https_default_port": "11443", + "regex": "\\w*:(\\d+)", + "site": "oozie-site" + } + } + ] + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/role_command_order.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/role_command_order.json b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/role_command_order.json new file mode 100644 index 0000000..769e917 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/role_command_order.json @@ -0,0 +1,9 @@ +{ + "general_deps" : { + "_comment" : "dependencies for OOZIE", + "OOZIE_SERVER-START": ["NODEMANAGER-START", "RESOURCEMANAGER-START"], + "OOZIE_SERVER-RESTART": ["NAMENODE-RESTART"], + "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START", "MAPREDUCE2_SERVICE_CHECK-SERVICE_CHECK"] + + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/themes/theme.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/themes/theme.json b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/themes/theme.json new file mode 100644 index 0000000..5f325f7 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/themes/theme.json @@ -0,0 +1,116 @@ +{ + "name": "default", + "description": "Default theme for Oozie service", + "configuration": { + "layouts": [ + { + "name": "default", + "tabs": [ + { + "name": "oozie-database", + "display-name": "Database", + "layout": { + "tab-rows": 1, + "tab-columns": 1, + "sections": [ + { + "name": "oozie-database-configurations", + "display-name": "Database Configurations", + "row-index": "0", + "column-index": "0", + "row-span": "0", + "column-span": "0", + "section-columns": "2", + "section-rows": "1", + "subsections": [ + { + "name": "oozie-database-configurations-col-1", + "row-index": "0", + "column-index": "0", + "row-span": "1", + "column-span": "1" + }, + { + "name": "oozie-database-configurations-col-2", + "row-index": "0", + "column-index": "1", + "row-span": "1", + "column-span": "1" + } + ] + } + ] + } + } + ] + } + ], + "placement": { + "configuration-layout": "default", + "configs": [ + { + "config": "oozie-env/oozie_database", + "subsection-name": "oozie-database-configurations-col-1" + }, + { + "config": "oozie-site/oozie.db.schema.name", + "subsection-name": "oozie-database-configurations-col-1" + }, + { + "config": "oozie-site/oozie.service.JPAService.jdbc.username", + "subsection-name": "oozie-database-configurations-col-1" + }, + { + "config": "oozie-site/oozie.service.JPAService.jdbc.url", + "subsection-name": "oozie-database-configurations-col-1" + }, + { + "config": "oozie-site/oozie.service.JPAService.jdbc.driver", + "subsection-name": "oozie-database-configurations-col-2" + }, + { + "config": "oozie-site/oozie.service.JPAService.jdbc.password", + "subsection-name": "oozie-database-configurations-col-2" + } + ] + }, + "widgets": [ + { + "config": "oozie-env/oozie_database", + "widget": { + "type": "combo" + } + }, + { + "config": "oozie-site/oozie.service.JPAService.jdbc.username", + "widget": { + "type": "text-field" + } + }, + { + "config": "oozie-site/oozie.service.JPAService.jdbc.password", + "widget": { + "type": "password" + } + }, + { + "config": "oozie-site/oozie.service.JPAService.jdbc.driver", + "widget": { + "type": "text-field" + } + }, + { + "config": "oozie-site/oozie.service.JPAService.jdbc.url", + "widget": { + "type": "text-field" + } + }, + { + "config": "oozie-site/oozie.db.schema.name", + "widget": { + "type": "text-field" + } + } + ] + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/cdc18ecb/ambari-server/src/main/resources/stacks/HDP/3.0/services/OOZIE/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/services/OOZIE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/3.0/services/OOZIE/metainfo.xml new file mode 100644 index 0000000..e1c73f1 --- /dev/null +++ b/ambari-server/src/main/resources/stacks/HDP/3.0/services/OOZIE/metainfo.xml @@ -0,0 +1,27 @@ +<?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. +--> +<metainfo> + <schemaVersion>2.0</schemaVersion> + <services> + <service> + <name>OOZIE</name> + <version>4.2.0.3.0</version> + <extends>common-services/OOZIE/4.2.0.3.0</extends> + </service> + </services> +</metainfo>