ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject git commit: AMBARI-5264. Ganglia Server goes to "installed" state after double "Ganglia rrdcached base directory" config changing.(vbrodetskyi)
Date Fri, 28 Mar 2014 17:23:04 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 28b31ba02 -> bdddb9bb0


AMBARI-5264. Ganglia Server goes to "installed" state after double "Ganglia rrdcached base
directory" config changing.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: bdddb9bb0d2ba5420de644fe7418973e1d0f3d61
Parents: 28b31ba
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Fri Mar 28 19:22:24 2014 +0200
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Fri Mar 28 19:22:49 2014 +0200

----------------------------------------------------------------------
 .../GANGLIA/package/scripts/ganglia_server.py   | 24 ++++++++++++++------
 .../GANGLIA/package/scripts/ganglia_server.py   | 24 ++++++++++++++------
 .../stacks/1.3.2/GANGLIA/test_ganglia_server.py | 22 +++++++++++++++++-
 .../stacks/2.0.6/GANGLIA/test_ganglia_server.py | 22 +++++++++++++++++-
 4 files changed, 76 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bdddb9bb/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/scripts/ganglia_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/scripts/ganglia_server.py
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/scripts/ganglia_server.py
index b27bf61..030a627 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/scripts/ganglia_server.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/GANGLIA/package/scripts/ganglia_server.py
@@ -164,19 +164,29 @@ def server_files():
        mode=0755
   )
   rrd_file_owner = params.gmetad_user
-  if params.rrdcached_default_base_dir != params.rrdcached_base_dir:
+
+  if not os.path.exists(params.rrdcached_base_dir) or (os.path.islink(params.rrdcached_default_base_dir)
+                                                    and params.rrdcached_default_base_dir
== params.rrdcached_base_dir):
+    if os.path.islink(params.rrdcached_default_base_dir):
+      Link(params.rrdcached_default_base_dir,
+           action = "delete"
+      )
+    else:
+      Directory(params.rrdcached_default_base_dir,
+                action = "delete"
+      )
+
     Directory(params.rrdcached_base_dir,
               owner=rrd_file_owner,
               group=rrd_file_owner,
               mode=0755,
               recursive=True
     )
-    Directory(params.rrdcached_default_base_dir,
-              action = "delete"
-    )
-    Link(params.rrdcached_default_base_dir,
-         to=params.rrdcached_base_dir
-    )
+
+    if params.rrdcached_default_base_dir != params.rrdcached_base_dir:
+      Link(params.rrdcached_default_base_dir,
+           to=params.rrdcached_base_dir
+      )
   elif rrd_file_owner != 'nobody':
     Directory(params.rrdcached_default_base_dir,
               owner=rrd_file_owner,

http://git-wip-us.apache.org/repos/asf/ambari/blob/bdddb9bb/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/scripts/ganglia_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/scripts/ganglia_server.py
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/scripts/ganglia_server.py
index a1c1b41..2cf8e7b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/scripts/ganglia_server.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/GANGLIA/package/scripts/ganglia_server.py
@@ -200,19 +200,29 @@ def server_files():
        mode=0755
   )
   rrd_file_owner = params.gmetad_user
-  if params.rrdcached_default_base_dir != params.rrdcached_base_dir:
+
+  if not os.path.exists(params.rrdcached_base_dir) or (os.path.islink(params.rrdcached_default_base_dir)
+                                                    and params.rrdcached_default_base_dir
== params.rrdcached_base_dir):
+    if os.path.islink(params.rrdcached_default_base_dir):
+      Link(params.rrdcached_default_base_dir,
+           action = "delete"
+      )
+    else:
+      Directory(params.rrdcached_default_base_dir,
+                action = "delete"
+      )
+
     Directory(params.rrdcached_base_dir,
               owner=rrd_file_owner,
               group=rrd_file_owner,
               mode=0755,
               recursive=True
     )
