ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alejan...@apache.org
Subject ambari git commit: AMBARI-65080. ADDENDUM. Atlas web UI inaccessible alert after adding Atlas service on upgraded cluster (alejandro)
Date Thu, 15 Sep 2016 21:50:01 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 cc39d115b -> 6950af1a5


AMBARI-65080. ADDENDUM. Atlas web UI inaccessible alert after adding Atlas service on upgraded
cluster (alejandro)


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

Branch: refs/heads/branch-2.5
Commit: 6950af1a50024d48c56023f033ec9126f301a746
Parents: cc39d11
Author: Alejandro Fernandez <afernandez@hortonworks.com>
Authored: Thu Sep 15 14:54:59 2016 -0700
Committer: Alejandro Fernandez <afernandez@hortonworks.com>
Committed: Thu Sep 15 14:54:59 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/6950af1a/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/<component>/conf -> <stack-root>/current/<component>/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 -> <stack-root>/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/6950af1a/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()
 
 


Mime
View raw message