<?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 encoding="cdata"><![CDATA[

import json\n
portal = context.getPortalObject()\n
\n
instance_xml = """<?xml version="1.0" encoding="utf-8"?>\n
<instance>\n
 <parameter id="json">%s</parameter>\n
</instance>\n
""" % (json.dumps({\n
        "timezone": "Europe/Paris",\n
        "site-id": "erp5",\n
        "erp5-ca": {\n
          "country-code": "FR",\n
          "email": "admin@vifib.org",\n
          "state": "Nord-Pas-de-Calais",\n
          "city": "Lille",\n
          "company": "ViFiB SARL"\n
        },\n
        "backend": {\n
          "login": {\n
            "zopecount": 1,\n
            "access-control-string": "all",\n
            "scheme": ["https"],\n
            "maxconn": 1,\n
            "thread-amount": 1},\n
          "erp5": {\n
            "zopecount": 1,\n
            "access-control-string": "all",\n
            "scheme": ["https"],\n
            "maxconn": 1,\n
            "thread-amount": 1},\n
          "service": {\n
            "no-timeout": True,\n
            "http-cache": True,\n
            "zopecount": 2,\n
            "access-control-string": "all",\n
            "scheme": ["https"],\n
            "maxconn": 1,\n
            "ssl-authentication": True,\n
            "backend-path": "/%(site-id)s/portal_slap",\n
            "thread-amount": 1},\n
         "shacacheupload": {\n
            "no-timeout": True,\n
            "zopecount": 1,\n
            "access-control-string": "all",\n
            "scheme": ["https"],\n
            "maxconn": 1,\n
            "ssl-authentication": True,\n
            "backend-path": "/%(site-id)s/web_site_module",\n
            "thread-amount": 1},\n
         "shacachedownload": {\n
            "no-timeout": True,\n
            "http-cache": True,\n
            "zopecount": 1,\n
            "access-control-string": "all",\n
            "scheme": ["http"],\n
            "maxconn": 1,\n
            "backend-path": "/%(site-id)s/web_site_module",\n
            "thread-amount": 1}\n
        },\n
        "zeo": {\n
           "Zeo-Server-1": [{\n
             "zodb-name": "main",\n
             "serialize-path": "/%(site-id)s/account_module/",\n
             "mount-point": "/",\n
             "zope-cache-size": "2000",\n
             "storage-name": "main",\n
             "zeo-cache-size": "400MB"}]\n
        },\n
        "activity": {\n
          "zopecount": 1,\n
          "timerservice": True\n
        }\n
      }))\n
\n
url = "http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5-vifib:/software/erp5/software.cfg"\n
software_type = "production"\n
\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n
request_kw = {}\n
request_kw.update(\n
  software_release=url,\n
  software_title="SlapOS Master Instance 00-%i" % portal.portal_ids.generateNewId(id_group=("vifib", "kvm"), default=1),\n
  software_type=software_type,\n
  instance_xml=instance_xml,\n
  sla_xml="",\n
  shared=False,\n
  state="started",\n
)\n
\n
result = person.Person_restrictMethodAsShadowUser(\n
              shadow_document=person,\n
              callable_object=person.Person_findPartition,\n
              argument_list=[\n
                   url,\n
                   software_type,\n
                   \'Software Instance\', {}],\n
              argument_dict={\'test_mode\': True})\n
\n
if result:\n
 person.requestSoftwareInstance(**request_kw)\n
\n
 message = context.Base_translateString("Your instance is under creation. Please wait few minutes for partitions to appear.")\n
 return context.REQUEST.get(\'request_hosting_subscription\').Base_redirect(keep_items={\'portal_status_message\': message})\n
else:\n
 message = context.Base_translateString("We are sorry. We cannot allocate your request because we are out of capacity for the software choose, please try again later!")\n
 return context.myspace.Base_redirect(keep_items={\'portal_status_message\': message})\n


]]></string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string></string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>WebSection_orderVifibSlapOSMaster</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
