ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [1/2] ambari git commit: AMBARI-13141. Properly handle not_if clause for command execution (aonishuk)
Date Fri, 18 Sep 2015 10:24:20 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 4e1cce23f -> 136dc8eed
  refs/heads/trunk d40bf10b8 -> 294bba803


AMBARI-13141. Properly handle not_if clause for command execution (aonishuk)


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

Branch: refs/heads/trunk
Commit: 294bba8038e575c22385d8f5c87be6e601235195
Parents: d40bf10
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Fri Sep 18 13:24:09 2015 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Fri Sep 18 13:24:09 2015 +0300

----------------------------------------------------------------------
 .../HIVE/0.12.0.2.0/package/scripts/hive.py             | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/294bba80/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
index 7e35a57..39b3433 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
@@ -35,6 +35,9 @@ from resource_management.libraries.resources.xml_config import XmlConfig
 from resource_management.libraries.functions.format import format
 from resource_management.core.exceptions import Fail
 from resource_management.core.shell import as_sudo
+from resource_management.core.shell import quote_bash_args
+from resource_management.core.logger import Logger
+from resource_management.core import utils
 
 from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 from ambari_commons import OSConst
@@ -275,6 +278,15 @@ def hive(name=None):
                                         "-userName {hive_metastore_user_name} "
                                         "-passWord {hive_metastore_user_passwd!p}"), params.hive_user)
 
+      # HACK: in cases with quoted passwords and as_user (which does the quoting as well)
!p won't work for hiding passwords.
+      # Fixing it with the hack below:
+      quoted_hive_metastore_user_passwd = quote_bash_args(quote_bash_args(params.hive_metastore_user_passwd))
+      if quoted_hive_metastore_user_passwd[0] == "'" and quoted_hive_metastore_user_passwd[-1]
== "'" \
+          or quoted_hive_metastore_user_passwd[0] == '"' and quoted_hive_metastore_user_passwd[-1]
== '"':
+        quoted_hive_metastore_user_passwd = quoted_hive_metastore_user_passwd[1:-1]
+      Logger.sensitive_strings[repr(check_schema_created_cmd)] = repr(check_schema_created_cmd.replace(
+          format("-passWord {quoted_hive_metastore_user_passwd}"), "-passWord " + utils.PASSWORDS_HIDE_STRING))
+
       Execute(create_schema_cmd,
               not_if = check_schema_created_cmd,
               user = params.hive_user


Mime
View raw message