You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2016/12/05 20:23:12 UTC
[03/14] ambari git commit: AMBARI-19007 Atlas to support
configuration of hooks from separate cluster (mugdha)
AMBARI-19007 Atlas to support configuration of hooks from separate cluster (mugdha)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8ad494e9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8ad494e9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8ad494e9
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 8ad494e97302d5da69224c7ce9e493d5f20797c1
Parents: 12a3cd8
Author: Mugdha Varadkar <mu...@apache.org>
Authored: Fri Dec 2 18:15:39 2016 +0530
Committer: Mugdha Varadkar <mu...@apache.org>
Committed: Mon Dec 5 10:13:09 2016 +0530
----------------------------------------------------------------------
.../libraries/functions/setup_atlas_hook.py | 47 +++++-----
.../BlueprintConfigurationProcessor.java | 3 +-
.../server/upgrade/UpgradeCatalog250.java | 30 +++++++
.../0.5.0.2.1/configuration/falcon-env.xml | 17 ++++
.../FALCON/0.5.0.2.1/package/scripts/falcon.py | 2 +-
.../0.5.0.2.1/package/scripts/params_linux.py | 5 +-
.../HIVE/0.12.0.2.0/configuration/hive-env.xml | 17 ++++
.../HIVE/0.12.0.2.0/package/scripts/hcat.py | 2 +-
.../HIVE/0.12.0.2.0/package/scripts/hive.py | 2 +-
.../0.12.0.2.0/package/scripts/params_linux.py | 5 +-
.../HIVE/0.12.0.2.0/package/scripts/webhcat.py | 2 +-
.../SQOOP/1.4.4.2.0/configuration/sqoop-env.xml | 17 ++++
.../1.4.4.2.0/configuration/sqoop-site.xml | 6 ++
.../1.4.4.2.0/package/scripts/params_linux.py | 5 +-
.../SQOOP/1.4.4.2.0/package/scripts/sqoop.py | 2 +-
.../STORM/0.10.0/configuration/storm-env.xml | 17 ++++
.../STORM/0.9.1/package/scripts/params_linux.py | 6 +-
.../STORM/0.9.1/package/scripts/storm.py | 2 +-
.../services/HIVE/configuration/hive-site.xml | 4 +
.../services/STORM/configuration/storm-site.xml | 4 +
.../stacks/HDP/2.3/services/stack_advisor.py | 57 +++++++++++-
.../stacks/HDP/2.5/services/stack_advisor.py | 6 --
.../BlueprintConfigurationProcessorTest.java | 11 +++
.../server/upgrade/UpgradeCatalog250Test.java | 93 ++++++++++++++++++++
.../stacks/2.3/common/test_stack_advisor.py | 28 +++++-
25 files changed, 339 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-common/src/main/python/resource_management/libraries/functions/setup_atlas_hook.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/setup_atlas_hook.py b/ambari-common/src/main/python/resource_management/libraries/functions/setup_atlas_hook.py
index a1d2f95..eeae4bc 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/setup_atlas_hook.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/setup_atlas_hook.py
@@ -117,6 +117,8 @@ def setup_atlas_hook(service_name, service_props, atlas_hook_filepath, owner, gr
"""
import params
atlas_props = default('/configurations/application-properties', {})
+ merged_props = {}
+ merged_props.update(service_props)
if has_atlas_in_cluster():
# Take the subset
@@ -131,12 +133,12 @@ def setup_atlas_hook(service_name, service_props, atlas_hook_filepath, owner, gr
merged_props.update(service_props)
- Logger.info(format("Generating Atlas Hook config file {atlas_hook_filepath}"))
- PropertiesFile(atlas_hook_filepath,
- properties = merged_props,
- owner = owner,
- group = group,
- mode = 0644)
+ Logger.info(format("Generating Atlas Hook config file {atlas_hook_filepath}"))
+ PropertiesFile(atlas_hook_filepath,
+ properties = merged_props,
+ owner = owner,
+ group = group,
+ mode = 0644)
def setup_atlas_jar_symlinks(hook_name, jar_source_dir):
@@ -157,22 +159,23 @@ def setup_atlas_jar_symlinks(hook_name, jar_source_dir):
"""
import params
- if has_atlas_in_cluster():
- atlas_home_dir = os.environ['METADATA_HOME_DIR'] if 'METADATA_HOME_DIR' in os.environ \
- else format("{stack_root}/current/atlas-server")
-
- # Will only exist if this host contains Atlas Server
- atlas_hook_dir = os.path.join(atlas_home_dir, "hook", hook_name)
- if os.path.exists(atlas_hook_dir):
- Logger.info("Atlas Server is present on this host, will symlink jars inside of %s to %s if not already done." %
- (jar_source_dir, atlas_hook_dir))
-
- src_files = os.listdir(atlas_hook_dir)
- for file_name in src_files:
- atlas_hook_file_name = os.path.join(atlas_hook_dir, file_name)
- source_lib_file_name = os.path.join(jar_source_dir, file_name)
- if os.path.isfile(atlas_hook_file_name):
- Link(source_lib_file_name, to=atlas_hook_file_name)
+ atlas_home_dir = os.environ['METADATA_HOME_DIR'] if 'METADATA_HOME_DIR' in os.environ \
+ else format("{stack_root}/current/atlas-server")
+
+ # Will only exist if this host contains Atlas Server
+ atlas_hook_dir = os.path.join(atlas_home_dir, "hook", hook_name)
+ if os.path.exists(atlas_hook_dir):
+ Logger.info("Atlas Server is present on this host, will symlink jars inside of %s to %s if not already done." %
+ (jar_source_dir, atlas_hook_dir))
+
+ src_files = os.listdir(atlas_hook_dir)
+ for file_name in src_files:
+ atlas_hook_file_name = os.path.join(atlas_hook_dir, file_name)
+ source_lib_file_name = os.path.join(jar_source_dir, file_name)
+ if os.path.isfile(atlas_hook_file_name):
+ Link(source_lib_file_name, to=atlas_hook_file_name)
+ else:
+ Logger.info("Atlas hook directory path {0} doesn't exist".format(atlas_hook_dir))
def install_atlas_hook_packages(atlas_plugin_package, atlas_ubuntu_plugin_package, host_sys_prepped,
agent_stack_retry_on_unavailability, agent_stack_retry_count):
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index f890326..737e8de 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -2523,9 +2523,10 @@ public class BlueprintConfigurationProcessor {
}
boolean isAtlasInCluster = topology.getBlueprint().getServices().contains("ATLAS");
+ boolean isAtlasHiveHookEnabled = Boolean.parseBoolean(properties.get("hive-env").get("hive.atlas.hook"));
// Append atlas hook if not already present.
- if (isAtlasInCluster) {
+ if (isAtlasInCluster || isAtlasHiveHookEnabled) {
if (!hiveHooksClean.contains(atlasHookClass)) {
hiveHooksClean.add(atlasHookClass);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
index 837f340..ff1663e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
@@ -137,6 +137,7 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
updateKafkaConfigs();
updateHiveLlapConfigs();
updateTablesForZeppelinViewRemoval();
+ updateAtlasConfigs();
}
protected void updateHostVersionTable() throws SQLException {
@@ -326,5 +327,34 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
dbAccessor.addColumn(SERVICE_DESIRED_STATE_TABLE,
new DBColumnInfo(CREDENTIAL_STORE_ENABLED_COL, Short.class, null, 0, false));
}
+
+ protected void updateAtlasConfigs() throws AmbariException {
+ AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class);
+ Clusters clusters = ambariManagementController.getClusters();
+ if (clusters != null) {
+ Map<String, Cluster> clusterMap = clusters.getClusters();
+ if (clusterMap != null && !clusterMap.isEmpty()) {
+ for (final Cluster cluster : clusterMap.values()) {
+ updateAtlasHookConfig(cluster, "HIVE", "hive-env", "hive.atlas.hook");
+ updateAtlasHookConfig(cluster, "STORM", "storm-env", "storm.atlas.hook");
+ updateAtlasHookConfig(cluster, "FALCON", "falcon-env", "falcon.atlas.hook");
+ updateAtlasHookConfig(cluster, "SQOOP", "sqoop-env", "sqoop.atlas.hook");
+ }
+ }
+ }
+ }
+
+ protected void updateAtlasHookConfig(Cluster cluster, String serviceName, String configType, String propertyName) throws AmbariException {
+ Set<String> installedServices = cluster.getServices().keySet();
+ if (installedServices.contains("ATLAS") && installedServices.contains(serviceName)) {
+ Config configEnv = cluster.getDesiredConfigByType(configType);
+ if (configEnv != null) {
+ Map<String, String> newProperties = new HashMap<>();
+ newProperties.put(propertyName, "true");
+ boolean updateProperty = configEnv.getProperties().containsKey(propertyName);
+ updateConfigurationPropertiesForCluster(cluster, configType, newProperties, updateProperty, true);
+ }
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/configuration/falcon-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/configuration/falcon-env.xml b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/configuration/falcon-env.xml
index 09cced6..5663f57 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/configuration/falcon-env.xml
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/configuration/falcon-env.xml
@@ -21,6 +21,23 @@
-->
<configuration supports_adding_forbidden="true">
<property>
+ <name>falcon.atlas.hook</name>
+ <value>false</value>
+ <display-name>Enable Atlas Hook</display-name>
+ <description>Enable Atlas Hook</description>
+ <value-attributes>
+ <type>boolean</type>
+ <overridable>false</overridable>
+ </value-attributes>
+ <on-ambari-upgrade add="true"/>
+ <depends-on>
+ <property>
+ <type>application-properties</type>
+ <name>atlas.rest.address</name>
+ </property>
+ </depends-on>
+ </property>
+ <property>
<name>falcon_user</name>
<display-name>Falcon User</display-name>
<value>falcon</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py
index 3ecb65b..78874ef 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py
@@ -121,7 +121,7 @@ def falcon(type, action = None, upgrade_type=None):
cd_access = "a")
# Generate atlas-application.properties.xml file
- if params.falcon_atlas_support:
+ if params.falcon_atlas_support and params.enable_atlas_hook:
# If Atlas is added later than Falcon, this package will be absent.
install_atlas_hook_packages(params.atlas_plugin_package, params.atlas_ubuntu_plugin_package, params.host_sys_prepped,
params.agent_stack_retry_on_unavailability, params.agent_stack_retry_count)
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/params_linux.py
index 0fb21d0..6d1ae03 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/params_linux.py
@@ -138,14 +138,15 @@ dfs_data_mirroring_dir = "/apps/data-mirroring"
########################################################
#region Atlas Hooks
falcon_atlas_application_properties = default('/configurations/falcon-atlas-application.properties', {})
+atlas_hook_filename = default('/configurations/atlas-env/metadata_conf_file', 'atlas-application.properties')
+enable_atlas_hook = default('/configurations/falcon-env/falcon.atlas.hook', False)
# Calculate atlas_hook_cp to add to FALCON_EXTRA_CLASS_PATH
falcon_atlas_support = False
# Path to add to environment variable
atlas_hook_cp = ""
-if has_atlas_in_cluster():
- atlas_hook_filename = default('/configurations/atlas-env/metadata_conf_file', 'atlas-application.properties')
+if enable_atlas_hook:
# stack_version doesn't contain a minor number of the stack (only first two numbers: 2.3). Get it from current_version_formatted
falcon_atlas_support = current_version_formatted and check_stack_feature(StackFeature.FALCON_ATLAS_SUPPORT_2_3, current_version_formatted) \
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
index a3ad66a..7a3390e 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
@@ -21,6 +21,23 @@
-->
<configuration supports_adding_forbidden="true">
<property>
+ <name>hive.atlas.hook</name>
+ <value>false</value>
+ <display-name>Enable Atlas Hook</display-name>
+ <description>Enable Atlas Hook</description>
+ <value-attributes>
+ <type>boolean</type>
+ <overridable>false</overridable>
+ </value-attributes>
+ <on-ambari-upgrade add="true"/>
+ <depends-on>
+ <property>
+ <type>application-properties</type>
+ <name>atlas.rest.address</name>
+ </property>
+ </depends-on>
+ </property>
+ <property>
<name>hive.client.heapsize</name>
<value>512</value>
<description>Hive Client Java heap size</description>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat.py
index e952767..eecbcff 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat.py
@@ -82,6 +82,6 @@ def hcat():
)
# Generate atlas-application.properties.xml file
- if has_atlas_in_cluster():
+ if params.enable_atlas_hook:
atlas_hook_filepath = os.path.join(params.hive_config_dir, params.atlas_hook_filename)
setup_atlas_hook(SERVICE.HIVE, params.hive_atlas_application_properties, atlas_hook_filepath, params.hive_user, params.user_group)
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
index f08c458..ffc996c 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
@@ -68,7 +68,7 @@ def hive(name=None):
mode=0644)
# Generate atlas-application.properties.xml file
- if has_atlas_in_cluster():
+ if params.enable_atlas_hook:
atlas_hook_filepath = os.path.join(params.hive_config_dir, params.atlas_hook_filename)
setup_atlas_hook(SERVICE.HIVE, params.hive_atlas_application_properties, atlas_hook_filepath, params.hive_user, params.user_group)
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
index a461bfe..f1a95ed 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
@@ -517,9 +517,8 @@ metrics_collection_period = default("/configurations/ams-site/timeline.metrics.s
########################################################
#region Atlas Hooks
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')
+enable_atlas_hook = default('/configurations/hive-env/hive.atlas.hook', False)
+atlas_hook_filename = default('/configurations/atlas-env/metadata_conf_file', 'atlas-application.properties')
#endregion
########################################################
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat.py
index 00b057c..0af54af 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat.py
@@ -133,7 +133,7 @@ def webhcat():
)
# Generate atlas-application.properties.xml file
- if has_atlas_in_cluster():
+ if params.enable_atlas_hook:
# WebHCat uses a different config dir than the rest of the daemons in Hive.
atlas_hook_filepath = os.path.join(params.config_dir, params.atlas_hook_filename)
setup_atlas_hook(SERVICE.HIVE, params.hive_atlas_application_properties, atlas_hook_filepath, params.hive_user, params.user_group)
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/configuration/sqoop-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/configuration/sqoop-env.xml b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/configuration/sqoop-env.xml
index f682e97..508cfab 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/configuration/sqoop-env.xml
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/configuration/sqoop-env.xml
@@ -22,6 +22,23 @@
<configuration supports_adding_forbidden="true">
<!-- sqoop-env.sh -->
<property>
+ <name>sqoop.atlas.hook</name>
+ <value>false</value>
+ <display-name>Enable Atlas Hook</display-name>
+ <description>Enable Atlas Hook</description>
+ <value-attributes>
+ <type>boolean</type>
+ <overridable>false</overridable>
+ </value-attributes>
+ <on-ambari-upgrade add="true"/>
+ <depends-on>
+ <property>
+ <type>application-properties</type>
+ <name>atlas.rest.address</name>
+ </property>
+ </depends-on>
+ </property>
+ <property>
<name>content</name>
<display-name>sqoop-env template</display-name>
<description>This is the jinja template for sqoop-env.sh file</description>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/configuration/sqoop-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/configuration/sqoop-site.xml b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/configuration/sqoop-site.xml
index f7823d2..5d87c4d 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/configuration/sqoop-site.xml
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/configuration/sqoop-site.xml
@@ -35,5 +35,11 @@
<property>
<name>sqoop.job.data.publish.class</name>
<on-ambari-upgrade add="true"/>
+ <depends-on>
+ <property>
+ <type>sqoop-env</type>
+ <name>sqoop.atlas.hook</name>
+ </property>
+ </depends-on>
</property>
</configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
index 283f54d..c1138b3 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
@@ -130,7 +130,6 @@ jdk_location = config['hostLevelParams']['jdk_location']
########################################################
#region Atlas Hooks
sqoop_atlas_application_properties = default('/configurations/sqoop-atlas-application.properties', {})
-
-if has_atlas_in_cluster():
- atlas_hook_filename = default('/configurations/atlas-env/metadata_conf_file', 'atlas-application.properties')
+enable_atlas_hook = default('/configurations/sqoop-env/sqoop.atlas.hook', False)
+atlas_hook_filename = default('/configurations/atlas-env/metadata_conf_file', 'atlas-application.properties')
#endregion
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop.py b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop.py
index 68f06db..d005cbe 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop.py
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop.py
@@ -64,7 +64,7 @@ def sqoop(type=None):
)
# Generate atlas-application.properties.xml file and symlink the hook jars
- if has_atlas_in_cluster():
+ if params.enable_atlas_hook:
atlas_hook_filepath = os.path.join(params.sqoop_conf_dir, params.atlas_hook_filename)
setup_atlas_hook(SERVICE.SQOOP, params.sqoop_atlas_application_properties, atlas_hook_filepath, params.sqoop_user, params.user_group)
setup_atlas_jar_symlinks("sqoop", params.sqoop_lib)
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/STORM/0.10.0/configuration/storm-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.10.0/configuration/storm-env.xml b/ambari-server/src/main/resources/common-services/STORM/0.10.0/configuration/storm-env.xml
index 9547335..3b814a9 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.10.0/configuration/storm-env.xml
+++ b/ambari-server/src/main/resources/common-services/STORM/0.10.0/configuration/storm-env.xml
@@ -21,6 +21,23 @@
-->
<configuration supports_adding_forbidden="true">
<property>
+ <name>storm.atlas.hook</name>
+ <value>false</value>
+ <display-name>Enable Atlas Hook</display-name>
+ <description>Enable Atlas Hook</description>
+ <value-attributes>
+ <type>boolean</type>
+ <overridable>false</overridable>
+ </value-attributes>
+ <on-ambari-upgrade add="true"/>
+ <depends-on>
+ <property>
+ <type>application-properties</type>
+ <name>atlas.rest.address</name>
+ </property>
+ </depends-on>
+ </property>
+ <property>
<name>nimbus_seeds_supported</name>
<value>true</value>
<description/>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
index aca0681..4859534 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
@@ -214,10 +214,10 @@ jar_jvm_opts = ''
########################################################
#region Atlas Hooks
storm_atlas_application_properties = default('/configurations/storm-atlas-application.properties', {})
+enable_atlas_hook = default('/configurations/storm-env/storm.atlas.hook', False)
+atlas_hook_filename = default('/configurations/atlas-env/metadata_conf_file', 'atlas-application.properties')
-if has_atlas_in_cluster():
- atlas_hook_filename = default('/configurations/atlas-env/metadata_conf_file', 'atlas-application.properties')
-
+if enable_atlas_hook:
# Only append /etc/atlas/conf to classpath if on HDP 2.4.*
if check_stack_feature(StackFeature.ATLAS_CONF_DIR_IN_PATH, stack_version_formatted):
atlas_conf_dir = os.environ['METADATA_CONF'] if 'METADATA_CONF' in os.environ else '/etc/atlas/conf'
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py
index bda4fe2..f02ced4 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py
@@ -99,7 +99,7 @@ def storm(name=None):
)
# Generate atlas-application.properties.xml file and symlink the hook jars
- if has_atlas_in_cluster():
+ if params.enable_atlas_hook:
atlas_hook_filepath = os.path.join(params.conf_dir, params.atlas_hook_filename)
setup_atlas_hook(SERVICE.STORM, params.storm_atlas_application_properties, atlas_hook_filepath, params.storm_user, params.user_group)
storm_extlib_dir = os.path.join(params.storm_component_home_dir, "extlib")
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
index ab350dc..287db10 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
@@ -232,6 +232,10 @@ limitations under the License.
<depends-on>
<property>
<type>hive-env</type>
+ <name>hive.atlas.hook</name>
+ </property>
+ <property>
+ <type>hive-env</type>
<name>hive_timeline_logging_enabled</name>
</property>
<property>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
index 2392079..5de6898 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
@@ -67,6 +67,10 @@
<type>application-properties</type>
<name>atlas.authentication.method</name>
</property>
+ <property>
+ <type>storm-env</type>
+ <name>storm.atlas.hook</name>
+ </property>
</depends-on>
<on-ambari-upgrade add="false"/>
<on-stack-upgrade merge="false"/>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
index 4e2a994..5d34779 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
@@ -81,7 +81,8 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
"RANGER": self.recommendRangerConfigurations,
"RANGER_KMS": self.recommendRangerKMSConfigurations,
"STORM": self.recommendStormConfigurations,
- "SQOOP": self.recommendSqoopConfigurations
+ "SQOOP": self.recommendSqoopConfigurations,
+ "FALCON": self.recommendFalconConfigurations
}
parentRecommendConfDict.update(childRecommendConfDict)
return parentRecommendConfDict
@@ -219,6 +220,7 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
super(HDP23StackAdvisor, self).recommendHIVEConfigurations(configurations, clusterData, services, hosts)
putHiveSiteProperty = self.putProperty(configurations, "hive-site", services)
putHiveServerProperty = self.putProperty(configurations, "hiveserver2-site", services)
+ putHiveEnvProperty = self.putProperty(configurations, "hive-env", services)
putHiveSitePropertyAttribute = self.putPropertyAttribute(configurations, "hive-site")
servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
# hive_security_authorization == 'ranger'
@@ -258,7 +260,19 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
hive_hooks = [x for x in hive_hooks if x != ""]
is_atlas_present_in_cluster = "ATLAS" in servicesList
+ enable_atlas_hook = False
if is_atlas_present_in_cluster:
+ putHiveEnvProperty("hive.atlas.hook", "true")
+ else:
+ putHiveEnvProperty("hive.atlas.hook", "false")
+
+ if ('hive-env' in services['configurations']) and ('hive.atlas.hook' in services['configurations']['hive-env']['properties']):
+ if 'hive-env' in configurations and 'hive.atlas.hook' in configurations['hive-env']['properties']:
+ enable_atlas_hook = configurations['hive-env']['properties']['hive.atlas.hook'] == "true"
+ elif 'hive-env' in services['configurations'] and 'hive.atlas.hook' in services['configurations']['hive-env']['properties']:
+ enable_atlas_hook = services['configurations']['hive-env']['properties']['hive.atlas.hook'] == "true"
+
+ if enable_atlas_hook:
# Append atlas hook if not already present.
is_atlas_hook_in_config = atlas_hook_class in hive_hooks
if not is_atlas_hook_in_config:
@@ -791,14 +805,28 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
def recommendSqoopConfigurations(self, configurations, clusterData, services, hosts):
putSqoopSiteProperty = self.putProperty(configurations, "sqoop-site", services)
+ putSqoopEnvProperty = self.putProperty(configurations, "sqoop-env", services)
+ enable_atlas_hook = False
servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
if "ATLAS" in servicesList:
+ putSqoopEnvProperty("sqoop.atlas.hook", "true")
+ else:
+ putSqoopEnvProperty("sqoop.atlas.hook", "false")
+
+ if ('sqoop-env' in services['configurations']) and ('sqoop.atlas.hook' in services['configurations']['sqoop-env']['properties']):
+ if 'sqoop-env' in configurations and 'sqoop.atlas.hook' in configurations['sqoop-env']['properties']:
+ enable_atlas_hook = configurations['sqoop-env']['properties']['sqoop.atlas.hook'] == "true"
+ elif 'sqoop-env' in services['configurations'] and 'sqoop.atlas.hook' in services['configurations']['sqoop-env']['properties']:
+ enable_atlas_hook = services['configurations']['sqoop-env']['properties']['sqoop.atlas.hook'] == "true"
+
+ if enable_atlas_hook:
putSqoopSiteProperty('sqoop.job.data.publish.class', 'org.apache.atlas.sqoop.hook.SqoopHook')
def recommendStormConfigurations(self, configurations, clusterData, services, hosts):
super(HDP23StackAdvisor, self).recommendStormConfigurations(configurations, clusterData, services, hosts)
putStormStartupProperty = self.putProperty(configurations, "storm-site", services)
+ putStormEnvProperty = self.putProperty(configurations, "storm-env", services)
servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
if "storm-site" in services["configurations"]:
@@ -814,11 +842,23 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
atlas_is_present = "ATLAS" in servicesList
atlas_hook_class = "org.apache.atlas.storm.hook.StormAtlasHook"
atlas_hook_is_set = atlas_hook_class in notifier_plugin_value
+ enable_atlas_hook = False
+
+ if atlas_is_present:
+ putStormEnvProperty("storm.atlas.hook", "true")
+ else:
+ putStormEnvProperty("storm.atlas.hook", "false")
- if atlas_is_present and not atlas_hook_is_set:
+ if ('storm-env' in services['configurations']) and ('storm.atlas.hook' in services['configurations']['storm-env']['properties']):
+ if 'storm-env' in configurations and 'storm.atlas.hook' in configurations['storm-env']['properties']:
+ enable_atlas_hook = configurations['storm-env']['properties']['storm.atlas.hook'] == "true"
+ elif 'storm-env' in services['configurations'] and 'storm.atlas.hook' in services['configurations']['storm-env']['properties']:
+ enable_atlas_hook = services['configurations']['storm-env']['properties']['storm.atlas.hook'] == "true"
+
+ if enable_atlas_hook and not atlas_hook_is_set:
notifier_plugin_value = atlas_hook_class if notifier_plugin_value == " " else ",".join([notifier_plugin_value, atlas_hook_class])
- if not atlas_is_present and atlas_hook_is_set:
+ if not enable_atlas_hook and atlas_hook_is_set:
application_classes = [item for item in notifier_plugin_value.split(",") if item != atlas_hook_class and item != " "]
notifier_plugin_value = ",".join(application_classes) if application_classes else " "
@@ -828,6 +868,17 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
putStormStartupPropertyAttribute = self.putPropertyAttribute(configurations, "storm-site")
putStormStartupPropertyAttribute(notifier_plugin_property, 'delete', 'true')
+ def recommendFalconConfigurations(self, configurations, clusterData, services, hosts):
+
+ putFalconEnvProperty = self.putProperty(configurations, "falcon-env", services)
+ enable_atlas_hook = False
+ servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
+
+ if "ATLAS" in servicesList:
+ putFalconEnvProperty("falcon.atlas.hook", "true")
+ else:
+ putFalconEnvProperty("falcon.atlas.hook", "false")
+
def getServiceConfigurationValidators(self):
parentValidators = super(HDP23StackAdvisor, self).getServiceConfigurationValidators()
childValidators = {
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
index 923c1f7..57555ee 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
@@ -84,12 +84,6 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
services["forced-configurations"].append({"type" : "oozie-env", "name" : "oozie_admin_users"})
putOozieEnvProperty("oozie_admin_users", newAdminUsers)
- def recommendFalconConfigurations(self, configurations, clusterData, services, hosts):
- # Set the classname for the Falcon hook to 2.5 classname = all other 2.3
- # stack advisor changes are needed.
- self.atlasFalconHookClassName = "org.apache.atlas.falcon.service.AtlasService"
- super(HDP25StackAdvisor,self).recommendFalconConfigurations(configurations, clusterData, services, hosts)
-
def createComponentLayoutRecommendations(self, services, hosts):
parentComponentLayoutRecommendations = super(HDP25StackAdvisor, self).createComponentLayoutRecommendations(
services, hosts)
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index 5bedb9d..0ad0351 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
@@ -5923,6 +5923,10 @@ public class BlueprintConfigurationProcessorTest {
hiveProperties.put("hive.exec.post.hooks", "");
properties.put("hive-site", hiveProperties);
+ Map<String, String> hiveEnv = new HashMap<String, String>();
+ hiveEnv.put("hive.atlas.hook", "false");
+ properties.put("hive-env", hiveEnv);
+
Map<String, Map<String, String>> parentProperties = new HashMap<String, Map<String, String>>();
Configuration parentClusterConfig = new Configuration(parentProperties,
@@ -6000,6 +6004,9 @@ public class BlueprintConfigurationProcessorTest {
hiveProperties.put("hive.exec.post.hooks", "");
properties.put("hive-site", hiveProperties);
+ Map<String, String> hiveEnv = new HashMap<String, String>();
+ properties.put("hive-env", hiveEnv);
+
return properties;
}
@@ -6051,6 +6058,10 @@ public class BlueprintConfigurationProcessorTest {
hiveProperties.put("hive.exec.post.hooks", "foo");
properties.put("hive-site", hiveProperties);
+ Map<String, String> hiveEnv = new HashMap<String, String>();
+ hiveEnv.put("hive.atlas.hook", "false");
+ properties.put("hive-env", hiveEnv);
+
Map<String, Map<String, String>> parentProperties = new HashMap<String, Map<String, String>>();
Configuration parentClusterConfig = new Configuration(parentProperties,
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
index 0b2b32d..16da70c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
@@ -53,6 +53,7 @@ import org.apache.ambari.server.orm.DBAccessor;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
+import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.stack.OsFamily;
import org.easymock.Capture;
import org.easymock.EasyMock;
@@ -214,6 +215,7 @@ public class UpgradeCatalog250Test {
Method updateHiveLlapConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateHiveLlapConfigs");
Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml");
Method updateTablesForZeppelinViewRemoval = UpgradeCatalog250.class.getDeclaredMethod("updateTablesForZeppelinViewRemoval");
+ Method updateAtlasConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateAtlasConfigs");
UpgradeCatalog250 upgradeCatalog250 = createMockBuilder(UpgradeCatalog250.class)
.addMockedMethod(updateAmsConfigs)
@@ -221,6 +223,7 @@ public class UpgradeCatalog250Test {
.addMockedMethod(updateHiveLlapConfigs)
.addMockedMethod(addNewConfigurationsFromXml)
.addMockedMethod(updateTablesForZeppelinViewRemoval)
+ .addMockedMethod(updateAtlasConfigs)
.createMock();
upgradeCatalog250.updateAMSConfigs();
@@ -238,6 +241,9 @@ public class UpgradeCatalog250Test {
upgradeCatalog250.updateTablesForZeppelinViewRemoval();
expectLastCall().once();
+ upgradeCatalog250.updateAtlasConfigs();
+ expectLastCall().once();
+
replay(upgradeCatalog250);
upgradeCatalog250.executeDMLUpdates();
@@ -372,4 +378,91 @@ public class UpgradeCatalog250Test {
Map<String, String> updatedProperties = propertiesCapture.getValue();
assertTrue(Maps.difference(newProperties, updatedProperties).areEqual());
}
+
+ @Test
+ public void testUpdateAtlasConfigs() throws Exception {
+
+ Map<String, String> oldHiveProperties = new HashMap<String, String>();
+ Map<String, String> newHiveProperties = new HashMap<String, String>();
+
+ oldHiveProperties.put("hive.atlas.hook", "false");
+ newHiveProperties.put("hive.atlas.hook", "true");
+ testUpdateAtlasHookConfig(oldHiveProperties, newHiveProperties, "hive-env");
+
+ Map<String, String> oldStormProperties = new HashMap<String, String>();
+ Map<String, String> newStormProperties = new HashMap<String, String>();
+ oldStormProperties.put("storm.atlas.hook", "false");
+ newStormProperties.put("storm.atlas.hook", "true");
+ testUpdateAtlasHookConfig(oldStormProperties, newStormProperties, "storm-env");
+
+ Map<String, String> oldFalconProperties = new HashMap<String, String>();
+ Map<String, String> newFalconProperties = new HashMap<String, String>();
+ oldFalconProperties.put("falcon.atlas.hook", "false");
+ newFalconProperties.put("falcon.atlas.hook", "true");
+ testUpdateAtlasHookConfig(oldFalconProperties, newFalconProperties, "falcon-env");
+
+ Map<String, String> oldSqoopProperties = new HashMap<String, String>();
+ Map<String, String> newSqoopProperties = new HashMap<String, String>();
+ oldSqoopProperties.put("sqoop.atlas.hook", "false");
+ newSqoopProperties.put("sqoop.atlas.hook", "true");
+ testUpdateAtlasHookConfig(oldSqoopProperties, newSqoopProperties, "sqoop-env");
+ }
+
+ public void testUpdateAtlasHookConfig(Map<String, String> oldProperties, Map<String, String> newProperties, String configType) throws Exception {
+
+ Map<String, Service> installedServices = new HashMap<String, Service>() {
+ {
+ put("ATLAS", null);
+ put("HIVE", null);
+ put("STORM", null);
+ put("FALCON", null);
+ put("SQOOP", null);
+ }
+ };
+
+ EasyMockSupport easyMockSupport = new EasyMockSupport();
+
+ Clusters clusters = easyMockSupport.createNiceMock(Clusters.class);
+ final Cluster cluster = easyMockSupport.createNiceMock(Cluster.class);
+ final Service service = createStrictMock(Service.class);
+
+ expect(clusters.getClusters()).andReturn(new HashMap<String, Cluster>() {{
+ put("normal", cluster);
+ }}).once();
+ expect(cluster.getClusterName()).andReturn("cl1").once();
+ expect(cluster.getServices()).andReturn(installedServices).atLeastOnce();
+
+ Config mockAtlasConfig = easyMockSupport.createNiceMock(Config.class);
+ expect(cluster.getDesiredConfigByType(configType)).andReturn(mockAtlasConfig).atLeastOnce();
+ expect(mockAtlasConfig.getProperties()).andReturn(oldProperties).anyTimes();
+
+ Injector injector = easyMockSupport.createNiceMock(Injector.class);
+ expect(injector.getInstance(Gson.class)).andReturn(null).anyTimes();
+ expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(null).anyTimes();
+ expect(injector.getInstance(KerberosHelper.class)).andReturn(createNiceMock(KerberosHelper.class)).anyTimes();
+
+ replay(injector, clusters, mockAtlasConfig, cluster);
+
+ AmbariManagementControllerImpl controller = createMockBuilder(AmbariManagementControllerImpl.class)
+ .addMockedMethod("createConfiguration")
+ .addMockedMethod("getClusters", new Class[] { })
+ .addMockedMethod("createConfig")
+ .withConstructor(createNiceMock(ActionManager.class), clusters, injector)
+ .createNiceMock();
+
+ Injector injector2 = easyMockSupport.createNiceMock(Injector.class);
+ Capture<Map> propertiesCapture = EasyMock.newCapture();
+
+ expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
+ expect(controller.getClusters()).andReturn(clusters).anyTimes();
+ expect(controller.createConfig(anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+ anyObject(Map.class))).andReturn(createNiceMock(Config.class)).once();
+
+ replay(controller, injector2);
+ new UpgradeCatalog250(injector2).updateAtlasConfigs();
+ easyMockSupport.verifyAll();
+
+ Map<String, String> updatedProperties = propertiesCapture.getValue();
+ assertTrue(Maps.difference(newProperties, updatedProperties).areEqual());
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/8ad494e9/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
index 39cbbce..b5ff24c 100644
--- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
@@ -587,7 +587,8 @@ class TestHDP23StackAdvisor(TestCase):
'hive_exec_orc_storage_strategy': 'SPEED',
'hive_security_authorization': 'None',
'hive_timeline_logging_enabled': 'true',
- 'hive_txn_acid': 'off'
+ 'hive_txn_acid': 'off',
+ 'hive.atlas.hook': 'false'
}
},
'hive-site': {
@@ -745,6 +746,7 @@ class TestHDP23StackAdvisor(TestCase):
},
"hive-env": {
"properties": {
+ "hive.atlas.hook": "false"
}
},
"hive-site": {
@@ -863,7 +865,8 @@ class TestHDP23StackAdvisor(TestCase):
'hive_exec_orc_storage_strategy': 'SPEED',
'hive_security_authorization': 'None',
'hive_timeline_logging_enabled': 'true',
- 'hive_txn_acid': 'off'
+ 'hive_txn_acid': 'off',
+ 'hive.atlas.hook': 'true'
}
},
'hive-site': {
@@ -1045,6 +1048,7 @@ class TestHDP23StackAdvisor(TestCase):
},
"hive-env": {
"properties": {
+ "hive.atlas.hook": "false"
}
},
"hive-site": {
@@ -1733,6 +1737,11 @@ class TestHDP23StackAdvisor(TestCase):
"properties": {
"ranger-storm-plugin-enabled": "No"
}
+ },
+ "storm-env": {
+ "properties": {
+ "storm.atlas.hook": "true"
+ }
}
}
services = {
@@ -1773,6 +1782,11 @@ class TestHDP23StackAdvisor(TestCase):
"properties": {
"ranger-storm-plugin-enabled": "No"
}
+ },
+ "storm-env": {
+ "properties": {
+ "storm.atlas.hook": "false"
+ }
}
},
"changed-configurations": [ ]
@@ -1830,6 +1844,11 @@ class TestHDP23StackAdvisor(TestCase):
'properties': {
'sqoop.job.data.publish.class': 'org.apache.atlas.sqoop.hook.SqoopHook',
}
+ },
+ 'sqoop-env': {
+ 'properties': {
+ 'sqoop.atlas.hook': 'true'
+ }
}
}
services = {
@@ -1864,6 +1883,11 @@ class TestHDP23StackAdvisor(TestCase):
"properties": {
"sqoop.job.data.publish.class": "foo"
}
+ },
+ "sqoop-env": {
+ "properties": {
+ "sqoop.atlas.hook": "false"
+ }
}
},
"changed-configurations": [ ]