-    Directory(params.rrdcached_default_base_dir,
-              action = "delete"
-    )
-    Link(params.rrdcached_default_base_dir,
-         to=params.rrdcached_base_dir
-    )
+
+    if params.rrdcached_default_base_dir != params.rrdcached_base_dir:
+      Link(params.rrdcached_default_base_dir,
+           to=params.rrdcached_base_dir
+      )
   elif rrd_file_owner != 'nobody':
     Directory(params.rrdcached_default_base_dir,
               owner=rrd_file_owner,

http://git-wip-us.apache.org/repos/asf/ambari/blob/bdddb9bb/ambari-server/src/test/python/stacks/1.3.2/GANGLIA/test_ganglia_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.2/GANGLIA/test_ganglia_server.py b/ambari-server/src/test/python/stacks/1.3.2/GANGLIA/test_ganglia_server.py
index 9e7630c..db48ceb 100644
--- a/ambari-server/src/test/python/stacks/1.3.2/GANGLIA/test_ganglia_server.py
+++ b/ambari-server/src/test/python/stacks/1.3.2/GANGLIA/test_ganglia_server.py
@@ -19,8 +19,10 @@ limitations under the License.
 '''
 
 from stacks.utils.RMFTestCase import *
+from mock.mock import MagicMock, call, patch
 
-
+@patch("os.path.exists", new = MagicMock(return_value=False))
+@patch("os.path.islink", new = MagicMock(return_value=False))
 class TestGangliaServer(RMFTestCase):
 
   def test_configure_default(self):
@@ -236,6 +238,15 @@ class TestGangliaServer(RMFTestCase):
                           content = StaticFile('rrd.py'),
                           mode = 0755,)
 
+    self.assertResourceCalled('Directory', '/var/lib/ganglia/rrds',
+                              action = ['delete'],
+                              )
+    self.assertResourceCalled('Directory', '/var/lib/ganglia/rrds',
+                              owner = 'nobody',
+                              group = 'nobody',
+                              recursive = True,
+                              mode = 0755,
+                              )
     self.assertResourceCalled('File', '/etc/ganglia/gmetad.conf',
                           owner = 'root',
                           group = 'hadoop',)
@@ -415,6 +426,15 @@ class TestGangliaServer(RMFTestCase):
                               content = StaticFile('rrd.py'),
                               mode = 0755,
                               )
+    self.assertResourceCalled('Directory', '/var/lib/ganglia/rrds',
+                              action = ['delete'],
+                              )
+    self.assertResourceCalled('Directory', '/var/lib/ganglia/rrds',
+                              owner = 'nobody',
+                              group = 'nobody',
+                              recursive = True,
+                              mode = 0755,
+                              )
     self.assertResourceCalled('File', '/etc/ganglia/gmetad.conf',
                               owner = 'root',
                               group = 'hadoop',

http://git-wip-us.apache.org/repos/asf/ambari/blob/bdddb9bb/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py b/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py
index 82cedd8..02694bc 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py
@@ -19,8 +19,10 @@ limitations under the License.
 '''
 
 from stacks.utils.RMFTestCase import *
+from mock.mock import MagicMock, call, patch
 
-
+@patch("os.path.exists", new = MagicMock(return_value=False))
+@patch("os.path.islink", new = MagicMock(return_value=False))
 class TestGangliaServer(RMFTestCase):
 
   def test_configure_default(self):
@@ -223,6 +225,15 @@ class TestGangliaServer(RMFTestCase):
                           content = StaticFile('rrd.py'),
                           mode = 0755,)
 
+    self.assertResourceCalled('Directory', '/var/lib/ganglia/rrds',
+                              action = ['delete'],
+                              )
+    self.assertResourceCalled('Directory', '/var/lib/ganglia/rrds',
+                              owner = 'nobody',
+                              group = 'nobody',
+                              recursive = True,
+                              mode = 0755,
+                              )
     self.assertResourceCalled('File', '/etc/ganglia/gmetad.conf',
                           owner = 'root',
                           group = 'hadoop',)
@@ -390,6 +401,15 @@ class TestGangliaServer(RMFTestCase):
                               content = StaticFile('rrd.py'),
                               mode = 0755,
                               )
+    self.assertResourceCalled('Directory', '/var/lib/ganglia/rrds',
+                              action = ['delete'],
+                              )
+    self.assertResourceCalled('Directory', '/var/lib/ganglia/rrds',
+                              owner = 'nobody',
+                              group = 'nobody',
+                              recursive = True,
+                              mode = 0755,
+                              )
     self.assertResourceCalled('File', '/etc/ganglia/gmetad.conf',
                               owner = 'root',
                               group = 'hadoop',


Mime
View raw message