Repository: ambari
Updated Branches:
  refs/heads/trunk e630228cd -> 0c4b29549


AMBARI-15580: Stack Featurize Flume Service (jluniya)


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

Branch: refs/heads/trunk
Commit: 0c4b2954963b5975557de664e7f3d08dde3f29f3
Parents: e630228
Author: Jayush Luniya <[email protected]>
Authored: Thu Mar 31 13:37:09 2016 -0700
Committer: Jayush Luniya <[email protected]>
Committed: Thu Mar 31 13:37:09 2016 -0700

----------------------------------------------------------------------
 .../FLUME/1.4.0.2.0/package/scripts/flume_handler.py     |  9 ++++++---
 .../FLUME/1.4.0.2.0/package/scripts/params.py            | 11 ++++++-----
 .../FLUME/1.4.0.2.0/package/scripts/params_linux.py      | 11 +++++++++--
 3 files changed, 21 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0c4b2954/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
 
b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
index 60138bb..1bd99da 100644
--- 
a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
+++ 
b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
@@ -31,6 +31,8 @@ from 
resource_management.libraries.functions.flume_agent_helper import get_flume
 import service_mapping
 from ambari_commons import OSConst
 from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
+from resource_management.libraries.functions.stack_features import 
check_stack_feature
+from resource_management.libraries.functions import StackFeature
 
 class FlumeHandler(Script):
   def configure(self, env):
@@ -41,7 +43,8 @@ class FlumeHandler(Script):
 @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
 class FlumeHandlerLinux(FlumeHandler):
   def get_stack_to_component(self):
-    return {"HDP": "flume-server"}
+    import params
+    return {params.stack_name: "flume-server"}
 
   def install(self, env):
     import params
@@ -88,8 +91,8 @@ class FlumeHandlerLinux(FlumeHandler):
     env.set_params(params)
 
     # this function should not execute if the version can't be determined or
-    # is not at least HDP 2.2.0.0
-    if not params.version or Script.is_stack_less_than("2.2"):
+    # the stack does not support rolling upgrade
+    if not (params.version and 
check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version)):
       return
 
     Logger.info("Executing Flume Stack Upgrade pre-restart")

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c4b2954/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py
index 3602f22..12222eb 100644
--- 
a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py
@@ -29,6 +29,7 @@ else:
   from params_linux import *
 
 config = Script.get_config()
+stack_root = Script.get_stack_root()
 
 stack_name = default("/hostLevelParams/stack_name", None)
 host_sys_prepped = default("/hostLevelParams/host_sys_prepped", False)
@@ -49,11 +50,11 @@ flume_bin = '/usr/bin/flume-ng'
 flume_hive_home = '/usr/lib/hive'
 flume_hcat_home = '/usr/lib/hive-hcatalog'
 
-# hadoop parameters for 2.2+
-if Script.is_stack_greater_or_equal("2.2"):
-  flume_bin = '/usr/hdp/current/flume-server/bin/flume-ng'
-  flume_hive_home = '/usr/hdp/current/hive-metastore'
-  flume_hcat_home = '/usr/hdp/current/hive-webhcat'
+# hadoop parameters for stack supporting rolling upgrade
+if stack_version_formatted and 
check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted):
+  flume_bin = format('{stack_root}/current/flume-server/bin/flume-ng')
+  flume_hive_home = format('{stack_root}/current/hive-metastore')
+  flume_hcat_home = format('{stack_root}/current/hive-webhcat')
 
 java_home = config['hostLevelParams']['java_home']
 flume_log_dir = config['configurations']['flume-env']['flume_log_dir']

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c4b2954/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params_linux.py
index fffcc84..53b6be0 100644
--- 
a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params_linux.py
@@ -16,21 +16,28 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 
 """
+import os
 from resource_management.libraries.functions.constants import Direction
 from resource_management.libraries.functions import default
 from resource_management.libraries.script.script import Script
+from resource_management.libraries.functions.version import 
format_stack_version
+from resource_management.libraries.functions import format
+from resource_management.libraries.functions.stack_features import 
check_stack_feature
+from resource_management.libraries.functions import StackFeature
 
 # server configurations
 config = Script.get_config()
+stack_root = Script.get_stack_root()
 
 # upgrade params
 stack_name = default("/hostLevelParams/stack_name", None)
 upgrade_direction = default("/commandParams/upgrade_direction", 
Direction.UPGRADE)
 stack_version_unformatted = config['hostLevelParams']['stack_version']
+stack_version_formatted = format_stack_version(stack_version_unformatted)
 
 flume_conf_dir = '/etc/flume/conf'
-if Script.is_stack_greater_or_equal("2.2"):
-  flume_conf_dir = '/usr/hdp/current/flume-server/conf'
+if stack_version_formatted and 
check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted):
+  flume_conf_dir = format('{stack_root}/current/flume-server/conf')
 
 flume_user = 'flume'
 flume_group = 'flume'

Reply via email to