ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mug...@apache.org
Subject ambari git commit: AMBARI-19524 : Use stack-level Atlas conf directory instead of hard-coded /etc/atlas/conf path (Vishal Suvagia via mugdha)
Date Tue, 31 Jan 2017 06:08:27 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 2f06c1cef -> 7617c4e1c


AMBARI-19524 : Use stack-level Atlas conf directory instead of hard-coded /etc/atlas/conf
path (Vishal Suvagia via mugdha)


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

Branch: refs/heads/trunk
Commit: 7617c4e1cddceed3e567385b40731a8b8c58d3bc
Parents: 2f06c1c
Author: Vishal Suvagia <vsuvagia@hortonworks.com>
Authored: Fri Jan 27 20:29:33 2017 +0530
Committer: Mugdha Varadkar <mugdha@apache.org>
Committed: Tue Jan 31 11:37:39 2017 +0530

----------------------------------------------------------------------
 .../stacks/2.3/ATLAS/test_metadata_server.py    | 65 ++++++++++----------
 1 file changed, 32 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7617c4e1/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py b/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
index 8ae6469..1bbf75e 100644
--- a/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
+++ b/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
@@ -19,6 +19,7 @@ limitations under the License.
 '''
 
 from mock.mock import MagicMock, call, patch
+from resource_management.libraries.script.script import Script
 from stacks.utils.RMFTestCase import *
 import json
 import sys
@@ -29,16 +30,16 @@ from only_for_platform import not_for_platform, PLATFORM_WINDOWS
 class TestMetadataServer(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "ATLAS/0.1.0.2.3/package"
   STACK_VERSION = "2.3"
-
+  stack_root = Script.get_stack_root()
+  conf_dir = stack_root + "/current/atlas-server/conf"
   def configureResourcesCalled(self):
       # Both server and client
-      self.assertResourceCalled('Directory', '/usr/hdp/current/atlas-server/conf',
+      self.assertResourceCalled('Directory', self.conf_dir,
                                 owner='atlas',
                                 group='hadoop',
                                 create_parents = True,
                                 cd_access='a',
-                                mode=0755
-      )
+                                mode=0755)
 
       # Pid dir
       self.assertResourceCalled('Directory', '/var/run/atlas',
@@ -48,7 +49,7 @@ class TestMetadataServer(RMFTestCase):
                                 cd_access='a',
                                 mode=0755
       )
-      self.assertResourceCalled('Directory', '/usr/hdp/current/atlas-server/conf/solr',
+      self.assertResourceCalled('Directory', self.conf_dir + "/solr",
                                 owner='atlas',
                                 group='hadoop',
                                 create_parents = True,
@@ -65,7 +66,7 @@ class TestMetadataServer(RMFTestCase):
                                 mode=0755
       )
       # Data dir
-      self.assertResourceCalled('Directory', '/usr/hdp/current/atlas-server/data',
+      self.assertResourceCalled('Directory', self.stack_root+"/current/atlas-server/data",
                                 owner='atlas',
                                 group='hadoop',
                                 create_parents = True,
@@ -73,15 +74,15 @@ class TestMetadataServer(RMFTestCase):
                                 mode=0644
       )
       # Expanded war dir
-      self.assertResourceCalled('Directory', '/usr/hdp/current/atlas-server/server/webapp',
+      self.assertResourceCalled('Directory', self.stack_root+'/current/atlas-server/server/webapp',
                                 owner='atlas',
                                 group='hadoop',
                                 create_parents = True,
                                 cd_access='a',
                                 mode=0644
       )
-      self.assertResourceCalled('File', '/usr/hdp/current/atlas-server/server/webapp/atlas.war',
-          content = StaticFile('/usr/hdp/current/atlas-server/server/webapp/atlas.war'),
+      self.assertResourceCalled('File', self.stack_root+'/current/atlas-server/server/webapp/atlas.war',
+          content = StaticFile(self.stack_root+'/current/atlas-server/server/webapp/atlas.war'),
       )
       host_name = u"c6401.ambari.apache.org"
       app_props =  dict(self.getConfig()['configurations']['application-properties'])
@@ -94,7 +95,7 @@ class TestMetadataServer(RMFTestCase):
       app_props["atlas.server.address.id1"] = u"%s:%s" % (host_name, metadata_port)
       app_props["atlas.server.ha.enabled"] = "false"
 
-      self.assertResourceCalled('File', '/usr/hdp/current/atlas-server/conf/atlas-log4j.xml',
+      self.assertResourceCalled('File', str(self.conf_dir + "/atlas-log4j.xml"),
                           content=InlineTemplate(
                             self.getConfig()['configurations'][
                               'atlas-log4j']['content']),
@@ -102,7 +103,7 @@ class TestMetadataServer(RMFTestCase):
                           group='hadoop',
                           mode=0644,
       )
-      self.assertResourceCalled('File', '/usr/hdp/current/atlas-server/conf/atlas-env.sh',
+      self.assertResourceCalled('File', str(self.conf_dir + "/atlas-env.sh"),
                                 content=InlineTemplate(
                                     self.getConfig()['configurations'][
                                         'atlas-env']['content']),
@@ -110,7 +111,7 @@ class TestMetadataServer(RMFTestCase):
                                 group='hadoop',
                                 mode=0755,
       )
-      self.assertResourceCalled('File', '/usr/hdp/current/atlas-server/conf/solr/solrconfig.xml',
+      self.assertResourceCalled('File', str(self.conf_dir + "/solr/solrconfig.xml"),
                                 content=InlineTemplate(
                                     self.getConfig()['configurations'][
                                       'atlas-solrconfig']['content']),
@@ -119,8 +120,7 @@ class TestMetadataServer(RMFTestCase):
                                 mode=0644,
       )
       # application.properties file
-      self.assertResourceCalled('PropertiesFile',
-                                '/usr/hdp/current/atlas-server/conf/application.properties',
+      self.assertResourceCalled('PropertiesFile',str(self.conf_dir + "/application.properties"),
                                 properties=app_props,
                                 owner=u'atlas',
                                 group=u'hadoop',
@@ -156,7 +156,7 @@ class TestMetadataServer(RMFTestCase):
                                       only_if='test -d /tmp/solr_config_atlas_configs_0.[0-9]*')
       self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45
/usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr
--upload-config --config-dir /tmp/solr_config_atlas_configs_0.[0-9]* --config-set atlas_configs
--retry 30 --interval 5',
                                       only_if='test -d /tmp/solr_config_atlas_configs_0.[0-9]*')
-      self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45
/usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr
--upload-config --config-dir /usr/hdp/current/atlas-server/conf/solr --config-set atlas_configs
--retry 30 --interval 5',
+      self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45
/usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr
--upload-config --config-dir {0}/solr --config-set atlas_configs --retry 30 --interval 5'.format(self.conf_dir),
                                       not_if='test -d /tmp/solr_config_atlas_configs_0.[0-9]*')
       self.assertResourceCalledRegexp('^Directory$', '^/tmp/solr_config_atlas_configs_0.[0-9]*',
                                       action=['delete'],
@@ -168,7 +168,7 @@ class TestMetadataServer(RMFTestCase):
 
   def configureResourcesCalledSecure(self):
     # Both server and client
-    self.assertResourceCalled('Directory', '/usr/hdp/current/atlas-server/conf',
+    self.assertResourceCalled('Directory', self.conf_dir,
                               owner='atlas',
                               group='hadoop',
                               create_parents = True,
@@ -184,7 +184,7 @@ class TestMetadataServer(RMFTestCase):
                               cd_access='a',
                               mode=0755
     )
-    self.assertResourceCalled('Directory', '/usr/hdp/current/atlas-server/conf/solr',
+    self.assertResourceCalled('Directory', self.conf_dir + "/solr",
                               owner='atlas',
                               group='hadoop',
                               create_parents = True,
@@ -201,7 +201,7 @@ class TestMetadataServer(RMFTestCase):
                               mode=0755
     )
     # Data dir
-    self.assertResourceCalled('Directory', '/usr/hdp/current/atlas-server/data',
+    self.assertResourceCalled('Directory', self.stack_root+'/current/atlas-server/data',
                               owner='atlas',
                               group='hadoop',
                               create_parents = True,
@@ -209,15 +209,15 @@ class TestMetadataServer(RMFTestCase):
                               mode=0644
     )
     # Expanded war dir
-    self.assertResourceCalled('Directory', '/usr/hdp/current/atlas-server/server/webapp',
+    self.assertResourceCalled('Directory', self.stack_root+'/current/atlas-server/server/webapp',
                               owner='atlas',
                               group='hadoop',
                               create_parents = True,
                               cd_access='a',
                               mode=0644
     )
-    self.assertResourceCalled('File', '/usr/hdp/current/atlas-server/server/webapp/atlas.war',
-                              content = StaticFile('/usr/hdp/current/atlas-server/server/webapp/atlas.war'),
+    self.assertResourceCalled('File', self.stack_root+'/current/atlas-server/server/webapp/atlas.war',
+                              content = StaticFile(self.stack_root+'/current/atlas-server/server/webapp/atlas.war'),
                               )
     host_name = u"c6401.ambari.apache.org"
     app_props =  dict(self.getConfig()['configurations']['application-properties'])
@@ -230,7 +230,7 @@ class TestMetadataServer(RMFTestCase):
     app_props["atlas.server.address.id1"] = u"%s:%s" % (host_name, metadata_port)
     app_props["atlas.server.ha.enabled"] = "false"
 
-    self.assertResourceCalled('File', '/usr/hdp/current/atlas-server/conf/atlas-log4j.xml',
+    self.assertResourceCalled('File', self.conf_dir + "/atlas-log4j.xml",
                               content=InlineTemplate(
                                 self.getConfig()['configurations'][
                                   'atlas-log4j']['content']),
@@ -238,7 +238,7 @@ class TestMetadataServer(RMFTestCase):
                               group='hadoop',
                               mode=0644,
                               )
-    self.assertResourceCalled('File', '/usr/hdp/current/atlas-server/conf/atlas-env.sh',
+    self.assertResourceCalled('File', self.conf_dir + "/atlas-env.sh",
                               content=InlineTemplate(
                                 self.getConfig()['configurations'][
                                   'atlas-env']['content']),
@@ -246,7 +246,7 @@ class TestMetadataServer(RMFTestCase):
                               group='hadoop',
                               mode=0755,
                               )
-    self.assertResourceCalled('File', '/usr/hdp/current/atlas-server/conf/solr/solrconfig.xml',
+    self.assertResourceCalled('File', self.conf_dir+"/solr/solrconfig.xml",
                               content=InlineTemplate(
                                 self.getConfig()['configurations'][
                                   'atlas-solrconfig']['content']),
@@ -255,15 +255,14 @@ class TestMetadataServer(RMFTestCase):
                               mode=0644,
                               )
     # application.properties file
-    self.assertResourceCalled('PropertiesFile',
-                              '/usr/hdp/current/atlas-server/conf/application.properties',
+    self.assertResourceCalled('PropertiesFile',self.conf_dir + "/application.properties",
                               properties=app_props,
                               owner=u'atlas',
                               group=u'hadoop',
                               mode=0644,
                               )
 
-    self.assertResourceCalled('TemplateConfig', '/usr/hdp/current/atlas-server/conf/atlas_jaas.conf',
+    self.assertResourceCalled('TemplateConfig', self.conf_dir+"/atlas_jaas.conf",
                               owner = 'atlas',
                               )
 
@@ -298,7 +297,7 @@ class TestMetadataServer(RMFTestCase):
                                     only_if='test -d /tmp/solr_config_atlas_configs_0.[0-9]*')
     self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45
/usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr
--upload-config --config-dir /tmp/solr_config_atlas_configs_0.[0-9]* --config-set atlas_configs
--retry 30 --interval 5',
                                     only_if='test -d /tmp/solr_config_atlas_configs_0.[0-9]*')
-    self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45
/usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr
--upload-config --config-dir /usr/hdp/current/atlas-server/conf/solr --config-set atlas_configs
--retry 30 --interval 5',
+    self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45
/usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr
--upload-config --config-dir {0}/solr --config-set atlas_configs --retry 30 --interval 5'.format(self.conf_dir),
                                     not_if='test -d /tmp/solr_config_atlas_configs_0.[0-9]*')
     self.assertResourceCalledRegexp('^Directory$', '^/tmp/solr_config_atlas_configs_0.[0-9]*',
                                     action=['delete'],
@@ -324,7 +323,7 @@ class TestMetadataServer(RMFTestCase):
                               group = "hadoop",
                               content=Template("atlas_hbase_setup.rb.j2"))
 
-    self.assertResourceCalled('File', '/usr/hdp/current/atlas-server/conf/hdfs-site.xml',action
= ['delete'],)
+    self.assertResourceCalled('File', str(self.conf_dir+"/hdfs-site.xml"),action = ['delete'],)
 
     self.assertNoMoreResources()
 
@@ -344,7 +343,7 @@ class TestMetadataServer(RMFTestCase):
                               group = "hadoop",
                               content=Template("atlas_hbase_setup.rb.j2"))
 
-    self.assertResourceCalled('File', '/usr/hdp/current/atlas-server/conf/hdfs-site.xml',action
= ['delete'],)
+    self.assertResourceCalled('File', str(self.conf_dir+"/hdfs-site.xml"),action = ['delete'],)
 
 
     self.assertNoMoreResources()
@@ -364,10 +363,10 @@ class TestMetadataServer(RMFTestCase):
                               group = "hadoop",
                               content=Template("atlas_hbase_setup.rb.j2"))
 
-    self.assertResourceCalled('File', '/usr/hdp/current/atlas-server/conf/hdfs-site.xml',action
= ['delete'],)
+    self.assertResourceCalled('File', str(self.conf_dir+"/hdfs-site.xml"),action = ['delete'],)
 
 
-    self.assertResourceCalled('Execute', 'source /usr/hdp/current/atlas-server/conf/atlas-env.sh
; /usr/hdp/current/atlas-server/bin/atlas_start.py',
+    self.assertResourceCalled('Execute', 'source {0}/atlas-env.sh ; {1}/current/atlas-server/bin/atlas_start.py'.format(self.conf_dir,self.stack_root),
                               not_if = 'ls /var/run/atlas/atlas.pid >/dev/null 2>&1
&& ps -p `cat /var/run/atlas/atlas.pid` >/dev/null 2>&1',
                               user = 'atlas',
     )
@@ -383,7 +382,7 @@ class TestMetadataServer(RMFTestCase):
                        stack_version = self.STACK_VERSION,
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
-    self.assertResourceCalled('Execute', 'source /usr/hdp/current/atlas-server/conf/atlas-env.sh;
/usr/hdp/current/atlas-server/bin/atlas_stop.py',
+    self.assertResourceCalled('Execute', 'source {0}/atlas-env.sh; {1}/current/atlas-server/bin/atlas_stop.py'.format(self.conf_dir,self.stack_root),
                               user = 'atlas',
     )
     self.assertResourceCalled('File', '/var/run/atlas/atlas.pid',


Mime
View raw message