1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-08 21:18:00 +03:00

migrating to django 1.7

This commit is contained in:
Adolfo Gómez García 2014-09-08 13:20:44 +02:00
parent 9c77bb321f
commit bd5b81eccc
25 changed files with 1032 additions and 610 deletions

View File

@ -230,6 +230,8 @@ encoding//src/uds/services/Xen/xen_client/__init__.py=utf-8
encoding//src/uds/services/__init__.py=utf-8
encoding//src/uds/templatetags/REST.py=utf-8
encoding//src/uds/templatetags/html5.py=utf-8
encoding//src/uds/tests/core/util/net.py=utf-8
encoding//src/uds/tests/enterprise/serials/internal.py=utf-8
encoding//src/uds/tests/util/UDSWebTest.py=utf-8
encoding//src/uds/tests/web/__init__.py=utf-8
encoding//src/uds/tests/web/admin/auth/create_auth.py=utf-8

View File

@ -1,537 +1,404 @@
# encoding: utf-8
#@PydevCodeAnalysisIgnore
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Provider'
db.create_table('uds_provider', (
('comments', self.gf('django.db.models.fields.CharField')(max_length=256)),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('data_type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
))
db.send_create_signal('uds', ['Provider'])
# Adding model 'Service'
db.create_table('uds_service', (
('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
('data_type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('comments', self.gf('django.db.models.fields.CharField')(max_length=256)),
('provider', self.gf('django.db.models.fields.related.ForeignKey')(related_name='services', to=orm['uds.Provider'])),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['Service'])
class Migration(migrations.Migration):
# Adding unique constraint on 'Service', fields ['provider', 'name']
db.create_unique('uds_service', ['provider_id', 'name'])
dependencies = [
]
# Adding model 'OSManager'
db.create_table('uds_osmanager', (
('comments', self.gf('django.db.models.fields.CharField')(max_length=256)),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('data_type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
))
db.send_create_signal('uds', ['OSManager'])
# Adding model 'Transport'
db.create_table('uds_transport', (
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
('data_type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('comments', self.gf('django.db.models.fields.CharField')(max_length=256)),
('priority', self.gf('django.db.models.fields.IntegerField')(default=0, db_index=True)),
('nets_positive', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['Transport'])
# Adding model 'Authenticator'
db.create_table('uds_authenticator', (
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
('data_type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('comments', self.gf('django.db.models.fields.TextField')(default='')),
('priority', self.gf('django.db.models.fields.IntegerField')(default=0, db_index=True)),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['Authenticator'])
# Adding model 'User'
db.create_table('uds_user', (
('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
('staff_member', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
('manager', self.gf('django.db.models.fields.related.ForeignKey')(related_name='users', to=orm['uds.Authenticator'])),
('comments', self.gf('django.db.models.fields.CharField')(max_length=256)),
('real_name', self.gf('django.db.models.fields.CharField')(max_length=128)),
('state', self.gf('django.db.models.fields.CharField')(max_length=1, db_index=True)),
('is_admin', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
('last_access', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(1972, 7, 1, 0, 0))),
('password', self.gf('django.db.models.fields.CharField')(default='', max_length=128)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['User'])
# Adding unique constraint on 'User', fields ['manager', 'name']
db.create_unique('uds_user', ['manager_id', 'name'])
# Adding model 'Group'
db.create_table('uds_group', (
('manager', self.gf('django.db.models.fields.related.ForeignKey')(related_name='groups', to=orm['uds.Authenticator'])),
('state', self.gf('django.db.models.fields.CharField')(default='A', max_length=1, db_index=True)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('comments', self.gf('django.db.models.fields.CharField')(default='', max_length=256)),
('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
))
db.send_create_signal('uds', ['Group'])
# Adding unique constraint on 'Group', fields ['manager', 'name']
db.create_unique('uds_group', ['manager_id', 'name'])
# Adding M2M table for field users on 'Group'
db.create_table('uds_group_users', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('group', models.ForeignKey(orm['uds.group'], null=False)),
('user', models.ForeignKey(orm['uds.user'], null=False))
))
db.create_unique('uds_group_users', ['group_id', 'user_id'])
# Adding model 'UserPreference'
db.create_table('uds_userpreference', (
('value', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='preferences', to=orm['uds.User'])),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('module', self.gf('django.db.models.fields.CharField')(max_length=32, db_index=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=32, db_index=True)),
))
db.send_create_signal('uds', ['UserPreference'])
# Adding unique constraint on 'UserPreference', fields ['module', 'name']
db.create_unique('uds_userpreference', ['module', 'name'])
# Adding model 'DeployedService'
db.create_table('uds__deployed_service', (
('initial_srvs', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('osmanager', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='deployedServices', null=True, to=orm['uds.OSManager'])),
('name', self.gf('django.db.models.fields.CharField')(default='', max_length=128)),
('service', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='deployedServices', null=True, to=orm['uds.Service'])),
('current_pub_revision', self.gf('django.db.models.fields.PositiveIntegerField')(default=1)),
('max_srvs', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('comments', self.gf('django.db.models.fields.CharField')(default='', max_length=256)),
('authenticator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='deployedServices', null=True, to=orm['uds.Authenticator'])),
('state', self.gf('django.db.models.fields.CharField')(default='A', max_length=1, db_index=True)),
('cache_l2_srvs', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('cache_l1_srvs', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['DeployedService'])
# Adding M2M table for field transports on 'DeployedService'
db.create_table('uds__ds_trans', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('deployedservice', models.ForeignKey(orm['uds.deployedservice'], null=False)),
('transport', models.ForeignKey(orm['uds.transport'], null=False))
))
db.create_unique('uds__ds_trans', ['deployedservice_id', 'transport_id'])
# Adding M2M table for field assignedGroups on 'DeployedService'
db.create_table('uds__ds_grps', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('deployedservice', models.ForeignKey(orm['uds.deployedservice'], null=False)),
('group', models.ForeignKey(orm['uds.group'], null=False))
))
db.create_unique('uds__ds_grps', ['deployedservice_id', 'group_id'])
# Adding model 'DeployedServicePublication'
db.create_table('uds__deployed_service_pub', (
('deployed_service', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publications', to=orm['uds.DeployedService'])),
('state', self.gf('django.db.models.fields.CharField')(default='P', max_length=1, db_index=True)),
('state_date', self.gf('django.db.models.fields.DateTimeField')()),
('publish_date', self.gf('django.db.models.fields.DateTimeField')(db_index=True)),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('revision', self.gf('django.db.models.fields.PositiveIntegerField')(default=1)),
))
db.send_create_signal('uds', ['DeployedServicePublication'])
# Adding model 'UserService'
db.create_table('uds__user_service', (
('cache_level', self.gf('django.db.models.fields.PositiveSmallIntegerField')(default=0, db_index=True)),
('publication', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='userServices', null=True, to=orm['uds.DeployedServicePublication'])),
('in_use', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
('os_state', self.gf('django.db.models.fields.CharField')(default='P', max_length=1)),
('friendly_name', self.gf('django.db.models.fields.CharField')(default='', max_length=128)),
('deployed_service', self.gf('django.db.models.fields.related.ForeignKey')(related_name='userServices', to=orm['uds.DeployedService'])),
('creation_date', self.gf('django.db.models.fields.DateTimeField')(db_index=True)),
('state', self.gf('django.db.models.fields.CharField')(default='P', max_length=1, db_index=True)),
('state_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='userServices', null=True, blank=True, to=orm['uds.User'])),
('in_use_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(1972, 7, 1, 0, 0))),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('unique_id', self.gf('django.db.models.fields.CharField')(default='', max_length=128, db_index=True)),
))
db.send_create_signal('uds', ['UserService'])
# Adding model 'Cache'
db.create_table('uds_utility_cache', (
('owner', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
('validity', self.gf('django.db.models.fields.IntegerField')(default=60)),
('value', self.gf('django.db.models.fields.TextField')(default='')),
('key', self.gf('django.db.models.fields.CharField')(max_length=64, primary_key=True)),
('created', self.gf('django.db.models.fields.DateTimeField')()),
))
db.send_create_signal('uds', ['Cache'])
# Adding model 'Config'
db.create_table('uds_configuration', (
('value', self.gf('django.db.models.fields.TextField')(default='')),
('section', self.gf('django.db.models.fields.CharField')(max_length=128)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('key', self.gf('django.db.models.fields.CharField')(max_length=64)),
))
db.send_create_signal('uds', ['Config'])
# Adding unique constraint on 'Config', fields ['section', 'key']
db.create_unique('uds_configuration', ['section', 'key'])
# Adding model 'Storage'
db.create_table('uds_storage', (
('owner', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
('data', self.gf('django.db.models.fields.CharField')(default='', max_length=1024)),
('key', self.gf('django.db.models.fields.CharField')(max_length=64, primary_key=True)),
('attr1', self.gf('django.db.models.fields.CharField')(default=None, max_length=64, null=True, db_index=True, blank=True)),
))
db.send_create_signal('uds', ['Storage'])
# Adding model 'UniqueId'
db.create_table('uds_uniqueid', (
('owner', self.gf('django.db.models.fields.CharField')(default='', max_length=128, db_index=True)),
('assigned', self.gf('django.db.models.fields.BooleanField')(default=True, db_index=True, blank=True)),
('basename', self.gf('django.db.models.fields.CharField')(max_length=32, db_index=True)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('seq', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)),
))
db.send_create_signal('uds', ['UniqueId'])
# Adding unique constraint on 'UniqueId', fields ['basename', 'seq']
db.create_unique('uds_uniqueid', ['basename', 'seq'])
# Adding model 'Scheduler'
db.create_table('uds_scheduler', (
('last_execution', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('frecuency', self.gf('django.db.models.fields.PositiveIntegerField')(default=86400)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('state', self.gf('django.db.models.fields.CharField')(default='X', max_length=1, db_index=True)),
('next_execution', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(1972, 7, 1, 0, 0), db_index=True)),
('owner_server', self.gf('django.db.models.fields.CharField')(default='', max_length=64, db_index=True)),
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=64)),
))
db.send_create_signal('uds', ['Scheduler'])
# Adding model 'DelayedTask'
db.create_table('uds_delayedtask', (
('insert_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('execution_delay', self.gf('django.db.models.fields.PositiveIntegerField')()),
('execution_time', self.gf('django.db.models.fields.DateTimeField')(db_index=True)),
('instance', self.gf('django.db.models.fields.TextField')()),
('tag', self.gf('django.db.models.fields.CharField')(max_length=64, db_index=True)),
('type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['DelayedTask'])
# Adding model 'Network'
db.create_table('uds_network', (
('net_start', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)),
('net_end', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=64)),
))
db.send_create_signal('uds', ['Network'])
# Adding M2M table for field transports on 'Network'
db.create_table('uds_net_trans', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('network', models.ForeignKey(orm['uds.network'], null=False)),
('transport', models.ForeignKey(orm['uds.transport'], null=False))
))
db.create_unique('uds_net_trans', ['network_id', 'transport_id'])
def backwards(self, orm):
# Deleting model 'Provider'
db.delete_table('uds_provider')
# Deleting model 'Service'
db.delete_table('uds_service')
# Removing unique constraint on 'Service', fields ['provider', 'name']
db.delete_unique('uds_service', ['provider_id', 'name'])
# Deleting model 'OSManager'
db.delete_table('uds_osmanager')
# Deleting model 'Transport'
db.delete_table('uds_transport')
# Deleting model 'Authenticator'
db.delete_table('uds_authenticator')
# Deleting model 'User'
db.delete_table('uds_user')
# Removing unique constraint on 'User', fields ['manager', 'name']
db.delete_unique('uds_user', ['manager_id', 'name'])
# Deleting model 'Group'
db.delete_table('uds_group')
# Removing unique constraint on 'Group', fields ['manager', 'name']
db.delete_unique('uds_group', ['manager_id', 'name'])
# Removing M2M table for field users on 'Group'
db.delete_table('uds_group_users')
# Deleting model 'UserPreference'
db.delete_table('uds_userpreference')
# Removing unique constraint on 'UserPreference', fields ['module', 'name']
db.delete_unique('uds_userpreference', ['module', 'name'])
# Deleting model 'DeployedService'
db.delete_table('uds__deployed_service')
# Removing M2M table for field transports on 'DeployedService'
db.delete_table('uds__ds_trans')
# Removing M2M table for field assignedGroups on 'DeployedService'
db.delete_table('uds__ds_grps')
# Deleting model 'DeployedServicePublication'
db.delete_table('uds__deployed_service_pub')
# Deleting model 'UserService'
db.delete_table('uds__user_service')
# Deleting model 'Cache'
db.delete_table('uds_utility_cache')
# Deleting model 'Config'
db.delete_table('uds_configuration')
# Removing unique constraint on 'Config', fields ['section', 'key']
db.delete_unique('uds_configuration', ['section', 'key'])
# Deleting model 'Storage'
db.delete_table('uds_storage')
# Deleting model 'UniqueId'
db.delete_table('uds_uniqueid')
# Removing unique constraint on 'UniqueId', fields ['basename', 'seq']
db.delete_unique('uds_uniqueid', ['basename', 'seq'])
# Deleting model 'Scheduler'
db.delete_table('uds_scheduler')
# Deleting model 'DelayedTask'
db.delete_table('uds_delayedtask')
# Deleting model 'Network'
db.delete_table('uds_network')
# Removing M2M table for field transports on 'Network'
db.delete_table('uds_net_trans')
models = {
'uds.authenticator': {
'Meta': {'object_name': 'Authenticator'},
'comments': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
'priority': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'})
},
'uds.cache': {
'Meta': {'object_name': 'Cache', 'db_table': "'uds_utility_cache'"},
'created': ('django.db.models.fields.DateTimeField', [], {}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'}),
'owner': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'validity': ('django.db.models.fields.IntegerField', [], {'default': '60'}),
'value': ('django.db.models.fields.TextField', [], {'default': "''"})
},
'uds.config': {
'Meta': {'unique_together': "(('section', 'key'),)", 'object_name': 'Config', 'db_table': "'uds_configuration'"},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
'section': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'value': ('django.db.models.fields.TextField', [], {'default': "''"})
},
'uds.delayedtask': {
'Meta': {'object_name': 'DelayedTask'},
'execution_delay': ('django.db.models.fields.PositiveIntegerField', [], {}),
'execution_time': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'insert_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'instance': ('django.db.models.fields.TextField', [], {}),
'tag': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_index': 'True'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'uds.deployedservice': {
'Meta': {'object_name': 'DeployedService', 'db_table': "'uds__deployed_service'"},
'assignedGroups': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'deployedServices'", 'symmetrical': 'False', 'db_table': "'uds__ds_grps'", 'to': "orm['uds.Group']"}),
'authenticator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deployedServices'", 'null': 'True', 'to': "orm['uds.Authenticator']"}),
'cache_l1_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'cache_l2_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'comments': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256'}),
'current_pub_revision': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'initial_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'max_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}),
'osmanager': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deployedServices'", 'null': 'True', 'to': "orm['uds.OSManager']"}),
'service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deployedServices'", 'null': 'True', 'to': "orm['uds.Service']"}),
'state': ('django.db.models.fields.CharField', [], {'default': "'A'", 'max_length': '1', 'db_index': 'True'}),
'transports': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'deployedServices'", 'symmetrical': 'False', 'db_table': "'uds__ds_trans'", 'to': "orm['uds.Transport']"})
},
'uds.deployedservicepublication': {
'Meta': {'object_name': 'DeployedServicePublication', 'db_table': "'uds__deployed_service_pub'"},
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'deployed_service': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publications'", 'to': "orm['uds.DeployedService']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'publish_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'revision': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'state': ('django.db.models.fields.CharField', [], {'default': "'P'", 'max_length': '1', 'db_index': 'True'}),
'state_date': ('django.db.models.fields.DateTimeField', [], {})
},
'uds.group': {
'Meta': {'unique_together': "(('manager', 'name'),)", 'object_name': 'Group'},
'comments': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'manager': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'groups'", 'to': "orm['uds.Authenticator']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'state': ('django.db.models.fields.CharField', [], {'default': "'A'", 'max_length': '1', 'db_index': 'True'}),
'users': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'groups'", 'symmetrical': 'False', 'to': "orm['uds.User']"})
},
'uds.network': {
'Meta': {'object_name': 'Network'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}),
'net_end': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
'net_start': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
'transports': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'networks'", 'symmetrical': 'False', 'db_table': "'uds_net_trans'", 'to': "orm['uds.Transport']"})
},
'uds.osmanager': {
'Meta': {'object_name': 'OSManager'},
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
},
'uds.provider': {
'Meta': {'object_name': 'Provider'},
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
},
'uds.scheduler': {
'Meta': {'object_name': 'Scheduler'},
'frecuency': ('django.db.models.fields.PositiveIntegerField', [], {'default': '86400'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_execution': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}),
'next_execution': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1972, 7, 1, 0, 0)', 'db_index': 'True'}),
'owner_server': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'db_index': 'True'}),
'state': ('django.db.models.fields.CharField', [], {'default': "'X'", 'max_length': '1', 'db_index': 'True'})
},
'uds.service': {
'Meta': {'unique_together': "(('provider', 'name'),)", 'object_name': 'Service'},
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'provider': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'services'", 'to': "orm['uds.Provider']"})
},
'uds.storage': {
'Meta': {'object_name': 'Storage'},
'attr1': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '64', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'data': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'}),
'owner': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
},
'uds.transport': {
'Meta': {'object_name': 'Transport'},
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
'nets_positive': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'priority': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'})
},
'uds.uniqueid': {
'Meta': {'unique_together': "(('basename', 'seq'),)", 'object_name': 'UniqueId'},
'assigned': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True', 'blank': 'True'}),
'basename': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'owner': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128', 'db_index': 'True'}),
'seq': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'})
},
'uds.user': {
'Meta': {'unique_together': "(('manager', 'name'),)", 'object_name': 'User'},
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_admin': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'last_access': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1972, 7, 1, 0, 0)'}),
'manager': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'users'", 'to': "orm['uds.Authenticator']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}),
'real_name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'staff_member': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'state': ('django.db.models.fields.CharField', [], {'max_length': '1', 'db_index': 'True'})
},
'uds.userpreference': {
'Meta': {'unique_together': "(('module', 'name'),)", 'object_name': 'UserPreference'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'module': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'preferences'", 'to': "orm['uds.User']"}),
'value': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
},
'uds.userservice': {
'Meta': {'object_name': 'UserService', 'db_table': "'uds__user_service'"},
'cache_level': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'deployed_service': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'userServices'", 'to': "orm['uds.DeployedService']"}),
'friendly_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'in_use': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'in_use_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1972, 7, 1, 0, 0)'}),
'os_state': ('django.db.models.fields.CharField', [], {'default': "'P'", 'max_length': '1'}),
'publication': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'userServices'", 'null': 'True', 'to': "orm['uds.DeployedServicePublication']"}),
'state': ('django.db.models.fields.CharField', [], {'default': "'P'", 'max_length': '1', 'db_index': 'True'}),
'state_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'unique_id': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128', 'db_index': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'userServices'", 'null': 'True', 'blank': 'True', 'to': "orm['uds.User']"})
}
}
complete_apps = ['uds']
operations = [
migrations.CreateModel(
name='Authenticator',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(unique=True, max_length=128)),
('data_type', models.CharField(max_length=128)),
('data', models.TextField(default='')),
('comments', models.TextField(default='')),
('priority', models.IntegerField(default=0, db_index=True)),
('small_name', models.CharField(default='', max_length=32, db_index=True)),
],
options={
'ordering': ('name',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Cache',
fields=[
('owner', models.CharField(max_length=128, db_index=True)),
('key', models.CharField(max_length=64, serialize=False, primary_key=True)),
('value', models.TextField(default='')),
('created', models.DateTimeField()),
('validity', models.IntegerField(default=60)),
],
options={
'db_table': 'uds_utility_cache',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Config',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('section', models.CharField(max_length=128, db_index=True)),
('key', models.CharField(max_length=64, db_index=True)),
('value', models.TextField(default='')),
('crypt', models.BooleanField(default=False)),
('long', models.BooleanField(default=False)),
('field_type', models.IntegerField(default=-1)),
],
options={
'db_table': 'uds_configuration',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='DelayedTask',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('type', models.CharField(max_length=128)),
('tag', models.CharField(max_length=64, db_index=True)),
('instance', models.TextField()),
('insert_date', models.DateTimeField(auto_now_add=True)),
('execution_delay', models.PositiveIntegerField()),
('execution_time', models.DateTimeField(db_index=True)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='DeployedService',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(default='', max_length=128)),
('comments', models.CharField(default='', max_length=256)),
('state', models.CharField(default='A', max_length=1, db_index=True)),
('state_date', models.DateTimeField(default=datetime.datetime(1972, 7, 1, 0, 0))),
('initial_srvs', models.PositiveIntegerField(default=0)),
('cache_l1_srvs', models.PositiveIntegerField(default=0)),
('cache_l2_srvs', models.PositiveIntegerField(default=0)),
('max_srvs', models.PositiveIntegerField(default=0)),
('current_pub_revision', models.PositiveIntegerField(default=1)),
],
options={
'db_table': 'uds__deployed_service',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='DeployedServicePublication',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('publish_date', models.DateTimeField(db_index=True)),
('data', models.TextField(default='')),
('state', models.CharField(default='P', max_length=1, db_index=True)),
('state_date', models.DateTimeField()),
('revision', models.PositiveIntegerField(default=1)),
('deployed_service', models.ForeignKey(related_name='publications', to='uds.DeployedService')),
],
options={
'ordering': ('publish_date',),
'db_table': 'uds__deployed_service_pub',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Group',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=128, db_index=True)),
('state', models.CharField(default='A', max_length=1, db_index=True)),
('comments', models.CharField(default='', max_length=256)),
('is_meta', models.BooleanField(default=False, db_index=True)),
('meta_if_any', models.BooleanField(default=False)),
('groups', models.ManyToManyField(to='uds.Group')),
('manager', models.ForeignKey(related_name='groups', to='uds.Authenticator')),
],
options={
'ordering': ('name',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Log',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('owner_id', models.IntegerField(default=0, db_index=True)),
('owner_type', models.SmallIntegerField(default=0, db_index=True)),
('created', models.DateTimeField(db_index=True)),
('source', models.CharField(default='internal', max_length=16, db_index=True)),
('level', models.PositiveSmallIntegerField(default=0, db_index=True)),
('data', models.CharField(default='', max_length=255)),
],
options={
'db_table': 'uds_log',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Network',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(unique=True, max_length=64)),
('net_start', models.BigIntegerField(db_index=True)),
('net_end', models.BigIntegerField(db_index=True)),
('net_string', models.CharField(default='', max_length=128)),
],
options={
'ordering': ('name',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='OSManager',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(unique=True, max_length=128)),
('data_type', models.CharField(max_length=128)),
('data', models.TextField(default='')),
('comments', models.CharField(max_length=256)),
],
options={
'ordering': ('name',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Provider',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(unique=True, max_length=128)),
('data_type', models.CharField(max_length=128)),
('data', models.TextField(default='')),
('comments', models.CharField(max_length=256)),
],
options={
'ordering': ('name',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Scheduler',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(unique=True, max_length=64)),
('frecuency', models.PositiveIntegerField(default=86400)),
('last_execution', models.DateTimeField(auto_now_add=True)),
('next_execution', models.DateTimeField(default=datetime.datetime(1972, 7, 1, 0, 0), db_index=True)),
('owner_server', models.CharField(default='', max_length=64, db_index=True)),
('state', models.CharField(default='X', max_length=1, db_index=True)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Service',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=128)),
('data_type', models.CharField(max_length=128)),
('data', models.TextField(default='')),
('comments', models.CharField(max_length=256)),
('provider', models.ForeignKey(related_name='services', to='uds.Provider')),
],
options={
'ordering': ('name',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='StatsCounters',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('owner_id', models.IntegerField(default=0, db_index=True)),
('owner_type', models.SmallIntegerField(default=0, db_index=True)),
('counter_type', models.SmallIntegerField(default=0, db_index=True)),
('stamp', models.IntegerField(default=0, db_index=True)),
('value', models.IntegerField(default=0, db_index=True)),
],
options={
'db_table': 'uds_stats_c',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='StatsEvents',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('owner_id', models.IntegerField(default=0, db_index=True)),
('owner_type', models.SmallIntegerField(default=0, db_index=True)),
('event_type', models.SmallIntegerField(default=0, db_index=True)),
('stamp', models.IntegerField(default=0, db_index=True)),
],
options={
'db_table': 'uds_stats_e',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Storage',
fields=[
('owner', models.CharField(max_length=128, db_index=True)),
('key', models.CharField(max_length=64, serialize=False, primary_key=True)),
('data', models.TextField(default='')),
('attr1', models.CharField(default=None, max_length=64, null=True, db_index=True, blank=True)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Transport',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(unique=True, max_length=128)),
('data_type', models.CharField(max_length=128)),
('data', models.TextField(default='')),
('comments', models.CharField(max_length=256)),
('priority', models.IntegerField(default=0, db_index=True)),
('nets_positive', models.BooleanField(default=False)),
],
options={
'ordering': ('name',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='UniqueId',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('owner', models.CharField(default='', max_length=128, db_index=True)),
('basename', models.CharField(max_length=32, db_index=True)),
('seq', models.BigIntegerField(db_index=True)),
('assigned', models.BooleanField(default=True, db_index=True)),
('stamp', models.IntegerField(default=0, db_index=True)),
],
options={
'ordering': ('-seq',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=128, db_index=True)),
('real_name', models.CharField(max_length=128)),
('comments', models.CharField(max_length=256)),
('state', models.CharField(max_length=1, db_index=True)),
('password', models.CharField(default='', max_length=128)),
('staff_member', models.BooleanField(default=False)),
('is_admin', models.BooleanField(default=False)),
('last_access', models.DateTimeField(default=datetime.datetime(1972, 7, 1, 0, 0))),
('parent', models.IntegerField(default=-1)),
('manager', models.ForeignKey(related_name='users', to='uds.Authenticator')),
],
options={
'ordering': ('name',),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='UserPreference',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('module', models.CharField(max_length=32, db_index=True)),
('name', models.CharField(max_length=32, db_index=True)),
('value', models.CharField(max_length=128, db_index=True)),
('user', models.ForeignKey(related_name='preferences', to='uds.User')),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='UserService',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('unique_id', models.CharField(default='', max_length=128, db_index=True)),
('friendly_name', models.CharField(default='', max_length=128)),
('state', models.CharField(default='P', max_length=1, db_index=True)),
('os_state', models.CharField(default='P', max_length=1)),
('state_date', models.DateTimeField(auto_now_add=True, db_index=True)),
('creation_date', models.DateTimeField(db_index=True)),
('data', models.TextField(default='')),
('in_use', models.BooleanField(default=False)),
('in_use_date', models.DateTimeField(default=datetime.datetime(1972, 7, 1, 0, 0))),
('cache_level', models.PositiveSmallIntegerField(default=0, db_index=True)),
('src_hostname', models.CharField(default='', max_length=64)),
('src_ip', models.CharField(default='', max_length=15)),
('cluster_node', models.CharField(default=None, max_length=128, null=True, db_index=True, blank=True)),
('deployed_service', models.ForeignKey(related_name='userServices', to='uds.DeployedService')),
('publication', models.ForeignKey(related_name='userServices', blank=True, to='uds.DeployedServicePublication', null=True)),
('user', models.ForeignKey(related_name='userServices', default=None, blank=True, to='uds.User', null=True)),
],
options={
'ordering': ('creation_date',),
'db_table': 'uds__user_service',
},
bases=(models.Model,),
),
migrations.AlterUniqueTogether(
name='user',
unique_together=set([('manager', 'name')]),
),
migrations.AlterUniqueTogether(
name='uniqueid',
unique_together=set([('basename', 'seq')]),
),
migrations.AlterUniqueTogether(
name='service',
unique_together=set([('provider', 'name')]),
),
migrations.AddField(
model_name='network',
name='transports',
field=models.ManyToManyField(related_name='networks', db_table='uds_net_trans', to='uds.Transport'),
preserve_default=True,
),
migrations.AddField(
model_name='group',
name='users',
field=models.ManyToManyField(related_name='groups', to='uds.User'),
preserve_default=True,
),
migrations.AlterUniqueTogether(
name='group',
unique_together=set([('manager', 'name')]),
),
migrations.AddField(
model_name='deployedservice',
name='assignedGroups',
field=models.ManyToManyField(related_name='deployedServices', db_table='uds__ds_grps', to='uds.Group'),
preserve_default=True,
),
migrations.AddField(
model_name='deployedservice',
name='osmanager',
field=models.ForeignKey(related_name='deployedServices', blank=True, to='uds.OSManager', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='deployedservice',
name='service',
field=models.ForeignKey(related_name='deployedServices', blank=True, to='uds.Service', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='deployedservice',
name='transports',
field=models.ManyToManyField(related_name='deployedServices', db_table='uds__ds_trans', to='uds.Transport'),
preserve_default=True,
),
migrations.AlterUniqueTogether(
name='config',
unique_together=set([('section', 'key')]),
),
]

View File

@ -1,28 +1,16 @@
from __future__ import unicode_literals
from south import signals
SOUTH_ERROR_MESSAGE = """\n
For South support, customize the SOUTH_MIGRATION_MODULES setting like so:
from uds import models
import logging
SOUTH_MIGRATION_MODULES = {
'uds': 'uds.south_migrations',
}
"""
logger = logging.getLogger(__name__)
# Ensure tables that needs to be in InnoDB are so
def modify_MySQL_storage(*args, **kwargs):
from django.db import connection
cursor = connection.cursor()
logger.info('Converting tables')
innoDbTables = (models.UserService, models.DeployedService, models.DeployedServicePublication,
models.Scheduler, models.DelayedTask, models.User, models.Group, models.Authenticator,
models.Service, models.Provider, models.Storage)
for model in innoDbTables:
db_table = model._meta.db_table
stmt = 'ALTER TABLE %s ENGINE=%s' % (db_table, 'InnoDB')
cursor.execute(stmt)
# sets charset to utf8
stmt = 'ALTER TABLE %s CHARACTER SET \'utf8\' COLLATE \'utf8_general_ci\'' % db_table
cursor.execute(stmt)
# signals.post_migrate.connect(modify_MySQL_storage)
# Ensure the user is not using Django 1.6 or below with South
try:
from django.db import migrations # noqa
except ImportError:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured(SOUTH_ERROR_MESSAGE)

View File

@ -33,7 +33,7 @@ Created on Jun 22, 2012
.. moduleauthor:: Adolfo Gómez, dkmaster at dkmon dot com
'''
from django.utils.translation import ugettext_noop as _, ugettext as _
from django.utils.translation import ugettext_noop as _
from uds.core.services import ServiceProvider
from SampleService import ServiceOne, ServiceTwo
from uds.core.ui import gui
@ -46,35 +46,35 @@ logger = logging.getLogger(__name__)
class Provider(ServiceProvider):
'''
This class represents the sample services provider
In this class we provide:
* The Provider functionality
* The basic configuration parameters for the provider
* The form fields needed by administrators to configure this provider
:note: At class level, the translation must be simply marked as so
using ugettext_noop. This is so cause we will translate the string when
sent to the administration client.
For this class to get visible at administration client as a provider type,
we MUST register it at package __init__.
'''
#: What kind of services we offer, this are classes inherited from Service
offers = [ServiceOne, ServiceTwo]
#: Name to show the administrator. This string will be translated BEFORE
#: sending it to administration interface, so don't forget to
#: mark it as _ (using ugettext_noop)
typeName = _('Sample Provider')
typeName = _('Sample Provider')
#: Type used internally to identify this provider
typeType = 'SampleProvider'
#: Description shown at administration interface for this provider
typeDescription = _('Sample (and dummy) service provider')
#: Icon file used as icon for this provider. This string will be translated
#: Icon file used as icon for this provider. This string will be translated
#: BEFORE sending it to administration interface, so don't forget to
#: mark it as _ (using ugettext_noop)
iconFile = 'provider.png'
# now comes the form fields
# There is always two fields that are requested to the admin, that are:
# Service Name, that is a name that the admin uses to name this provider
@ -84,64 +84,64 @@ class Provider(ServiceProvider):
# but used for sample purposes
# If we don't indicate an order, the output order of fields will be
# "random"
#: Remote host. Here core will translate label and tooltip, remember to
#: mark them as _ using ugettext_noop.
remoteHost = gui.TextField(oder=1,
length = 64,
label = _('Remote host'),
tooltip = _('This fields contains a remote host'),
required = True,
)
length=64,
label=_('Remote host'),
tooltip=_('This fields contains a remote host'),
required=True,
)
#: Name of your pet (sample, not really needed :-) )
petName = gui.TextField(order=2,
length = 32,
label = _('Your pet\'s name'),
tooltip = _('If you like, write the name of your pet'),
requred = False,
defvalue = 'Tux' #: This will not get translated
)
length=32,
label=_('Your pet\'s name'),
tooltip=_('If you like, write the name of your pet'),
requred=False,
defvalue='Tux' #: This will not get translated
)
#: Age of Methuselah (matusalén in spanish)
#: in Spain there is a well-known to say that something is very old,
#: in Spain there is a well-known to say that something is very old,
#: "Tiene mas años que matusalén"(is older than Methuselah)
methAge = gui.NumericField(order = 3,
length = 4, # That is, max allowed value is 9999
label = _('Age of Methuselah'),
tooltip = _('If you know it, please, tell me!!!'),
required = True, #: Numeric fields have always a value, so this not really needed
defvalue = '4500'
)
methAge = gui.NumericField(order=3,
length=4, # That is, max allowed value is 9999
label=_('Age of Methuselah'),
tooltip=_('If you know it, please, tell me!!!'),
required=True, #: Numeric fields have always a value, so this not really needed
defvalue='4500'
)
#: Is Methuselah istill alive?
methAlive = gui.CheckBoxField(order = 4,
label = _('Is Methuselah still alive?'),
tooltip = _('If you fails, this will not get saved :-)'),
required = True, #: Also means nothing. Check boxes has always a value
defvalue = gui.TRUE #: By default, at new item, check this
)
methAlive = gui.CheckBoxField(order=4,
label=_('Is Methuselah still alive?'),
tooltip=_('If you fails, this will not get saved :-)'),
required=True, #: Also means nothing. Check boxes has always a value
defvalue=gui.TRUE #: By default, at new item, check this
)
# There is more fields type, but not here the best place to cover it
def initialize(self, values = None):
def initialize(self, values=None):
'''
We will use the "autosave" feature for form fields, that is more than
enought for most providers. (We simply need to store data provided by user
and, maybe, initialize some kind of connection with this values).
Normally provider values are rally used at sevice level, cause we never
instantiate nothing except a service from a provider.
'''
# If you say meth is alive, you are wrong!!! (i guess..)
# values are only passed from administration client. Internals
# values are only passed from administration client. Internals
# instantiations are always empty.
if values is not None and self.methAlive.isTrue():
raise ServiceProvider.ValidationException(_('Methuselah is not alive!!! :-)'))
# Marshal and unmarshal are defaults ones, also enought
# As we use "autosave" fields feature, dictValues is also provided by
# base class so we don't have to mess with all those things...
@staticmethod
def test(env, data):
'''
@ -149,17 +149,17 @@ class Provider(ServiceProvider):
and this gets executed.
Args:
env: environment passed for testing (temporal environment passed)
data: data passed for testing (data obtained from the form
data: data passed for testing (data obtained from the form
definition)
Returns:
Array of two elements, first is True of False, depending on test
Returns:
Array of two elements, first is True of False, depending on test
(True is all right, false is error),
second is an String with error, preferably internacionalizated..
In this case, wi well do nothing more that use the provider params
Note also that this is an static method, that will be invoked using
the admin user provided data via administration client, and a temporary
environment that will be erased after invoking this method
@ -170,7 +170,7 @@ class Provider(ServiceProvider):
logger.debug('Methuselah has {0} years and is {1} :-)'
.format(instance.methAge.value, instance.methAlive.value))
except ServiceProvider.ValidationException as e:
# If we say that meth is alive, instantiation will
# If we say that meth is alive, instantiation will
return [False, str(e)]
except Exception as e:
logger.exception("Exception caugth!!!")
@ -180,17 +180,17 @@ class Provider(ServiceProvider):
# Congratulations!!!, the needed part of your first simple provider is done!
# Now you can go to administration panel, and check it
#
# From now onwards, we implement our own methods, that will be used by,
# From now onwards, we implement our own methods, that will be used by,
# for example, services derived from this provider
def host(self):
'''
Sample method, in fact in this we just return
Sample method, in fact in this we just return
the value of host field, that is an string
'''
return self.remoteHost.value
def methYears(self):
'''
Another sample return, it will in fact return the Methuselah years
'''
return self.methAge.value()

View File

@ -0,0 +1,537 @@
# encoding: utf-8
#@PydevCodeAnalysisIgnore
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Provider'
db.create_table('uds_provider', (
('comments', self.gf('django.db.models.fields.CharField')(max_length=256)),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('data_type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
))
db.send_create_signal('uds', ['Provider'])
# Adding model 'Service'
db.create_table('uds_service', (
('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
('data_type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('comments', self.gf('django.db.models.fields.CharField')(max_length=256)),
('provider', self.gf('django.db.models.fields.related.ForeignKey')(related_name='services', to=orm['uds.Provider'])),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['Service'])
# Adding unique constraint on 'Service', fields ['provider', 'name']
db.create_unique('uds_service', ['provider_id', 'name'])
# Adding model 'OSManager'
db.create_table('uds_osmanager', (
('comments', self.gf('django.db.models.fields.CharField')(max_length=256)),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('data_type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
))
db.send_create_signal('uds', ['OSManager'])
# Adding model 'Transport'
db.create_table('uds_transport', (
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
('data_type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('comments', self.gf('django.db.models.fields.CharField')(max_length=256)),
('priority', self.gf('django.db.models.fields.IntegerField')(default=0, db_index=True)),
('nets_positive', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['Transport'])
# Adding model 'Authenticator'
db.create_table('uds_authenticator', (
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
('data_type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('comments', self.gf('django.db.models.fields.TextField')(default='')),
('priority', self.gf('django.db.models.fields.IntegerField')(default=0, db_index=True)),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['Authenticator'])
# Adding model 'User'
db.create_table('uds_user', (
('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
('staff_member', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
('manager', self.gf('django.db.models.fields.related.ForeignKey')(related_name='users', to=orm['uds.Authenticator'])),
('comments', self.gf('django.db.models.fields.CharField')(max_length=256)),
('real_name', self.gf('django.db.models.fields.CharField')(max_length=128)),
('state', self.gf('django.db.models.fields.CharField')(max_length=1, db_index=True)),
('is_admin', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
('last_access', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(1972, 7, 1, 0, 0))),
('password', self.gf('django.db.models.fields.CharField')(default='', max_length=128)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['User'])
# Adding unique constraint on 'User', fields ['manager', 'name']
db.create_unique('uds_user', ['manager_id', 'name'])
# Adding model 'Group'
db.create_table('uds_group', (
('manager', self.gf('django.db.models.fields.related.ForeignKey')(related_name='groups', to=orm['uds.Authenticator'])),
('state', self.gf('django.db.models.fields.CharField')(default='A', max_length=1, db_index=True)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('comments', self.gf('django.db.models.fields.CharField')(default='', max_length=256)),
('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
))
db.send_create_signal('uds', ['Group'])
# Adding unique constraint on 'Group', fields ['manager', 'name']
db.create_unique('uds_group', ['manager_id', 'name'])
# Adding M2M table for field users on 'Group'
db.create_table('uds_group_users', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('group', models.ForeignKey(orm['uds.group'], null=False)),
('user', models.ForeignKey(orm['uds.user'], null=False))
))
db.create_unique('uds_group_users', ['group_id', 'user_id'])
# Adding model 'UserPreference'
db.create_table('uds_userpreference', (
('value', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='preferences', to=orm['uds.User'])),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('module', self.gf('django.db.models.fields.CharField')(max_length=32, db_index=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=32, db_index=True)),
))
db.send_create_signal('uds', ['UserPreference'])
# Adding unique constraint on 'UserPreference', fields ['module', 'name']
db.create_unique('uds_userpreference', ['module', 'name'])
# Adding model 'DeployedService'
db.create_table('uds__deployed_service', (
('initial_srvs', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('osmanager', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='deployedServices', null=True, to=orm['uds.OSManager'])),
('name', self.gf('django.db.models.fields.CharField')(default='', max_length=128)),
('service', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='deployedServices', null=True, to=orm['uds.Service'])),
('current_pub_revision', self.gf('django.db.models.fields.PositiveIntegerField')(default=1)),
('max_srvs', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('comments', self.gf('django.db.models.fields.CharField')(default='', max_length=256)),
('authenticator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='deployedServices', null=True, to=orm['uds.Authenticator'])),
('state', self.gf('django.db.models.fields.CharField')(default='A', max_length=1, db_index=True)),
('cache_l2_srvs', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('cache_l1_srvs', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['DeployedService'])
# Adding M2M table for field transports on 'DeployedService'
db.create_table('uds__ds_trans', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('deployedservice', models.ForeignKey(orm['uds.deployedservice'], null=False)),
('transport', models.ForeignKey(orm['uds.transport'], null=False))
))
db.create_unique('uds__ds_trans', ['deployedservice_id', 'transport_id'])
# Adding M2M table for field assignedGroups on 'DeployedService'
db.create_table('uds__ds_grps', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('deployedservice', models.ForeignKey(orm['uds.deployedservice'], null=False)),
('group', models.ForeignKey(orm['uds.group'], null=False))
))
db.create_unique('uds__ds_grps', ['deployedservice_id', 'group_id'])
# Adding model 'DeployedServicePublication'
db.create_table('uds__deployed_service_pub', (
('deployed_service', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publications', to=orm['uds.DeployedService'])),
('state', self.gf('django.db.models.fields.CharField')(default='P', max_length=1, db_index=True)),
('state_date', self.gf('django.db.models.fields.DateTimeField')()),
('publish_date', self.gf('django.db.models.fields.DateTimeField')(db_index=True)),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('revision', self.gf('django.db.models.fields.PositiveIntegerField')(default=1)),
))
db.send_create_signal('uds', ['DeployedServicePublication'])
# Adding model 'UserService'
db.create_table('uds__user_service', (
('cache_level', self.gf('django.db.models.fields.PositiveSmallIntegerField')(default=0, db_index=True)),
('publication', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='userServices', null=True, to=orm['uds.DeployedServicePublication'])),
('in_use', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
('os_state', self.gf('django.db.models.fields.CharField')(default='P', max_length=1)),
('friendly_name', self.gf('django.db.models.fields.CharField')(default='', max_length=128)),
('deployed_service', self.gf('django.db.models.fields.related.ForeignKey')(related_name='userServices', to=orm['uds.DeployedService'])),
('creation_date', self.gf('django.db.models.fields.DateTimeField')(db_index=True)),
('state', self.gf('django.db.models.fields.CharField')(default='P', max_length=1, db_index=True)),
('state_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='userServices', null=True, blank=True, to=orm['uds.User'])),
('in_use_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(1972, 7, 1, 0, 0))),
('data', self.gf('django.db.models.fields.TextField')(default='')),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('unique_id', self.gf('django.db.models.fields.CharField')(default='', max_length=128, db_index=True)),
))
db.send_create_signal('uds', ['UserService'])
# Adding model 'Cache'
db.create_table('uds_utility_cache', (
('owner', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
('validity', self.gf('django.db.models.fields.IntegerField')(default=60)),
('value', self.gf('django.db.models.fields.TextField')(default='')),
('key', self.gf('django.db.models.fields.CharField')(max_length=64, primary_key=True)),
('created', self.gf('django.db.models.fields.DateTimeField')()),
))
db.send_create_signal('uds', ['Cache'])
# Adding model 'Config'
db.create_table('uds_configuration', (
('value', self.gf('django.db.models.fields.TextField')(default='')),
('section', self.gf('django.db.models.fields.CharField')(max_length=128)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('key', self.gf('django.db.models.fields.CharField')(max_length=64)),
))
db.send_create_signal('uds', ['Config'])
# Adding unique constraint on 'Config', fields ['section', 'key']
db.create_unique('uds_configuration', ['section', 'key'])
# Adding model 'Storage'
db.create_table('uds_storage', (
('owner', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
('data', self.gf('django.db.models.fields.CharField')(default='', max_length=1024)),
('key', self.gf('django.db.models.fields.CharField')(max_length=64, primary_key=True)),
('attr1', self.gf('django.db.models.fields.CharField')(default=None, max_length=64, null=True, db_index=True, blank=True)),
))
db.send_create_signal('uds', ['Storage'])
# Adding model 'UniqueId'
db.create_table('uds_uniqueid', (
('owner', self.gf('django.db.models.fields.CharField')(default='', max_length=128, db_index=True)),
('assigned', self.gf('django.db.models.fields.BooleanField')(default=True, db_index=True, blank=True)),
('basename', self.gf('django.db.models.fields.CharField')(max_length=32, db_index=True)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('seq', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)),
))
db.send_create_signal('uds', ['UniqueId'])
# Adding unique constraint on 'UniqueId', fields ['basename', 'seq']
db.create_unique('uds_uniqueid', ['basename', 'seq'])
# Adding model 'Scheduler'
db.create_table('uds_scheduler', (
('last_execution', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('frecuency', self.gf('django.db.models.fields.PositiveIntegerField')(default=86400)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('state', self.gf('django.db.models.fields.CharField')(default='X', max_length=1, db_index=True)),
('next_execution', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(1972, 7, 1, 0, 0), db_index=True)),
('owner_server', self.gf('django.db.models.fields.CharField')(default='', max_length=64, db_index=True)),
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=64)),
))
db.send_create_signal('uds', ['Scheduler'])
# Adding model 'DelayedTask'
db.create_table('uds_delayedtask', (
('insert_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('execution_delay', self.gf('django.db.models.fields.PositiveIntegerField')()),
('execution_time', self.gf('django.db.models.fields.DateTimeField')(db_index=True)),
('instance', self.gf('django.db.models.fields.TextField')()),
('tag', self.gf('django.db.models.fields.CharField')(max_length=64, db_index=True)),
('type', self.gf('django.db.models.fields.CharField')(max_length=128)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('uds', ['DelayedTask'])
# Adding model 'Network'
db.create_table('uds_network', (
('net_start', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)),
('net_end', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=64)),
))
db.send_create_signal('uds', ['Network'])
# Adding M2M table for field transports on 'Network'
db.create_table('uds_net_trans', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('network', models.ForeignKey(orm['uds.network'], null=False)),
('transport', models.ForeignKey(orm['uds.transport'], null=False))
))
db.create_unique('uds_net_trans', ['network_id', 'transport_id'])
def backwards(self, orm):
# Deleting model 'Provider'
db.delete_table('uds_provider')
# Deleting model 'Service'
db.delete_table('uds_service')
# Removing unique constraint on 'Service', fields ['provider', 'name']
db.delete_unique('uds_service', ['provider_id', 'name'])
# Deleting model 'OSManager'
db.delete_table('uds_osmanager')
# Deleting model 'Transport'
db.delete_table('uds_transport')
# Deleting model 'Authenticator'
db.delete_table('uds_authenticator')
# Deleting model 'User'
db.delete_table('uds_user')
# Removing unique constraint on 'User', fields ['manager', 'name']
db.delete_unique('uds_user', ['manager_id', 'name'])
# Deleting model 'Group'
db.delete_table('uds_group')
# Removing unique constraint on 'Group', fields ['manager', 'name']
db.delete_unique('uds_group', ['manager_id', 'name'])
# Removing M2M table for field users on 'Group'
db.delete_table('uds_group_users')
# Deleting model 'UserPreference'
db.delete_table('uds_userpreference')
# Removing unique constraint on 'UserPreference', fields ['module', 'name']
db.delete_unique('uds_userpreference', ['module', 'name'])
# Deleting model 'DeployedService'
db.delete_table('uds__deployed_service')
# Removing M2M table for field transports on 'DeployedService'
db.delete_table('uds__ds_trans')
# Removing M2M table for field assignedGroups on 'DeployedService'
db.delete_table('uds__ds_grps')
# Deleting model 'DeployedServicePublication'
db.delete_table('uds__deployed_service_pub')
# Deleting model 'UserService'
db.delete_table('uds__user_service')
# Deleting model 'Cache'
db.delete_table('uds_utility_cache')
# Deleting model 'Config'
db.delete_table('uds_configuration')
# Removing unique constraint on 'Config', fields ['section', 'key']
db.delete_unique('uds_configuration', ['section', 'key'])
# Deleting model 'Storage'
db.delete_table('uds_storage')
# Deleting model 'UniqueId'
db.delete_table('uds_uniqueid')
# Removing unique constraint on 'UniqueId', fields ['basename', 'seq']
db.delete_unique('uds_uniqueid', ['basename', 'seq'])
# Deleting model 'Scheduler'
db.delete_table('uds_scheduler')
# Deleting model 'DelayedTask'
db.delete_table('uds_delayedtask')
# Deleting model 'Network'
db.delete_table('uds_network')
# Removing M2M table for field transports on 'Network'
db.delete_table('uds_net_trans')
models = {
'uds.authenticator': {
'Meta': {'object_name': 'Authenticator'},
'comments': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
'priority': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'})
},
'uds.cache': {
'Meta': {'object_name': 'Cache', 'db_table': "'uds_utility_cache'"},
'created': ('django.db.models.fields.DateTimeField', [], {}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'}),
'owner': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'validity': ('django.db.models.fields.IntegerField', [], {'default': '60'}),
'value': ('django.db.models.fields.TextField', [], {'default': "''"})
},
'uds.config': {
'Meta': {'unique_together': "(('section', 'key'),)", 'object_name': 'Config', 'db_table': "'uds_configuration'"},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
'section': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'value': ('django.db.models.fields.TextField', [], {'default': "''"})
},
'uds.delayedtask': {
'Meta': {'object_name': 'DelayedTask'},
'execution_delay': ('django.db.models.fields.PositiveIntegerField', [], {}),
'execution_time': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'insert_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'instance': ('django.db.models.fields.TextField', [], {}),
'tag': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_index': 'True'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'uds.deployedservice': {
'Meta': {'object_name': 'DeployedService', 'db_table': "'uds__deployed_service'"},
'assignedGroups': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'deployedServices'", 'symmetrical': 'False', 'db_table': "'uds__ds_grps'", 'to': "orm['uds.Group']"}),
'authenticator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deployedServices'", 'null': 'True', 'to': "orm['uds.Authenticator']"}),
'cache_l1_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'cache_l2_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'comments': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256'}),
'current_pub_revision': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'initial_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'max_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}),
'osmanager': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deployedServices'", 'null': 'True', 'to': "orm['uds.OSManager']"}),
'service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'deployedServices'", 'null': 'True', 'to': "orm['uds.Service']"}),
'state': ('django.db.models.fields.CharField', [], {'default': "'A'", 'max_length': '1', 'db_index': 'True'}),
'transports': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'deployedServices'", 'symmetrical': 'False', 'db_table': "'uds__ds_trans'", 'to': "orm['uds.Transport']"})
},
'uds.deployedservicepublication': {
'Meta': {'object_name': 'DeployedServicePublication', 'db_table': "'uds__deployed_service_pub'"},
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'deployed_service': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publications'", 'to': "orm['uds.DeployedService']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'publish_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'revision': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'state': ('django.db.models.fields.CharField', [], {'default': "'P'", 'max_length': '1', 'db_index': 'True'}),
'state_date': ('django.db.models.fields.DateTimeField', [], {})
},
'uds.group': {
'Meta': {'unique_together': "(('manager', 'name'),)", 'object_name': 'Group'},
'comments': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'manager': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'groups'", 'to': "orm['uds.Authenticator']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'state': ('django.db.models.fields.CharField', [], {'default': "'A'", 'max_length': '1', 'db_index': 'True'}),
'users': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'groups'", 'symmetrical': 'False', 'to': "orm['uds.User']"})
},
'uds.network': {
'Meta': {'object_name': 'Network'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}),
'net_end': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
'net_start': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
'transports': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'networks'", 'symmetrical': 'False', 'db_table': "'uds_net_trans'", 'to': "orm['uds.Transport']"})
},
'uds.osmanager': {
'Meta': {'object_name': 'OSManager'},
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
},
'uds.provider': {
'Meta': {'object_name': 'Provider'},
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
},
'uds.scheduler': {
'Meta': {'object_name': 'Scheduler'},
'frecuency': ('django.db.models.fields.PositiveIntegerField', [], {'default': '86400'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_execution': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}),
'next_execution': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1972, 7, 1, 0, 0)', 'db_index': 'True'}),
'owner_server': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'db_index': 'True'}),
'state': ('django.db.models.fields.CharField', [], {'default': "'X'", 'max_length': '1', 'db_index': 'True'})
},
'uds.service': {
'Meta': {'unique_together': "(('provider', 'name'),)", 'object_name': 'Service'},
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'provider': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'services'", 'to': "orm['uds.Provider']"})
},
'uds.storage': {
'Meta': {'object_name': 'Storage'},
'attr1': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '64', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'data': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'}),
'owner': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
},
'uds.transport': {
'Meta': {'object_name': 'Transport'},
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
'nets_positive': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'priority': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'})
},
'uds.uniqueid': {
'Meta': {'unique_together': "(('basename', 'seq'),)", 'object_name': 'UniqueId'},
'assigned': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True', 'blank': 'True'}),
'basename': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'owner': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128', 'db_index': 'True'}),
'seq': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'})
},
'uds.user': {
'Meta': {'unique_together': "(('manager', 'name'),)", 'object_name': 'User'},
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_admin': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'last_access': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1972, 7, 1, 0, 0)'}),
'manager': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'users'", 'to': "orm['uds.Authenticator']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}),
'real_name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'staff_member': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'state': ('django.db.models.fields.CharField', [], {'max_length': '1', 'db_index': 'True'})
},
'uds.userpreference': {
'Meta': {'unique_together': "(('module', 'name'),)", 'object_name': 'UserPreference'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'module': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'preferences'", 'to': "orm['uds.User']"}),
'value': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
},
'uds.userservice': {
'Meta': {'object_name': 'UserService', 'db_table': "'uds__user_service'"},
'cache_level': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'data': ('django.db.models.fields.TextField', [], {'default': "''"}),
'deployed_service': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'userServices'", 'to': "orm['uds.DeployedService']"}),
'friendly_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'in_use': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'in_use_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1972, 7, 1, 0, 0)'}),
'os_state': ('django.db.models.fields.CharField', [], {'default': "'P'", 'max_length': '1'}),
'publication': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'userServices'", 'null': 'True', 'to': "orm['uds.DeployedServicePublication']"}),
'state': ('django.db.models.fields.CharField', [], {'default': "'P'", 'max_length': '1', 'db_index': 'True'}),
'state_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'unique_id': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128', 'db_index': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'userServices'", 'null': 'True', 'blank': 'True', 'to': "orm['uds.User']"})
}
}
complete_apps = ['uds']

View File

@ -0,0 +1,28 @@
from __future__ import unicode_literals
from south import signals
from uds import models
import logging
logger = logging.getLogger(__name__)
# Ensure tables that needs to be in InnoDB are so
def modify_MySQL_storage(*args, **kwargs):
from django.db import connection
cursor = connection.cursor()
logger.info('Converting tables')
innoDbTables = (models.UserService, models.DeployedService, models.DeployedServicePublication,
models.Scheduler, models.DelayedTask, models.User, models.Group, models.Authenticator,
models.Service, models.Provider, models.Storage)
for model in innoDbTables:
db_table = model._meta.db_table
stmt = 'ALTER TABLE %s ENGINE=%s' % (db_table, 'InnoDB')
cursor.execute(stmt)
# sets charset to utf8
stmt = 'ALTER TABLE %s CHARACTER SET \'utf8\' COLLATE \'utf8_general_ci\'' % db_table
cursor.execute(stmt)
# signals.post_migrate.connect(modify_MySQL_storage)