Repository: ambari Updated Branches: refs/heads/trunk 017fbf130 -> 8d91e7109
AMBARI-15651. Sqoop client install (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8d91e710 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8d91e710 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8d91e710 Branch: refs/heads/trunk Commit: 8d91e710995d2b9444411c60882f84b6a46d8f26 Parents: 017fbf1 Author: Andrew Onishuk <[email protected]> Authored: Thu Mar 31 18:48:01 2016 +0300 Committer: Andrew Onishuk <[email protected]> Committed: Thu Mar 31 18:48:01 2016 +0300 ---------------------------------------------------------------------- .../resource_management/core/environment.py | 5 +++++ .../libraries/functions/format.py | 22 ++++++++++++-------- .../1.4.4.2.0/package/scripts/params_linux.py | 2 +- .../1.4.4.2.0/package/scripts/sqoop_client.py | 4 ++-- 4 files changed, 21 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8d91e710/ambari-common/src/main/python/resource_management/core/environment.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/core/environment.py b/ambari-common/src/main/python/resource_management/core/environment.py index b4e9b3a..1efd89e 100644 --- a/ambari-common/src/main/python/resource_management/core/environment.py +++ b/ambari-common/src/main/python/resource_management/core/environment.py @@ -171,6 +171,11 @@ class Environment(object): self.run_action(resource, action) @classmethod + def has_instance(cls): + instance = getattr(_local_data, _instance_name, None) + return not instance is None + + @classmethod def get_instance(cls): instance = getattr(_local_data, _instance_name, None) if instance is None: http://git-wip-us.apache.org/repos/asf/ambari/blob/8d91e710/ambari-common/src/main/python/resource_management/libraries/functions/format.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/format.py b/ambari-common/src/main/python/resource_management/libraries/functions/format.py index a137875..7126971 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/format.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/format.py @@ -39,16 +39,20 @@ class ConfigurationFormatter(Formatter): !p - password flag, !p=!s+!e. Has both !e, !h effect """ def format(self, format_string, *args, **kwargs): - env = Environment.get_instance() variables = kwargs - params = env.config.params - - # don't use checked_unite for this as it would interfere with reload(module) - # for things like params and status_params; instead, start out copying - # the environment parameters and add in any locally declared variables to - # override existing env parameters - all_params = params.copy() - all_params.update(variables) + + if Environment.has_instance(): + env = Environment.get_instance() + params = env.config.params + + # don't use checked_unite for this as it would interfere with reload(module) + # for things like params and status_params; instead, start out copying + # the environment parameters and add in any locally declared variables to + # override existing env parameters + all_params = params.copy() + all_params.update(variables) + else: + all_params = {} self.convert_field = self.convert_field_protected result_protected = self.vformat(format_string, args, all_params) http://git-wip-us.apache.org/repos/asf/ambari/blob/8d91e710/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 0a42971..7db974f 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 @@ -119,6 +119,6 @@ has_atlas = len(atlas_hosts) > 0 if has_atlas: atlas_conf_file = config['configurations']['atlas-env']['metadata_conf_file'] - atlas_home_dir = os.environ['METADATA_HOME_DIR'] if 'METADATA_HOME_DIR' in os.environ else fomat("{stack_root}/current/atlas-server") + atlas_home_dir = os.environ['METADATA_HOME_DIR'] if 'METADATA_HOME_DIR' in os.environ else format("{stack_root}/current/atlas-server") atlas_conf_dir = os.environ['METADATA_CONF'] if 'METADATA_CONF' in os.environ else '/etc/atlas/conf' job_data_publish_class = 'org.apache.atlas.sqoop.hook.SqoopHook' http://git-wip-us.apache.org/repos/asf/ambari/blob/8d91e710/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py index d0fd234..0e5fd1d 100644 --- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py +++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py @@ -20,6 +20,7 @@ limitations under the License. from resource_management.core.exceptions import ClientComponentHasNoStatus from resource_management.core.resources.system import Execute +from resource_management.libraries.functions.default import default from resource_management.libraries.script.script import Script from resource_management.libraries.functions import conf_select from resource_management.libraries.functions import stack_select @@ -46,8 +47,7 @@ class SqoopClient(Script): @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) class SqoopClientDefault(SqoopClient): def get_stack_to_component(self): - import params - return {params.stack_name: "sqoop-client"} + return {default("/hostLevelParams/stack_name", None): "sqoop-client"} def pre_upgrade_restart(self, env, upgrade_type=None): import params
