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-12512. On a host with no clients installed, host components fails to start (aonishuk)
Date Thu, 23 Jul 2015 10:49:36 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 d2192bcfc -> 5da86c187
  refs/heads/trunk 47879c7ca -> 097fffa34


AMBARI-12512. On a host with no clients installed, host components fails to start (aonishuk)


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

Branch: refs/heads/trunk
Commit: 097fffa34517d100fa42c0ba5edaef0a214c283d
Parents: 47879c7
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Thu Jul 23 13:49:24 2015 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Thu Jul 23 13:49:24 2015 +0300

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py     | 3 +--
 .../HDP/2.0.6/hooks/before-START/scripts/rack_awareness.py  | 9 +++++++--
 .../stacks/2.0.6/hooks/before-START/test_before_start.py    | 8 +++++++-
 3 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/097fffa3/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py
index 064b535..f21e4b1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py
@@ -33,8 +33,7 @@ class BeforeStartHook(Hook):
     setup_hadoop()
     setup_configs()
     create_javahome_symlink()
-    if params.has_namenode:
-      create_topology_script_and_mapping()
+    create_topology_script_and_mapping()
 
 if __name__ == "__main__":
   BeforeStartHook().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/097fffa3/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/rack_awareness.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/rack_awareness.py
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/rack_awareness.py
index 6b0bff6..d24eb49 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/rack_awareness.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/rack_awareness.py
@@ -19,6 +19,7 @@ limitations under the License.
 '''
 from resource_management.core.resources import File
 from resource_management.core.source import StaticFile, Template
+from resource_management.libraries.functions import format
 
 def create_topology_mapping():
   import params
@@ -27,7 +28,9 @@ def create_topology_mapping():
   File(params.net_topology_mapping_data_file_path,
        content=Template("topology_mappings.data.j2"),
        owner=params.hdfs_user,
-       group=params.user_group
+       group=params.user_group,
+       # if there is no hadoop components, don't create the script
+       only_if=format("test -d {net_topology_script_dir}"),
   )
 
 def create_topology_script():
@@ -35,7 +38,9 @@ def create_topology_script():
   # installing the topology script to the specified location
   File(params.net_topology_script_file_path,
        content=StaticFile('topology_script.py'),
-       mode=0755)
+       mode=0755,
+       only_if=format("test -d {net_topology_script_dir}"),
+  )
 
 def create_topology_script_and_mapping():
   create_topology_mapping()

http://git-wip-us.apache.org/repos/asf/ambari/blob/097fffa3/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py
b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py
index df39d2f..00022ae 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py
@@ -91,10 +91,12 @@ class TestHookBeforeStart(RMFTestCase):
       owner = 'hdfs',
       content = Template('topology_mappings.data.j2'),
       group = 'hadoop',
+      only_if = 'test -d /etc/hadoop/conf',
     )
     self.assertResourceCalled('File', '/etc/hadoop/conf/topology_script.py',
       content = StaticFile('topology_script.py'),
       mode = 0755,
+      only_if = 'test -d /etc/hadoop/conf',
     )
     self.assertNoMoreResources()
 
@@ -162,15 +164,17 @@ class TestHookBeforeStart(RMFTestCase):
                               owner = 'hdfs',
                               content = Template('topology_mappings.data.j2'),
                               group = 'hadoop',
+                              only_if = 'test -d /etc/hadoop/conf',
                               )
     self.assertResourceCalled('File', '/etc/hadoop/conf/topology_script.py',
                               content = StaticFile('topology_script.py'),
                               mode = 0755,
+                              only_if = 'test -d /etc/hadoop/conf',
                               )
     self.assertNoMoreResources()
 
   def test_hook_default_hdfs(self):
-    config_file = "stacks/2.0.6/configs/default.json"
+    config_file = self._getStackTestsFolder() + "/2.0.6/configs/default.json"
     with open(config_file, "r") as f:
       default_json = json.load(f)
 
@@ -238,10 +242,12 @@ class TestHookBeforeStart(RMFTestCase):
                               owner = 'hdfs',
                               content = Template('topology_mappings.data.j2'),
                               group = 'hadoop',
+                              only_if = 'test -d /etc/hadoop/conf',
                               )
     self.assertResourceCalled('File', '/etc/hadoop/conf/topology_script.py',
                               content = StaticFile('topology_script.py'),
                               mode = 0755,
+                              only_if = 'test -d /etc/hadoop/conf',
                               )
     self.assertNoMoreResources()
 


Mime
View raw message