From debc5e2e5ed3eeb5f7212eba68e81703da3ab498 Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Wed, 10 Oct 2012 13:18:34 -0300
Subject: [PATCH] Included Promise for Certtificate Authority

---
 .../promise_certificate_autority_tool.xml     | 105 ++++++++++++++++++
 ...Alarm_checkPromiseCertificateAuthority.xml |  99 +++++++++++++++++
 ...arm_installPromiseCertificateAuthority.xml |  77 +++++++++++++
 bt5/erp5_promise/bt/change_log                |   3 +
 bt5/erp5_promise/bt/revision                  |   2 +-
 bt5/erp5_promise/bt/template_path_list        |   1 +
 6 files changed, 286 insertions(+), 1 deletion(-)
 create mode 100644 bt5/erp5_promise/PathTemplateItem/portal_alarms/promise_certificate_autority_tool.xml
 create mode 100644 bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseCertificateAuthority.xml
 create mode 100644 bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_installPromiseCertificateAuthority.xml

diff --git a/bt5/erp5_promise/PathTemplateItem/portal_alarms/promise_certificate_autority_tool.xml b/bt5/erp5_promise/PathTemplateItem/portal_alarms/promise_certificate_autority_tool.xml
new file mode 100644
index 0000000000..e9e0763e26
--- /dev/null
+++ b/bt5/erp5_promise/PathTemplateItem/portal_alarms/promise_certificate_autority_tool.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Alarm" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>active_sense_method_id</string> </key>
+            <value> <string>Alarm_checkPromiseCertificateAuthority</string> </value>
+        </item>
+        <item>
+            <key> <string>alarm_notification_mode</string> </key>
+            <value>
+              <tuple>
+                <string>never</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>enabled</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>promise_certificate_autority_tool</string> </value>
+        </item>
+        <item>
+            <key> <string>periodicity_day_frequency</string> </key>
+            <value> <int>1</int> </value>
+        </item>
+        <item>
+            <key> <string>periodicity_hour</string> </key>
+            <value>
+              <tuple>
+                <int>0</int>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>periodicity_minute</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>periodicity_month</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>periodicity_month_day</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>periodicity_start_date</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="DateTime" module="DateTime.DateTime"/>
+                </klass>
+                <tuple>
+                  <none/>
+                </tuple>
+                <state>
+                  <tuple>
+                    <float>0.0</float>
+                    <string>GMT</string>
+                  </tuple>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>periodicity_week</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Alarm</string> </value>
+        </item>
+        <item>
+            <key> <string>solve_method_id</string> </key>
+            <value> <string>Alarm_installPromiseCertificateAuthority</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>Certificate Authority Tool</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseCertificateAuthority.xml b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseCertificateAuthority.xml
new file mode 100644
index 0000000000..536a1c4fd8
--- /dev/null
+++ b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_checkPromiseCertificateAuthority.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string>from Products.CMFActivity.ActiveResult import ActiveResult\n
+\n
+portal = context.getPortalObject()\n
+\n
+portal_certificate_authority = getattr(portal, \'portal_certificate_authority\', None)\n
+promise_ca_path = portal.getPromiseParameter(\'portal_certificate_authority\', \'certificate_authority_path\')\n
+if promise_ca_path is not None:\n
+  severity = 0\n
+  summary = "Nothing to do."\n
+  detail = ""\n
+else:\n
+  if portal_certificate_authority is None:\n
+    severity = 1\n
+    summary = "Certificate Authority Tool is not present"\n
+    detail = ""\n
+\n
+  elif portal_certificate_authority.certificate_authority_path != promise_ca_path:\n
+    severity = 1\n
+    summary = "Certificate Authority Tool (OpenSSL)is not configured as Expected"\n
+    detail = "Expect %s\\nGot %s" % (portal_certificate_authority.certificate_authority_path, promise_ca_path)\n
+\n
+  else:\n
+    severity = 0\n
+    summary = "Nothing to do."\n
+    detail = ""\n
+\n
+active_result = ActiveResult()\n
+active_result.edit(\n
+  summary=summary, \n
+  severity=severity,\n
+  detail=detail)\n
+\n
+context.newActiveProcess().postResult(active_result)\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>tag, fixit=False, **kw</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Alarm_checkPromiseCertificateAuthority</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_installPromiseCertificateAuthority.xml b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_installPromiseCertificateAuthority.xml
new file mode 100644
index 0000000000..0ad54072a0
--- /dev/null
+++ b/bt5/erp5_promise/SkinTemplateItem/portal_skins/erp5_promise/Alarm_installPromiseCertificateAuthority.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string>portal = context.getPortalObject()\n
+\n
+portal_certificate_authority = getattr(portal, \'portal_certificate_authority\', None)\n
+promise_ca_path = portal.getPromiseParameter(\'portal_certificate_authority\', \'certificate_authority_path\')\n
+\n
+if portal_certificate_authority is None:\n
+   portal.manage_addProduct[\'ERP5\'].manage_addTool(\'ERP5 Certificate Authority Tool\', None)\n
+   portal_certificate_authority = getattr(portal, \'portal_certificate_authority\')\n
+\n
+portal_certificate_authority.manage_editCertificateAuthorityTool(\n
+   certificate_authority_path=promise_ca_path)\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Alarm_installPromiseCertificateAuthority</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_promise/bt/change_log b/bt5/erp5_promise/bt/change_log
index ed539a05d1..0104a41431 100644
--- a/bt5/erp5_promise/bt/change_log
+++ b/bt5/erp5_promise/bt/change_log
@@ -1,2 +1,5 @@
+2012-10-09 rafael
+* Included promise for certificate_autority
+
 2012-07-17 rafael
 * Initial Release
\ No newline at end of file
diff --git a/bt5/erp5_promise/bt/revision b/bt5/erp5_promise/bt/revision
index 8e2afd3427..25bf17fc5a 100644
--- a/bt5/erp5_promise/bt/revision
+++ b/bt5/erp5_promise/bt/revision
@@ -1 +1 @@
-17
\ No newline at end of file
+18
\ No newline at end of file
diff --git a/bt5/erp5_promise/bt/template_path_list b/bt5/erp5_promise/bt/template_path_list
index 6b5410c669..9b38cc156c 100644
--- a/bt5/erp5_promise/bt/template_path_list
+++ b/bt5/erp5_promise/bt/template_path_list
@@ -1,3 +1,4 @@
+portal_alarms/promise_certificate_autority_tool
 portal_alarms/promise_conversion_server
 portal_alarms/promise_install_bt5
 portal_alarms/promise_kumofs_server
-- 
2.30.9