Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B268F200B85 for ; Thu, 15 Sep 2016 23:43:54 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B101D160AC6; Thu, 15 Sep 2016 21:43:54 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 05B22160ABA for ; Thu, 15 Sep 2016 23:43:53 +0200 (CEST) Received: (qmail 94332 invoked by uid 500); 15 Sep 2016 21:43:53 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 94323 invoked by uid 99); 15 Sep 2016 21:43:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Sep 2016 21:43:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1D76EE03CE; Thu, 15 Sep 2016 21:43:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: alejandro@apache.org To: commits@ambari.apache.org Message-Id: <2a541b58698b4ba99c73cd15590a9a22@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-18368. ADDENDUM. Atlas web UI alert after performing stack upgrade to HDP 2.5 and adding Atlas Service (alejandro) Date: Thu, 15 Sep 2016 21:43:53 +0000 (UTC) archived-at: Thu, 15 Sep 2016 21:43:54 -0000 Repository: ambari Updated Branches: refs/heads/trunk d5cca62c8 -> 1efc99c5a AMBARI-18368. ADDENDUM. Atlas web UI alert after performing stack upgrade to HDP 2.5 and adding Atlas Service (alejandro) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1efc99c5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1efc99c5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1efc99c5 Branch: refs/heads/trunk Commit: 1efc99c5adc536044425b9df45b72421c5a8323c Parents: d5cca62 Author: Alejandro Fernandez Authored: Wed Sep 14 18:42:59 2016 -0700 Committer: Alejandro Fernandez Committed: Thu Sep 15 14:46:37 2016 -0700 ---------------------------------------------------------------------- .../libraries/functions/conf_select.py | 39 +++++++++++++++++--- .../hooks/after-INSTALL/test_after_install.py | 18 +++++++++ 2 files changed, 52 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1efc99c5/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py index c60b324..8d54053 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py @@ -343,7 +343,27 @@ def select(stack_name, package, version, try_create=True, ignore_errors=False): else: # missing entirely # /etc//conf -> /current//conf - Link(conf_dir, to = current_dir) + if package in ["atlas", ]: + #HACK for Atlas + ''' + In the case of Atlas, the Hive RPM installs /usr/$stack/$version/atlas with some partial packages that + contain Hive hooks, while the Atlas RPM is responsible for installing the full content. + + If the user does not have Atlas currently installed on their stack, then /usr/$stack/current/atlas-client + will be a broken symlink, and we should not create the + symlink /etc/atlas/conf -> /usr/$stack/current/atlas-client/conf . + If we mistakenly create this symlink, then when the user performs an EU/RU and then adds Atlas service + then the Atlas RPM will not be able to copy its artifacts into /etc/atlas/conf directory and therefore + prevent Ambari from by copying those unmanaged contents into /etc/atlas/$version/0 + ''' + parent_dir = os.path.dirname(current_dir) + if os.path.exists(parent_dir): + Link(conf_dir, to=current_dir) + else: + Logger.info("Will not create symlink from {0} to {1} because the destination's parent dir does not exist.".format(conf_dir, current_dir)) + else: + # Normal path for other packages + Link(conf_dir, to=current_dir) except Exception, exception: if ignore_errors is True: @@ -579,15 +599,24 @@ def convert_conf_directories_to_symlinks(package, version, dirs, skip_existing_l else: Link(new_symlink, action = "delete") + old_conf = dir_def['conf_dir'] + backup_dir = _get_backup_conf_directory(old_conf) # link /etc/[component]/conf -> /etc/[component]/conf.backup # or # link /etc/[component]/conf -> /current/[component]-client/conf if link_to == DIRECTORY_TYPE_BACKUP: - old_conf = dir_def['conf_dir'] - backup_dir = _get_backup_conf_directory(old_conf) - Link(new_symlink, to = backup_dir) + Link(new_symlink, to=backup_dir) else: - Link(new_symlink, to = dir_def['current_dir']) + Link(new_symlink, to=dir_def['current_dir']) + + #HACK + if package in ["atlas", ]: + Logger.info("Seeding the new conf symlink {0} from the old backup directory {1} in case any " + "unmanaged artifacts are needed.".format(new_symlink, backup_dir)) + # If /etc/[component]/conf.backup exists, then copy any artifacts not managed by Ambari to the new symlink target + # Be careful not to clobber any existing files. + Execute(as_sudo(["cp", "-R", "--no-clobber", os.path.join(backup_dir, "*"), new_symlink], auto_escape=False), + only_if=format("test -e {new_symlink}")) except Exception, e: Logger.warning("Could not change symlink for package {0} to point to {1} directory. Error: {2}".format(package, link_to, e)) http://git-wip-us.apache.org/repos/asf/ambari/blob/1efc99c5/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py index 434ef51..1bfa173 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py +++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py @@ -89,6 +89,7 @@ class TestHookAfterInstall(RMFTestCase): self.assertResourceCalled('Execute', ('cp', '-R', '-p', conf_dir, conf_backup_dir), not_if = 'test -e ' + conf_backup_dir, sudo = True,) + for dir_def in dir_defs: conf_dir = dir_def['conf_dir'] current_dir = dir_def['current_dir'] @@ -97,6 +98,11 @@ class TestHookAfterInstall(RMFTestCase): self.assertResourceCalled('Link', conf_dir, to = current_dir,) + #HACK for Atlas + if package in ["atlas", ]: + self.assertResourceCalled('Execute', 'ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E cp -R --no-clobber /etc/atlas/conf.backup/* /etc/atlas/conf', + only_if = 'test -e ' + "/etc/atlas/conf") + self.assertNoMoreResources() @patch("shared_initialization.load_version", new = MagicMock(return_value="2.3.0.0-1243")) @@ -150,6 +156,7 @@ class TestHookAfterInstall(RMFTestCase): self.assertResourceCalled('Execute', ('cp', '-R', '-p', conf_dir, conf_backup_dir), not_if = 'test -e ' + conf_backup_dir, sudo = True,) + for dir_def in dir_defs: conf_dir = dir_def['conf_dir'] current_dir = dir_def['current_dir'] @@ -158,6 +165,11 @@ class TestHookAfterInstall(RMFTestCase): self.assertResourceCalled('Link', conf_dir, to = current_dir,) + #HACK for Atlas + if package in ["atlas", ]: + self.assertResourceCalled('Execute', 'ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E cp -R --no-clobber /etc/atlas/conf.backup/* /etc/atlas/conf', + only_if = 'test -e ' + "/etc/atlas/conf") + self.assertNoMoreResources() @@ -244,6 +256,7 @@ class TestHookAfterInstall(RMFTestCase): self.assertResourceCalled('Execute', ('cp', '-R', '-p', conf_dir, conf_backup_dir), not_if = 'test -e ' + conf_backup_dir, sudo = True,) + for dir_def in dir_defs: conf_dir = dir_def['conf_dir'] current_dir = dir_def['current_dir'] @@ -252,6 +265,11 @@ class TestHookAfterInstall(RMFTestCase): self.assertResourceCalled('Link', conf_dir, to = current_dir,) + #HACK for Atlas + if package in ["atlas", ]: + self.assertResourceCalled('Execute', 'ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E cp -R --no-clobber /etc/atlas/conf.backup/* /etc/atlas/conf', + only_if = 'test -e ' + "/etc/atlas/conf") + self.assertNoMoreResources()