Commit 48ea8aab authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Ensure that some cloudooo is setup not the same value always

   The user should be able to eventually change the cloudooo configuration after the setup it w/o change zope.conf.

   Just give some valid default if nothing is set, there is no reason to make things more complex them this, since the cloudooo_url is already setup on site creation.
parent e1a9e318
from App.config import getConfiguration
def getConfigurationCloudoooUrl(self):
try:
kw = getConfiguration().product_config['initsite']
except KeyError:
return
return kw.get("cloudooo_url", None)
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Extension Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SlapOSCheckConsistency</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.SlapOSCheckConsistency</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Extension Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>getConfigurationCloudoooUrl</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SlapOSCheckConsistency</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getConfigurationCloudoooUrl</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -9,18 +9,15 @@ if context.getId() == "slapos_default_system_preference" and context.getPreferen
if context.getPreferenceState() != "global":
return []
portal = context.getPortalObject()
system_preference = context
expected_url = portal.ERP5Site_getConfigurationCloudoooUrl()
url = system_preference.getPreferredDocumentConversionServerUrl()
url = context.getPreferredDocumentConversionServerUrlList()
if expected_url != url:
if not url:
fixing = ''
if fixit:
system_preference.setPreferredDocumentConversionServerUrl(expected_url)
fixing = ' (fixed)'
# Set some value if no value is set.
context.setPreferredDocumentConversionServerUrlList(['https://cloudooo1.erp5.net/', 'https://cloudooo.erp5.net/'])
fixing = ' (fixed, set https://cloudooo1.erp5.net/ and https://cloudooo.erp5.net/)'
error_log.append("Conversion Server not configured as expected%s: %s" %
(fixing, "Expect %s\nGot %s" % (expected_url, url)))
error_log.append("Conversion Server is not configured. " % fixing)
return error_log
extension.erp5.SlapOSCheckConsistency
extension.erp5.SlapOSLogin
extension.erp5.SlapOSAdministration
extension.erp5.SlapOSLogin
......@@ -141,19 +141,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.commit()
self.launchConfigurator()
def updateInitSite(self):
self.portal.portal_caches.updateCache()
try:
initsite = config.product_config["initsite"]
except KeyError:
initsite = {}
if initsite.get("cloudooo_url", None) is None:
initsite["cloudooo_url"] = "https://cloudooo.erp5.net"
config.product_config["initsite"] = initsite
self.commit()
def afterSetUp(self):
self.login()
self.createAlarmStep()
......@@ -171,7 +158,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
return
self.createCertificateAuthorityFile()
self.commit()
self.updateInitSite()
def getBusinessConfiguration(self):
return self.portal.business_configuration_module[\
......@@ -180,7 +166,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
def launchConfigurator(self):
self.logMessage('SlapOS launchConfigurator ...\n')
self.login()
self.updateInitSite()
# Create new Configuration
business_configuration = self.getBusinessConfiguration()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment