AMBARI-19923. Hive metastore restart failed after enabling credential store (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9e596ed1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9e596ed1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9e596ed1 Branch: refs/heads/branch-2.5 Commit: 9e596ed1cc12812cc2c8b81d52cec06942686f50 Parents: 151d2f1 Author: Andrew Onishuk <[email protected]> Authored: Wed Feb 8 17:41:21 2017 +0200 Committer: Andrew Onishuk <[email protected]> Committed: Wed Feb 8 17:41:21 2017 +0200 ---------------------------------------------------------------------- ambari-agent/conf/unix/ambari-agent | 1 + .../ambari_agent/CustomServiceOrchestrator.py | 3 --- .../0.12.0.2.0/package/scripts/params_linux.py | 17 ++++++----------- 3 files changed, 7 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9e596ed1/ambari-agent/conf/unix/ambari-agent ---------------------------------------------------------------------- diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent index 0f791ca..10913f8 100755 --- a/ambari-agent/conf/unix/ambari-agent +++ b/ambari-agent/conf/unix/ambari-agent @@ -111,6 +111,7 @@ change_files_permissions() { ambari-sudo.sh chown -R $current_user "/var/lib/ambari-agent/data/" ambari-sudo.sh chown -R $current_user "/var/lib/ambari-agent/cache/" ambari-sudo.sh chown $current_user "/usr/lib/ambari-agent/" + ambari-sudo.sh chown $current_user "/var/lib/ambari-agent/cred" } http://git-wip-us.apache.org/repos/asf/ambari/blob/9e596ed1/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py index 9baaf08..7a03065 100644 --- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py +++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py @@ -149,9 +149,6 @@ class CustomServiceOrchestrator(): # /etc/<service_name>/conf conf_dir = os.path.join(self.credential_conf_dir, service_name.lower()) - if not os.path.exists(conf_dir): - os.makedirs(conf_dir, 0644) - return conf_dir def getConfigTypeCredentials(self, commandJson): http://git-wip-us.apache.org/repos/asf/ambari/blob/9e596ed1/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py index e28cff8..928bf06 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py +++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py @@ -49,7 +49,8 @@ from resource_management.libraries.functions.get_architecture import get_archite from resource_management.core.utils import PasswordString from resource_management.core.shell import checked_call from resource_management.core.logger import Logger -from ambari_commons.inet_utils import download_file +from resource_management.core.resources.system import File +from resource_management.core.source import DownloadSource # Default log4j version; put config files under /etc/hive/conf log4j_version = '1' @@ -241,12 +242,10 @@ def getHiveMetastorePassword(): credential_util_dir = cs_lib_path.split('*')[0] # Remove the trailing '*' credential_util_path = os.path.join(credential_util_dir, credential_util_jar) credential_util_url = jdk_location + credential_util_jar - try: - download_file(credential_util_url, credential_util_path) - except Exception, e: - message = 'Error downloading {0} from Ambari Server resources. {1}'.format(credential_util_url, str(e)) - Logger.error(message) - raise + File(credential_util_path, + content = DownloadSource(credential_util_url), + mode = 0644, + ) # Execute a get command on the CredentialUtil CLI to get the password for the specified alias java_home = config['hostLevelParams']['java_home'] @@ -255,10 +254,6 @@ def getHiveMetastorePassword(): provider_path = config['configurations']['hive-site']['hadoop.security.credential.provider.path'] cmd = (java_bin, '-cp', cs_lib_path, credential_util_cmd, 'get', alias, '-provider', provider_path) cmd_result, std_out_msg = checked_call(cmd) - if cmd_result != 0: - message = 'The following error occurred while executing {0}: {1}'.format(' '.join(cmd), std_out_msg) - Logger.error(message) - raise std_out_lines = std_out_msg.split('\n') passwd = std_out_lines[-1] # Get the last line of the output, to skip warnings if any. return passwd
