Repository: ambari
Updated Branches:
  refs/heads/trunk 1d6ca13ae -> d812b1704


AMBARI-15578: Stack Featurize Atlas Service (jluniya)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d812b170
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d812b170
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d812b170

Branch: refs/heads/trunk
Commit: d812b17048afbb418e87dc46212b2b165456472c
Parents: 1d6ca13
Author: Jayush Luniya <[email protected]>
Authored: Thu Mar 31 14:03:27 2016 -0700
Committer: Jayush Luniya <[email protected]>
Committed: Thu Mar 31 14:03:27 2016 -0700

----------------------------------------------------------------------
 .../libraries/functions/constants.py                   |  1 +
 .../libraries/functions/stack_features.py              |  5 +++++
 .../ATLAS/0.1.0.2.3/package/scripts/atlas_client.py    | 10 ++++++++--
 .../ATLAS/0.1.0.2.3/package/scripts/metadata_server.py | 13 +++++++++----
 .../ATLAS/0.1.0.2.3/package/scripts/params.py          |  5 +++--
 .../stacks/HDP/2.0.6/properties/stack_features.json    |  5 +++++
 6 files changed, 31 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d812b170/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
----------------------------------------------------------------------
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
index 1bfec09..175b889 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
@@ -63,3 +63,4 @@ class StackFeature:
   ACCUMULO_KERBEROS_USER_AUTH = "accumulo_kerberos_user_auth"
   KNOX_VERSIONED_DATA_DIR = "knox_versioned_data_dir"
   KNOX_SSO_TOPOLOGY = "knox_sso_topology"
+  ATLAS_ROLLING_UPGRADE = "atlas_rolling_upgrade"

http://git-wip-us.apache.org/repos/asf/ambari/blob/d812b170/ambari-common/src/main/python/resource_management/libraries/functions/stack_features.py
----------------------------------------------------------------------
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/stack_features.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/stack_features.py
index bfbf250..6169699 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/stack_features.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/stack_features.py
@@ -148,6 +148,11 @@ _DEFAULT_STACK_FEATURES = {
       "name": "knox_sso_topology",
       "description": "Knox SSO Topology support (AMBARI-13975)",
       "min_version": "2.3.8.0"
+    },
+    {
+      "name": "atlas_rolling_upgrade",
+      "description": "Rolling upgrade support for Atlas",
+      "min_version": "2.3.0.0"
     }
   ]
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d812b170/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py
 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py
index 8fabaac..14a12d3 100644
--- 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py
+++ 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py
@@ -22,6 +22,8 @@ import sys
 from resource_management import *
 from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions.stack_features import 
check_stack_feature
+from resource_management.libraries.functions import StackFeature
 
 from metadata import metadata
 
@@ -29,7 +31,8 @@ from metadata import metadata
 class AtlasClient(Script):
 
   def get_stack_to_component(self):
-    return {"HDP": "atlas-client"}
+    import params
+    return {params.stack_name: "atlas-client"}
 
   # ToDo: currently <stack-selector-tool> doesn't contain atlas-client, 
uncomment this block when
   # ToDo: atlas-client will be available
@@ -37,8 +40,11 @@ class AtlasClient(Script):
   #   import params
   #   env.set_params(params)
   #
-  #   if params.version and 
compare_versions(format_stack_version(params.version), '2.3.0.0') >= 0:
+  # TODO: Add ATLAS_CONFIG_VERSIONING stack feature and uncomment this code 
when config versioning for Atlas is supported
+  #   if params.version and 
check_stack_feature(StackFeature.ATLAS_CONFIG_VERSIONING, params.version):
   #     conf_select.select(params.stack_name, "atlas", params.version)
+  # TODO: Add ATLAS_CLIENT_ROLLING_UPGRADE stack feature and uncomment this 
code when rolling upgrade for Atlas client is supported
+  #   if params.version and 
check_stack_feature(StackFeature.ATLAS_CLIENT_ROLLING_UPGRADE, params.version):
   #     stack_select.select("atlas-client", params.version)
 
   def install(self, env):

