|
@@ -555,7 +555,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 Script.check_package_condition(package):
|
|
|
+ if self.check_package_condition(package):
|
|
|
name = self.format_package_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
|
|
@@ -579,22 +579,25 @@ class Script(object):
|
|
|
str(config['hostLevelParams']['stack_version']))
|
|
|
reload_windows_env()
|
|
|
|
|
|
- @staticmethod
|
|
|
- def check_package_condition(package):
|
|
|
- from resource_management.libraries.functions import package_conditions
|
|
|
+ def check_package_condition(self, package):
|
|
|
condition = package['condition']
|
|
|
- name = package['name']
|
|
|
|
|
|
if not condition:
|
|
|
return True
|
|
|
|
|
|
+ return self.should_install_package(package)
|
|
|
+
|
|
|
+ def should_install_package(self, package):
|
|
|
+ from resource_management.libraries.functions import package_conditions
|
|
|
+ condition = package['condition']
|
|
|
try:
|
|
|
chooser_method = getattr(package_conditions, condition)
|
|
|
except AttributeError:
|
|
|
+ name = package['name']
|
|
|
raise Fail("Condition with name '{0}', when installing package {1}. Please check package_conditions.py.".format(condition, name))
|
|
|
|
|
|
return chooser_method()
|
|
|
-
|
|
|
+
|
|
|
@staticmethod
|
|
|
def matches_any_regexp(string, regexp_list):
|
|
|
for regex in regexp_list:
|