From 2bfe175c310d96c6a0cf328e736a6b2a5ff0747f Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Tue, 20 Mar 2012 10:31:41 +0100 Subject: [PATCH] Do not return unexpected details --- .../portal_skins/erp5_promise/Alarm_checkPromiseBt5.xml | 6 ++++-- .../erp5_promise/Alarm_checkPromiseConversionServer.xml | 5 ++++- .../erp5_promise/Alarm_checkPromiseKumofsServer.xml | 4 +++- .../erp5_promise/Alarm_checkPromiseMailServer.xml | 4 +++- .../erp5_promise/Alarm_checkPromiseMemcachedServer.xml | 7 +++++-- .../erp5_promise/Alarm_checkPromiseTemplateTool.xml | 7 +++++-- bt5/erp5_promise/bt/revision | 2 +- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseBt5.xml b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseBt5.xml index 3e485d3bc0..31426ab4cd 100644 --- a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseBt5.xml +++ b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseBt5.xml @@ -72,12 +72,14 @@ bt5_list = portal.portal_templates.resolveBusinessTemplateListDependency(bt5.spl severity = len(bt5_list)\n if severity == 0:\n summary = "Nothing to do."\n + detail = "Needed to install %s" % \', \'.join([x[1] for x in bt5_list])\n else:\n summary = "Upgrade needed"\n + detail = ""\n active_result.edit(\n summary=summary, \n - severity=severity, \n - detail="Needed to install %s" % \', \'.join([x[1] for x in bt5_list]))\n + severity=severity,\n + detail=detail)\n \n context.newActiveProcess().postResult(active_result)\n </string> </value> diff --git a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseConversionServer.xml b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseConversionServer.xml index 760b7caee4..6dfbd27fc6 100644 --- a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseConversionServer.xml +++ b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseConversionServer.xml @@ -66,14 +66,17 @@ active_result = ActiveResult()\n if promise_url != url:\n severity = 1\n summary = "Conversion Server not configured as expected"\n + detail = "Expect %s\\nGot %s" % (promise_url, url)\n else:\n severity = 0\n summary = "Nothing to do."\n + detail = ""\n \n active_result.edit(\n summary=summary, \n severity=severity, \n - detail="Expect %s\\nGot %s" % (promise_url, url))\n + detail=detail)\n +\n \n context.newActiveProcess().postResult(active_result)\n </string> </value> diff --git a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseKumofsServer.xml b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseKumofsServer.xml index 6b0a290e85..73246ad064 100644 --- a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseKumofsServer.xml +++ b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseKumofsServer.xml @@ -58,7 +58,9 @@ promise_url = portal.getPromiseParameter(\'external_service\', \'kumofs_url\')\n if promise_url is None:\n return\n \n -plugin = portal.portal_memcached.persistent_memcached_plugin\n +plugin = portal.portal_memcached.restrictedTraverse("persistent_memcached_plugin", None)\n +if plugin is None:\n + return\n \n url = "memcached://%s/" % plugin.getUrlString()\n \n diff --git a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseMailServer.xml b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseMailServer.xml index dead25d9d7..654a42f4f1 100644 --- a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseMailServer.xml +++ b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseMailServer.xml @@ -77,14 +77,16 @@ active_result = ActiveResult()\n if promise_url != url:\n severity = 1\n summary = "SMTP Server not configured as expected"\n + detail = "Expect %s\\nGot %s" % (promise_url, url)\n else:\n severity = 0\n summary = "Nothing to do."\n + detail = ""\n \n active_result.edit(\n summary=summary, \n severity=severity, \n - detail="Expect %s\\nGot %s" % (promise_url, url))\n + detail=detail)\n \n context.newActiveProcess().postResult(active_result)\n </string> </value> diff --git a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseMemcachedServer.xml b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseMemcachedServer.xml index 4e165e74d6..30cfeafddd 100644 --- a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseMemcachedServer.xml +++ b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseMemcachedServer.xml @@ -67,14 +67,17 @@ active_result = ActiveResult()\n if promise_url != url:\n severity = 1\n summary = "Memcached not configured as expected"\n + detail = "Expect %s\\nGot %s" % (promise_url, url)\n else:\n severity = 0\n summary = "Nothing to do."\n + detail = ""\n \n active_result.edit(\n summary=summary, \n - severity=severity, \n - detail="Expect %s\\nGot %s" % (promise_url, url))\n + severity=severity,\n + detail=detail)\n +\n \n context.newActiveProcess().postResult(active_result)\n </string> </value> diff --git a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseTemplateTool.xml b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseTemplateTool.xml index f9d0594545..d790b7284f 100644 --- a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseTemplateTool.xml +++ b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseTemplateTool.xml @@ -72,14 +72,17 @@ active_result = ActiveResult()\n if repository_list != promise_repository_list:\n severity = 1\n summary = "Template tool not configured as expected"\n + detail = \'\\n\'.join(promise_repository_list)\n else:\n severity = 0\n summary = "Nothing to do."\n + detail = ""\n \n active_result.edit(\n summary=summary, \n - severity=severity, \n - detail=\'\\n\'.join(promise_repository_list))\n + severity=severity,\n + detail=detail)\n +\n \n context.newActiveProcess().postResult(active_result)\n </string> </value> diff --git a/bt5/erp5_promise/bt/revision b/bt5/erp5_promise/bt/revision index 56a6051ca2..d8263ee986 100644 --- a/bt5/erp5_promise/bt/revision +++ b/bt5/erp5_promise/bt/revision @@ -1 +1 @@ -1 \ No newline at end of file +2 \ No newline at end of file -- 2.30.9