ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [2/2] ambari git commit: AMBARI-12991. Phoenix rpm should not be installed if not being used in Ambari. (aonishuk)
Date Thu, 03 Sep 2015 11:23:35 GMT
AMBARI-12991. Phoenix rpm should not be installed if not being used in Ambari. (aonishuk)


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

Branch: refs/heads/branch-2.1
Commit: b1f53e45fb94a592429459e0f26f582361b99427
Parents: 533e306
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Thu Sep 3 14:23:26 2015 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Thu Sep 3 14:23:26 2015 +0300

----------------------------------------------------------------------
 .../resource_management/libraries/script/script.py    | 14 +++++++++++++-
 .../HBASE/0.96.0.2.0/package/scripts/hbase_client.py  |  4 +++-
 .../HBASE/0.96.0.2.0/package/scripts/hbase_master.py  |  3 ++-
 .../0.96.0.2.0/package/scripts/hbase_regionserver.py  |  3 ++-
 .../HBASE/0.96.0.2.0/package/scripts/params_linux.py  |  8 ++++++++
 .../0.96.0.2.0/package/scripts/phoenix_queryserver.py |  3 ++-
 6 files changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f53e45/ambari-common/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py
b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index 26fd158..962b54c 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -21,6 +21,7 @@ import tempfile
 
 __all__ = ["Script"]
 
+import re
 import os
 import sys
 import logging
@@ -351,6 +352,9 @@ class Script(object):
     List of packages that are required< by service is received from the server
     as a command parameter. The method installs all packages
     from this list
+    
+    exclude_packages - list of regexes (possibly raw strings as well), the
+    packages which match the regex won't be installed
     """
     config = self.get_config()
     if 'host_sys_prepped' in config['hostLevelParams']:
@@ -364,7 +368,7 @@ class Script(object):
       if isinstance(package_list_str, basestring) and len(package_list_str) > 0:
         package_list = json.loads(package_list_str)
         for package in package_list:
-          if not package['name'] in exclude_packages:
+          if not Script.matches_any_regexp(package['name'], exclude_packages):
             name = package['name']
             # HACK: On Windows, only install ambari-metrics packages using Choco Package
Installer
             # TODO: Update this once choco packages for hadoop are created. This is because,
service metainfo.xml support
@@ -385,6 +389,14 @@ class Script(object):
                           hadoop_user, self.get_password(hadoop_user),
                           str(config['hostLevelParams']['stack_version']))
       reload_windows_env()
+      
+  @staticmethod
+  def matches_any_regexp(string, regexp_list):
+    for regex in regexp_list:
+      # adding ^ and $ to correctly match raw strings from begining to the end
+      if re.match('^' + regex + '$', string):
+        return True
+    return False
 
   @staticmethod
   def fail_with_error(message):

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f53e45/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
index f772a11..74cfde6 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
@@ -29,7 +29,9 @@ from ambari_commons.os_family_impl import OsFamilyImpl
 
 class HbaseClient(Script):
   def install(self, env):
-    self.install_packages(env)
+    import params
+    
+    self.install_packages(env, params.exclude_packages)
     self.configure(env)
 
   def configure(self, env):

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f53e45/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py
index 19e639c..56dde25 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py
@@ -39,7 +39,8 @@ class HbaseMaster(Script):
     hbase(name='master')
 
   def install(self, env):
-    self.install_packages(env)
+    import params
+    self.install_packages(env, params.exclude_packages)
 
   def decommission(self, env):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f53e45/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py
index 3244092..44feb0c 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py
@@ -33,7 +33,8 @@ from ambari_commons.os_family_impl import OsFamilyImpl
 
 class HbaseRegionServer(Script):
   def install(self, env):
-    self.install_packages(env)
+    import params
+    self.install_packages(env, params.exclude_packages)
 
   def configure(self, env):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f53e45/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
index ae4dcda..2633640 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
@@ -106,6 +106,14 @@ regionserver_xmn_percent = config['configurations']['hbase-env']['hbase_regionse
 regionserver_xmn_size = calc_xmn_from_xms(regionserver_heapsize, regionserver_xmn_percent,
regionserver_xmn_max)
 
 
+phoenix_hosts = default('/clusterHostInfo/phoenix_query_server_hosts', [])
+has_phoenix = len(phoenix_hosts) > 0
+
+if not has_phoenix:
+  exclude_packages = ['phoenix.+']
+else:
+  exclude_packages = []
+
 pid_dir = status_params.pid_dir
 tmp_dir = config['configurations']['hbase-site']['hbase.tmp.dir']
 local_dir = config['configurations']['hbase-site']['hbase.local.dir']

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f53e45/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/phoenix_queryserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/phoenix_queryserver.py
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/phoenix_queryserver.py
index 17c0014..edcf041 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/phoenix_queryserver.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/phoenix_queryserver.py
@@ -27,7 +27,8 @@ from hbase import hbase
 class PhoenixQueryServer(Script):
 
   def install(self, env):
-    self.install_packages(env)
+    import params
+    self.install_packages(env, params.exclude_packages)
 
 
   def get_stack_to_component(self):


Mime
View raw message