http://git-wip-us.apache.org/repos/asf/ambari/blob/d812b170/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
index 46c8fd3..a5990a2 100644
--- 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
+++ 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
@@ -21,16 +21,18 @@ from resource_management.libraries.functions import 
conf_select
 from resource_management.libraries.functions import stack_select
 from resource_management import Execute, File, check_process_status, Script
 from resource_management.libraries.functions import format
-from resource_management.libraries.functions.version import compare_versions, 
format_stack_version
 from resource_management.libraries.functions.security_commons import 
build_expectations, \
   get_params_from_filesystem, validate_security_config_properties, \
   FILE_TYPE_PROPERTIES
 from resource_management.libraries.functions.show_logs import show_logs
+from resource_management.libraries.functions.stack_features import 
check_stack_feature
+from resource_management.libraries.functions import StackFeature
 
 class MetadataServer(Script):
 
   def get_stack_to_component(self):
-    return {"HDP": "atlas-server"}
+    import params
+    return {params.stack_name: "atlas-server"}
 
   def install(self, env):
     self.install_packages(env)
@@ -44,8 +46,11 @@ class MetadataServer(Script):
     import params
     env.set_params(params)
 
-    if params.version and 
compare_versions(format_stack_version(params.version), '2.3.0.0') >= 0:
-      # conf_select.select(params.stack_name, "atlas", params.version)
+    # TODO: Add ATLAS_CONFIG_VERSIONING stack feature and uncomment this code 
when config versioning for Atlas is supported
+    #if params.version and 
check_stack_feature(StackFeature.ATLAS_CONFIG_VERSIONING, params.version):
+    #  conf_select.select(params.stack_name, "atlas", params.version)
+
+    if params.version and 
check_stack_feature(StackFeature.ATLAS_ROLLING_UPGRADE, params.version):
       stack_select.select("atlas-server", params.version)
 
   def start(self, env, upgrade_type=None):

http://git-wip-us.apache.org/repos/asf/ambari/blob/d812b170/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
index 097765e..b377757 100644
--- 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
@@ -27,6 +27,7 @@ import status_params
 
 # server configurations
 config = Script.get_config()
+stack_root = Script.get_stack_root()
 
 cluster_name = config['clusterName']
 
@@ -44,11 +45,11 @@ stack_name = default("/hostLevelParams/stack_name", None)
 # New Cluster Stack Version that is defined during the RESTART of a Stack 
Upgrade
 version = default("/commandParams/version", None)
 
-# hdp version
+# stack version
 stack_version_unformatted = config['hostLevelParams']['stack_version']
 stack_version_formatted = format_stack_version(stack_version_unformatted)
 
-metadata_home = os.environ['METADATA_HOME_DIR'] if 'METADATA_HOME_DIR' in 
os.environ else '/usr/hdp/current/atlas-server'
+metadata_home = os.environ['METADATA_HOME_DIR'] if 'METADATA_HOME_DIR' in 
os.environ else format('{stack_root}/current/atlas-server')
 metadata_bin = format("{metadata_home}/bin")
 
 python_binary = os.environ['PYTHON_EXE'] if 'PYTHON_EXE' in os.environ else 
sys.executable

http://git-wip-us.apache.org/repos/asf/ambari/blob/d812b170/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
index 7ac61eb..fd3fbde 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
@@ -122,6 +122,11 @@
       "name": "knox_sso_topology",
       "description": "Knox SSO Topology support (AMBARI-13975)",
       "min_version": "2.3.8.0"
+    },
+    {
+      "name": "atlas_rolling_upgrade",
+      "description": "Rolling upgrade support for Atlas",
+      "min_version": "2.3.0.0"
     }
   ]
 }

Reply via email to