[Erp5-report] r34246 luke - in /erp5/trunk/utils/erp5.timmy/src/erp5/timmy: ./ examples/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 1 15:17:38 CEST 2010


Author: luke
Date: Thu Apr  1 15:17:36 2010
New Revision: 34246

URL: http://svn.erp5.org?rev=34246&view=rev
Log:
 - Business Templates are *not* controlled by Zope Instance, it is part of Business Configuration
 - implement (temporary in timmy) Business Configuration management

Modified:
    erp5/trunk/utils/erp5.timmy/src/erp5/timmy/examples/zope-instance-template.cfg
    erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py

Modified: erp5/trunk/utils/erp5.timmy/src/erp5/timmy/examples/zope-instance-template.cfg
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.timmy/src/erp5/timmy/examples/zope-instance-template.cfg?rev=34246&r1=34245&r2=34246&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.timmy/src/erp5/timmy/examples/zope-instance-template.cfg [utf8] (original)
+++ erp5/trunk/utils/erp5.timmy/src/erp5/timmy/examples/zope-instance-template.cfg [utf8] Thu Apr  1 15:17:36 2010
@@ -6,11 +6,6 @@
 # Disabled installing of BT5 during site creation
 bt5 =
 bt5-path =
-
-# List of Business Templates which will be installed on running site
-required-bt5 =
- %{BT5_LIST}
-bt5-url =
 
 # TODO: protect fragile information
 mysql_create_database = false

Modified: erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py?rev=34246&r1=34245&r2=34246&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py [utf8] (original)
+++ erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py [utf8] Thu Apr  1 15:17:36 2010
@@ -358,6 +358,33 @@
       server.call('updatePartitionState', partition.partition_id,
         *result)
 
+class BusinessConfigurationCommunication(object):
+  # XXX-Luke: move to recipe!
+  def __init__(self, business_configuration_dict):
+    self.business_configuration_dict = business_configuration_dict
+    self.connection_string = '%(PROTOCOL)s://%(USERNAME)s:%(PASSWORD)s@%(HOS'\
+      'TNAME)s:%(TCP_PORT)s/%(RESOURCE_ID)s/' % \
+      self.business_configuration_dict['CONNECTION_DICT']
+    self.connect()
+
+  def connect(self):
+    self.connection = xmlrpclib.ServerProxy(
+        self.connection_string,
+        allow_none=True)
+
+  def update(self):
+    # for now assume only one BT5_REPOSITORY_LIST
+    try:
+      self.connection.portal_templates.updateRepositoryBusinessTemplateList(
+          self.business_configuration_dict['BT5_REPOSITORY_LIST'], None)
+      result = self.connection.portal_templates\
+          .installBusinessTemplatesFromRepositories(
+            self.business_configuration_dict['BT5_LIST'])
+    except socket.error:
+      logging.warning('Cannot connect to %s, ignoring for now' % self.connection_string)
+      return
+    logging.info('Installed Business Templates with result: %s' % ','.join(result))
+
 def keygenParseOptions():
   parser = OptionParser()
   parser.add_option("-k", "--key-file",
@@ -412,6 +439,7 @@
         options.buildout_offline)
 
     # 3 pass - manage instances
+    # XXX-Luke: To be moved to proper recipe
     updated_partition_list = []
     helper = Helper()
     for partition_dict in partition_dict_list:
@@ -434,6 +462,10 @@
     logging.info('Supervisorctl updated with: stdout = %r stderr = %r' %
         (subprocess.Popen([SUPERVISORCTL, 'update'], stdout=subprocess.PIPE,
         stderr=subprocess.PIPE).communicate()))
+    # update Business Configuration on instances
+    for partition_dict in [q for q in partition_dict_list if q['TYPE'] == \
+        'Business Configuration']:
+      BusinessConfigurationCommunication(partition_dict).update()
   finally:
     setRunning(False, options.pid_file)
 




More information about the Erp5-report mailing list