Example #1
0
 def _update_config(self):
     """
     Update the deployed default server configuration.
     """
     
     # Parse and update the configuration
     cp = CParse()
     cp.select(self.server_conf)
     
     # Update each section
     for section, pair in self.params.get_config().iteritems():
         for key, val in pair.iteritems():
             cp.set_key(key, val, s=section)
             
             # Format the value output
             self.feedback.show('[%s] Set key value for "%s->%s"' % (self.server_conf, section, key)).success()
         
     # Apply the configuration changes
     cp.apply()
     self.feedback.show('Applied updated server configuration').success()
Example #2
0
 def _database_seed(self):
     """
     Seed the database with the base information needed to run Cloudscape.
     """
     
     # Import modules now to get the new configuration
     from cloudscape.engine.api.app.group.utils import GroupCreate
     from cloudscape.engine.api.app.user.utils import UserCreate
     from cloudscape.engine.api.app.group.models import DBGroupDetails
     from cloudscape.engine.api.app.gateway.models import DBGatewayACLGroupGlobalPermissions, DBGatewayACLKeys, \
                                                          DBGatewayACLAccessGlobal, DBGatewayUtilities
     from cloudscape.engine.api.app.gateway.utils import GatewayUtilitiesCreate, GatewayACLObjectsCreate, \
                                                         GatewayACLCreate
     
     # Setup Django models
     django.setup()
     
     # Create the administrator group and user
     group = self._create_group(GroupCreate)
     user = self._create_user(UserCreate)
 
     # Update administrator info in the server configuration
     cp = CParse()
     cp.select(self.server_conf)
     cp.set_key('user', user['data']['username'], s='admin')
     cp.set_key('group', self.params.user['group'], s='admin')
     cp.set_key('key', user['data']['api_key'], s='admin')
     cp.apply()
     self.feedback.show('[%s] Set API administrator values' % self.server_conf).success()
 
     # Create API utilities / ACL objects / ACL keys / access entries
     self._create_utils(GatewayUtilitiesCreate)
     self._create_acl_keys(GatewayACLCreate)
     self._create_utils_access(DBGatewayACLAccessGlobal, DBGatewayACLKeys, DBGatewayUtilities)
     self._create_acl_objects(GatewayACLObjectsCreate)
     self._create_acl_access(DBGatewayACLGroupGlobalPermissions, DBGatewayACLKeys, DBGroupDetails)