ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From avija...@apache.org
Subject ambari git commit: AMBARI-15413 : Metrics Grafana Failed to start (avijayan)
Date Tue, 15 Mar 2016 01:16:47 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 3eb766410 -> d4b76ad92


AMBARI-15413 : Metrics Grafana Failed to start (avijayan)


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

Branch: refs/heads/trunk
Commit: d4b76ad92e6a06d65c34fc28704791d205b1f54e
Parents: 3eb7664
Author: Aravindan Vijayan <avijayan@hortonworks.com>
Authored: Mon Mar 14 18:16:41 2016 -0700
Committer: Aravindan Vijayan <avijayan@hortonworks.com>
Committed: Mon Mar 14 18:16:41 2016 -0700

----------------------------------------------------------------------
 .../AMBARI_METRICS/0.1.0/package/scripts/ams.py         | 11 ++++++-----
 .../0.1.0/package/scripts/metrics_grafana.py            | 12 +++---------
 .../0.1.0/package/scripts/metrics_grafana_util.py       |  1 +
 .../stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py |  4 ----
 4 files changed, 10 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d4b76ad9/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
index cbdcf45..c256ce7 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
@@ -177,7 +177,7 @@ def ams(name=None):
 
 
 @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
-def ams(name=None):
+def ams(name=None, action=None):
   import params
 
   if name == 'collector':
@@ -420,10 +420,11 @@ def ams(name=None):
          content=InlineTemplate(params.ams_grafana_ini_template)
          )
 
-    for dir in ams_grafana_directories:
-      Execute(('chown', '-R', params.ams_user, dir),
-              sudo=True
-              )
+    if action != 'stop':
+      for dir in ams_grafana_directories:
+        Execute(('chown', '-R', params.ams_user, dir),
+                sudo=True
+                )
 
     if params.metric_collector_https_enabled:
       export_ca_certs(params.ams_grafana_conf_dir)

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4b76ad9/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
index 419728b..ae2a635 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
@@ -34,18 +34,13 @@ class AmsGrafana(Script):
   def configure(self, env, action = None):
     import params
     env.set_params(params)
-    ams(name='grafana')
+    ams(name='grafana', action=action)
 
   def start(self, env):
     import params
     env.set_params(params)
     self.configure(env, action = 'start')
 
-    stop_cmd = format("{ams_grafana_script} stop")
-    Execute(stop_cmd,
-            user=params.ams_user
-            )
-
     start_cmd = format("{ams_grafana_script} start")
     Execute(start_cmd,
             user=params.ams_user
@@ -59,9 +54,8 @@ class AmsGrafana(Script):
     import params
     env.set_params(params)
     self.configure(env, action = 'stop')
-    stop_cmd = format("{ams_grafana_script} stop")
-    Execute(stop_cmd,
-            user=params.ams_user
+    Execute((format("{ams_grafana_script}"), 'stop'),
+            sudo=True
             )
 
   def status(self, env):

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4b76ad9/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana_util.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana_util.py
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana_util.py
index 593591c..e5020a5 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana_util.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana_util.py
@@ -56,6 +56,7 @@ def perform_grafana_get_call(url, server):
       conn.request("GET", url, headers = headers)
       response = conn.getresponse()
       Logger.info("Http response: %s %s" % (response.status, response.reason))
+      break
     except (httplib.HTTPException, socket.error) as ex:
       if i < GRAFANA_CONNECT_TRIES - 1:
         time.sleep(GRAFANA_CONNECT_TIMEOUT)

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4b76ad9/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
b/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
index d54acc7..dee6c40 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
@@ -35,7 +35,6 @@ class TestMetricsGrafana(RMFTestCase):
 
   sys.path.append(file_path)
   global metrics_grafana_util
-  import  metrics_grafana_util
 
   @patch("metrics_grafana_util.create_ams_datasource")
   @patch("metrics_grafana_util.create_ams_dashboards")
@@ -70,9 +69,6 @@ class TestMetricsGrafana(RMFTestCase):
     )
     self.assertResourceCalled('Execute', 'ambari-sudo.sh rm -rf /some_tmp_dir',
                               )
-    self.assertResourceCalled('Execute', '/usr/sbin/ambari-metrics-grafana stop',
-                              user = 'ams'
-                              )
     self.assertResourceCalled('Execute', '/usr/sbin/ambari-metrics-grafana start',
                               user = 'ams'
                               )


Mime
View raw message