diff options
Diffstat (limited to 'src/lib/Bcfg2')
38 files changed, 3036 insertions, 2157 deletions
diff --git a/src/lib/Bcfg2/DBSettings.py b/src/lib/Bcfg2/DBSettings.py index 420f0ddd8..03e34bbc3 100644 --- a/src/lib/Bcfg2/DBSettings.py +++ b/src/lib/Bcfg2/DBSettings.py @@ -50,8 +50,7 @@ settings = dict( # pylint: disable=C0103 MIDDLEWARE_CLASSES=( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.middleware.doc.XViewMiddleware'), + 'django.contrib.auth.middleware.AuthenticationMiddleware'), ROOT_URLCONF='Bcfg2.Reporting.urls', AUTHENTICATION_BACKENDS=('django.contrib.auth.backends.ModelBackend'), LOGIN_URL='/login', @@ -65,10 +64,23 @@ settings = dict( # pylint: disable=C0103 'django.core.context_processors.i18n', 'django.core.context_processors.media', 'django.core.context_processors.request'), - DATABASE_ROUTERS=['Bcfg2.DBSettings.PerApplicationRouter']) - -if HAS_SOUTH: + DATABASE_ROUTERS=['Bcfg2.DBSettings.PerApplicationRouter'], + TEST_RUNNER='django.test.simple.DjangoTestSuiteRunner') + +if HAS_DJANGO and django.VERSION[0] == 1 and django.VERSION[1] >= 6: + settings['MIDDLEWARE_CLASSES'] += \ + ('django.contrib.admindocs.middleware.XViewMiddleware',) +elif HAS_SOUTH: + settings['MIDDLEWARE_CLASSES'] += \ + ('django.middleware.doc.XViewMiddleware',) + +if HAS_DJANGO and django.VERSION[0] == 1 and django.VERSION[1] >= 7: + settings['INSTALLED_APPS'] += ('Bcfg2.Reporting',) +elif HAS_SOUTH: settings['INSTALLED_APPS'] += ('south', 'Bcfg2.Reporting') + settings['SOUTH_MIGRATION_MODULES'] = { + 'Bcfg2.Reporting': 'Bcfg2.Reporting.south_migrations' + } if 'BCFG2_LEGACY_MODELS' in os.environ: settings['INSTALLED_APPS'] += ('Bcfg2.Server.Reports.reports',) @@ -142,6 +154,10 @@ def finalize_django_config(opts=None, silent=False): def sync_databases(**kwargs): """ Synchronize all databases that we know about. """ + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + # Nothing needed here, it's all handled with migrate + return + logger = logging.getLogger() for database in settings['DATABASES']: logger.debug("Syncing database %s" % (database)) @@ -149,11 +165,56 @@ def sync_databases(**kwargs): **kwargs) +def upgrade_to_django_migrations(database, logger): + """ + Get the migration state from south and move django migrations to + the same state by fake applying the same migration. + + Note: We cannot use south directly here, because this functions + runs on django-1.7 or higher, that is not supported by south. + """ + + last_migration = None + try: + # get latest south migration + cursor = django.db.connections[database].cursor() + cursor.cursor.execute('SELECT migration FROM south_migrationhistory') + applied_migrations = [name for (name,) in cursor.fetchall()] + last_migration = sorted(applied_migrations).pop() + except: # pylint: disable=W0702 + # django.db.DatabaseError is not working here, because we are + # using the low level api to interact directly with the database + logger.debug("No south migration detected for database: %s." % + database) + + if last_migration is not None: + # fake-apply matching django migrations + django.core.management.call_command( + "migrate", 'Reporting', last_migration, + database=database, fake=True) + + +def initial_django_migration(database): + """ Check if we ever executed an initial django migration. """ + from django.db.migrations import loader # pylint: disable=E0611 + loader = loader.MigrationLoader(django.db.connections[database]) + return len(loader.applied_migrations) == 0 + + def migrate_databases(**kwargs): """ Do South migrations on all databases that we know about. """ logger = logging.getLogger() for database in settings['DATABASES']: logger.debug("Migrating database %s" % (database)) + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + django.setup() # pylint: disable=E1101 + if initial_django_migration(database): + logger.warning( + "No applied django migrations found for database %s. " + "Trying to get the state from south migration in case " + "you just upgraded your django version." % database) + upgrade_to_django_migrations(database, logger) + django.core.management.call_command("migrate", database=database, **kwargs) @@ -196,7 +257,14 @@ class PerApplicationRouter(object): def allow_syncdb(self, *_): """ Called when Django wants to determine which models to sync to a given database. Take the cowards way out and sync all models to all - databases to allow for easy migrations. """ + databases to allow for easy migrations. This method is replaced with + allow_migrate in django 1.7 and higher. """ + return True + + def allow_migrate(self, *_args, **_kwargs): + """ Called when Django wants to determine which migrations should + be run on a given database. Take the cowards way out and run all + migrations to all databases to allow for easy migrations. """ return True diff --git a/src/lib/Bcfg2/Logger.py b/src/lib/Bcfg2/Logger.py index 11eaeebd1..e5f316a18 100644 --- a/src/lib/Bcfg2/Logger.py +++ b/src/lib/Bcfg2/Logger.py @@ -41,6 +41,8 @@ class TermiosFormatter(logging.Formatter): returns = [] line_len = self.width if isinstance(record.msg, str): + if len(record.args) != 0: + record.msg = record.msg % record.args for line in record.msg.split('\n'): if len(line) <= line_len: returns.append(line) diff --git a/src/lib/Bcfg2/Reporting/Reports.py b/src/lib/Bcfg2/Reporting/Reports.py index e91511c60..7ba0265ae 100755 --- a/src/lib/Bcfg2/Reporting/Reports.py +++ b/src/lib/Bcfg2/Reporting/Reports.py @@ -4,6 +4,7 @@ import sys import argparse import datetime +import django import Bcfg2.DBSettings from django.core.exceptions import ObjectDoesNotExist @@ -326,6 +327,8 @@ class CLI(Bcfg2.Options.CommandRegistry): components=[self]) parser.add_options(self.subcommand_options) parser.parse() + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + django.setup() # pylint: disable=E1101 def run(self): """ Run bcfg2-reports """ diff --git a/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py b/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py index c9aa169bf..ac0cde783 100644 --- a/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py +++ b/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py @@ -11,11 +11,11 @@ import Bcfg2.DBSettings from Bcfg2.Compat import md5 from Bcfg2.Reporting.Storage.base import StorageBase, StorageError from Bcfg2.Server.Plugin.exceptions import PluginExecutionError +import django from django.core import management from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.db.models import FieldDoesNotExist from django.core.cache import cache -from django import db #Used by GetCurrentEntry import difflib @@ -24,6 +24,16 @@ from Bcfg2.Reporting.models import * from Bcfg2.Reporting.Compat import transaction +def get_all_field_names(model): + if django.VERSION[0] == 1 and django.VERSION[1] >= 8: + return [field.name + for field in model._meta.get_fields() + if field.auto_created == False and + not (field.is_relation and field.related_model is None)] + else: + return model._meta.get_all_field_names() + + class DjangoORM(StorageBase): options = StorageBase.options + [ Bcfg2.Options.Common.repository, @@ -80,7 +90,7 @@ class DjangoORM(StorageBase): for attr in boolean + ["current_exists"]: xforms[attr] = boolean_xform act_dict = dict(state=state) - for fieldname in entrytype._meta.get_all_field_names(): + for fieldname in get_all_field_names(entrytype): if fieldname in ['id', 'hash_key', 'state']: continue try: @@ -383,8 +393,12 @@ class DjangoORM(StorageBase): finally: self.logger.debug("%s: Closing database connection" % self.__class__.__name__) - db.close_connection() + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + for connection in django.db.connections.all(): + connection.close() + else: + django.db.close_connection() def validate(self): """Validate backend storage. Should be called once when loaded""" diff --git a/src/lib/Bcfg2/Reporting/migrations/0001_initial.py b/src/lib/Bcfg2/Reporting/migrations/0001_initial.py index 609290edb..6a52a8b2d 100644 --- a/src/lib/Bcfg2/Reporting/migrations/0001_initial.py +++ b/src/lib/Bcfg2/Reporting/migrations/0001_initial.py @@ -1,465 +1,281 @@ # -*- coding: utf-8 -*- -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 'Client' - db.create_table('Reporting_client', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('creation', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('current_interaction', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='parent_client', null=True, to=orm['Reporting.Interaction'])), - ('expiration', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), - )) - db.send_create_signal('Reporting', ['Client']) - - # Adding model 'Interaction' - db.create_table('Reporting_interaction', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('client', self.gf('django.db.models.fields.related.ForeignKey')(related_name='interactions', to=orm['Reporting.Client'])), - ('timestamp', self.gf('django.db.models.fields.DateTimeField')(db_index=True)), - ('state', self.gf('django.db.models.fields.CharField')(max_length=32)), - ('repo_rev_code', self.gf('django.db.models.fields.CharField')(max_length=64)), - ('server', self.gf('django.db.models.fields.CharField')(max_length=256)), - ('good_count', self.gf('django.db.models.fields.IntegerField')()), - ('total_count', self.gf('django.db.models.fields.IntegerField')()), - ('bad_count', self.gf('django.db.models.fields.IntegerField')(default=0)), - ('modified_count', self.gf('django.db.models.fields.IntegerField')(default=0)), - ('extra_count', self.gf('django.db.models.fields.IntegerField')(default=0)), - ('profile', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['Reporting.Group'])), - )) - db.send_create_signal('Reporting', ['Interaction']) - - # Adding unique constraint on 'Interaction', fields ['client', 'timestamp'] - db.create_unique('Reporting_interaction', ['client_id', 'timestamp']) - - # Adding M2M table for field actions on 'Interaction' - db.create_table('Reporting_interaction_actions', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('actionentry', models.ForeignKey(orm['Reporting.actionentry'], null=False)) - )) - db.create_unique('Reporting_interaction_actions', ['interaction_id', 'actionentry_id']) - - # Adding M2M table for field packages on 'Interaction' - db.create_table('Reporting_interaction_packages', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('packageentry', models.ForeignKey(orm['Reporting.packageentry'], null=False)) - )) - db.create_unique('Reporting_interaction_packages', ['interaction_id', 'packageentry_id']) - - # Adding M2M table for field paths on 'Interaction' - db.create_table('Reporting_interaction_paths', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('pathentry', models.ForeignKey(orm['Reporting.pathentry'], null=False)) - )) - db.create_unique('Reporting_interaction_paths', ['interaction_id', 'pathentry_id']) - - # Adding M2M table for field services on 'Interaction' - db.create_table('Reporting_interaction_services', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('serviceentry', models.ForeignKey(orm['Reporting.serviceentry'], null=False)) - )) - db.create_unique('Reporting_interaction_services', ['interaction_id', 'serviceentry_id']) - - # Adding M2M table for field failures on 'Interaction' - db.create_table('Reporting_interaction_failures', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('failureentry', models.ForeignKey(orm['Reporting.failureentry'], null=False)) - )) - db.create_unique('Reporting_interaction_failures', ['interaction_id', 'failureentry_id']) - - # Adding M2M table for field groups on 'Interaction' - db.create_table('Reporting_interaction_groups', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('group', models.ForeignKey(orm['Reporting.group'], null=False)) - )) - db.create_unique('Reporting_interaction_groups', ['interaction_id', 'group_id']) - - # Adding M2M table for field bundles on 'Interaction' - db.create_table('Reporting_interaction_bundles', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('bundle', models.ForeignKey(orm['Reporting.bundle'], null=False)) - )) - db.create_unique('Reporting_interaction_bundles', ['interaction_id', 'bundle_id']) - - # Adding model 'Performance' - db.create_table('Reporting_performance', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('interaction', self.gf('django.db.models.fields.related.ForeignKey')(related_name='performance_items', to=orm['Reporting.Interaction'])), - ('metric', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('value', self.gf('django.db.models.fields.DecimalField')(max_digits=32, decimal_places=16)), - )) - db.send_create_signal('Reporting', ['Performance']) - - # Adding model 'Group' - db.create_table('Reporting_group', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), - ('profile', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('public', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('category', self.gf('django.db.models.fields.CharField')(max_length=1024, blank=True)), - ('comment', self.gf('django.db.models.fields.TextField')(blank=True)), - )) - db.send_create_signal('Reporting', ['Group']) - - # Adding M2M table for field groups on 'Group' - db.create_table('Reporting_group_groups', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('from_group', models.ForeignKey(orm['Reporting.group'], null=False)), - ('to_group', models.ForeignKey(orm['Reporting.group'], null=False)) - )) - db.create_unique('Reporting_group_groups', ['from_group_id', 'to_group_id']) - - # Adding M2M table for field bundles on 'Group' - db.create_table('Reporting_group_bundles', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('group', models.ForeignKey(orm['Reporting.group'], null=False)), - ('bundle', models.ForeignKey(orm['Reporting.bundle'], null=False)) - )) - db.create_unique('Reporting_group_bundles', ['group_id', 'bundle_id']) - - # Adding model 'Bundle' - db.create_table('Reporting_bundle', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), - )) - db.send_create_signal('Reporting', ['Bundle']) - - # Adding model 'FilePerms' - db.create_table('Reporting_fileperms', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('owner', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('group', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('perms', self.gf('django.db.models.fields.CharField')(max_length=128)), - )) - db.send_create_signal('Reporting', ['FilePerms']) - - # Adding unique constraint on 'FilePerms', fields ['owner', 'group', 'perms'] - db.create_unique('Reporting_fileperms', ['owner', 'group', 'perms']) - - # Adding model 'FileAcl' - db.create_table('Reporting_fileacl', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - )) - db.send_create_signal('Reporting', ['FileAcl']) - - # Adding model 'FailureEntry' - db.create_table('Reporting_failureentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.IntegerField')(db_index=True)), - ('entry_type', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('message', self.gf('django.db.models.fields.TextField')()), - )) - db.send_create_signal('Reporting', ['FailureEntry']) - - # Adding model 'ActionEntry' - db.create_table('Reporting_actionentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.IntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('status', self.gf('django.db.models.fields.CharField')(default='check', max_length=128)), - ('output', self.gf('django.db.models.fields.IntegerField')(default=0)), - )) - db.send_create_signal('Reporting', ['ActionEntry']) - - # Adding model 'PackageEntry' - db.create_table('Reporting_packageentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.IntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('target_version', self.gf('django.db.models.fields.CharField')(default='', max_length=1024)), - ('current_version', self.gf('django.db.models.fields.CharField')(max_length=1024)), - ('verification_details', self.gf('django.db.models.fields.TextField')(default='')), - )) - db.send_create_signal('Reporting', ['PackageEntry']) - - # Adding model 'PathEntry' - db.create_table('Reporting_pathentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.IntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('path_type', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('target_perms', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['Reporting.FilePerms'])), - ('current_perms', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['Reporting.FilePerms'])), - ('detail_type', self.gf('django.db.models.fields.IntegerField')(default=0)), - ('details', self.gf('django.db.models.fields.TextField')(default='')), - )) - db.send_create_signal('Reporting', ['PathEntry']) - - # Adding M2M table for field acls on 'PathEntry' - db.create_table('Reporting_pathentry_acls', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('pathentry', models.ForeignKey(orm['Reporting.pathentry'], null=False)), - ('fileacl', models.ForeignKey(orm['Reporting.fileacl'], null=False)) - )) - db.create_unique('Reporting_pathentry_acls', ['pathentry_id', 'fileacl_id']) - - # Adding model 'LinkEntry' - db.create_table('Reporting_linkentry', ( - ('pathentry_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['Reporting.PathEntry'], unique=True, primary_key=True)), - ('target_path', self.gf('django.db.models.fields.CharField')(max_length=1024, blank=True)), - ('current_path', self.gf('django.db.models.fields.CharField')(max_length=1024, blank=True)), - )) - db.send_create_signal('Reporting', ['LinkEntry']) - - # Adding model 'DeviceEntry' - db.create_table('Reporting_deviceentry', ( - ('pathentry_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['Reporting.PathEntry'], unique=True, primary_key=True)), - ('device_type', self.gf('django.db.models.fields.CharField')(max_length=16)), - ('target_major', self.gf('django.db.models.fields.IntegerField')()), - ('target_minor', self.gf('django.db.models.fields.IntegerField')()), - ('current_major', self.gf('django.db.models.fields.IntegerField')()), - ('current_minor', self.gf('django.db.models.fields.IntegerField')()), - )) - db.send_create_signal('Reporting', ['DeviceEntry']) - - # Adding model 'ServiceEntry' - db.create_table('Reporting_serviceentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.IntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('target_status', self.gf('django.db.models.fields.CharField')(default='', max_length=128)), - ('current_status', self.gf('django.db.models.fields.CharField')(default='', max_length=128)), - )) - db.send_create_signal('Reporting', ['ServiceEntry']) - - - def backwards(self, orm): - # Removing unique constraint on 'FilePerms', fields ['owner', 'group', 'perms'] - db.delete_unique('Reporting_fileperms', ['owner', 'group', 'perms']) - - # Removing unique constraint on 'Interaction', fields ['client', 'timestamp'] - db.delete_unique('Reporting_interaction', ['client_id', 'timestamp']) - - # Deleting model 'Client' - db.delete_table('Reporting_client') - - # Deleting model 'Interaction' - db.delete_table('Reporting_interaction') - - # Removing M2M table for field actions on 'Interaction' - db.delete_table('Reporting_interaction_actions') - - # Removing M2M table for field packages on 'Interaction' - db.delete_table('Reporting_interaction_packages') - - # Removing M2M table for field paths on 'Interaction' - db.delete_table('Reporting_interaction_paths') - - # Removing M2M table for field services on 'Interaction' - db.delete_table('Reporting_interaction_services') - - # Removing M2M table for field failures on 'Interaction' - db.delete_table('Reporting_interaction_failures') - - # Removing M2M table for field groups on 'Interaction' - db.delete_table('Reporting_interaction_groups') - - # Removing M2M table for field bundles on 'Interaction' - db.delete_table('Reporting_interaction_bundles') - - # Deleting model 'Performance' - db.delete_table('Reporting_performance') - - # Deleting model 'Group' - db.delete_table('Reporting_group') - - # Removing M2M table for field groups on 'Group' - db.delete_table('Reporting_group_groups') - - # Removing M2M table for field bundles on 'Group' - db.delete_table('Reporting_group_bundles') - - # Deleting model 'Bundle' - db.delete_table('Reporting_bundle') - - # Deleting model 'FilePerms' - db.delete_table('Reporting_fileperms') - - # Deleting model 'FileAcl' - db.delete_table('Reporting_fileacl') - - # Deleting model 'FailureEntry' - db.delete_table('Reporting_failureentry') - - # Deleting model 'ActionEntry' - db.delete_table('Reporting_actionentry') - - # Deleting model 'PackageEntry' - db.delete_table('Reporting_packageentry') - - # Deleting model 'PathEntry' - db.delete_table('Reporting_pathentry') - - # Removing M2M table for field acls on 'PathEntry' - db.delete_table('Reporting_pathentry_acls') - - # Deleting model 'LinkEntry' - db.delete_table('Reporting_linkentry') - - # Deleting model 'DeviceEntry' - db.delete_table('Reporting_deviceentry') - - # Deleting model 'ServiceEntry' - db.delete_table('Reporting_serviceentry') - - - models = { - 'Reporting.actionentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) - }, - 'Reporting.bundle': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) - }, - 'Reporting.client': { - 'Meta': {'object_name': 'Client'}, - 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), - 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.deviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_major': ('django.db.models.fields.IntegerField', [], {}), - 'current_minor': ('django.db.models.fields.IntegerField', [], {}), - 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_major': ('django.db.models.fields.IntegerField', [], {}), - 'target_minor': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.failureentry': { - 'Meta': {'object_name': 'FailureEntry'}, - 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'message': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileacl': { - 'Meta': {'object_name': 'FileAcl'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileperms': { - 'Meta': {'unique_together': "(('owner', 'group', 'perms'),)", 'object_name': 'FilePerms'}, - 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'perms': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.group': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), - 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) - }, - 'Reporting.interaction': { - 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, - 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), - 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), - 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), - 'good_count': ('django.db.models.fields.IntegerField', [], {}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), - 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), - 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.Group']"}), - 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), - 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), - 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), - 'total_count': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.linkentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) - }, - 'Reporting.packageentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, - 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), - 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) - }, - 'Reporting.pathentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, - 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), - 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), - 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) - }, - 'Reporting.performance': { - 'Meta': {'object_name': 'Performance'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), - 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) - }, - 'Reporting.serviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, - 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) - } - } - - complete_apps = ['Reporting']
\ No newline at end of file +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='ActionEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.IntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('status', models.CharField(default=b'check', max_length=128)), + ('output', models.IntegerField(default=0)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Bundle', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(unique=True, max_length=255)), + ], + options={ + 'ordering': ('name',), + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Client', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('creation', models.DateTimeField(auto_now_add=True)), + ('name', models.CharField(max_length=128)), + ('expiration', models.DateTimeField(null=True, blank=True)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='FailureEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.IntegerField(editable=False, db_index=True)), + ('entry_type', models.CharField(max_length=128)), + ('message', models.TextField()), + ], + options={ + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='FileAcl', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='FilePerms', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('owner', models.CharField(max_length=128)), + ('group', models.CharField(max_length=128)), + ('perms', models.CharField(max_length=128)), + ], + options={ + }, + 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(unique=True, max_length=255)), + ('profile', models.BooleanField(default=False)), + ('public', models.BooleanField(default=False)), + ('category', models.CharField(max_length=1024, blank=True)), + ('comment', models.TextField(blank=True)), + ('bundles', models.ManyToManyField(to='Reporting.Bundle')), + ('groups', models.ManyToManyField(to='Reporting.Group')), + ], + options={ + 'ordering': ('name',), + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Interaction', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('timestamp', models.DateTimeField(db_index=True)), + ('state', models.CharField(max_length=32)), + ('repo_rev_code', models.CharField(max_length=64)), + ('server', models.CharField(max_length=256)), + ('good_count', models.IntegerField()), + ('total_count', models.IntegerField()), + ('bad_count', models.IntegerField(default=0)), + ('modified_count', models.IntegerField(default=0)), + ('extra_count', models.IntegerField(default=0)), + ('actions', models.ManyToManyField(to='Reporting.ActionEntry')), + ('bundles', models.ManyToManyField(to='Reporting.Bundle')), + ('client', models.ForeignKey(related_name='interactions', to='Reporting.Client')), + ('failures', models.ManyToManyField(to='Reporting.FailureEntry')), + ('groups', models.ManyToManyField(to='Reporting.Group')), + ], + options={ + 'ordering': ['-timestamp'], + 'get_latest_by': 'timestamp', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='PackageEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.IntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('target_version', models.CharField(default=b'', max_length=1024)), + ('current_version', models.CharField(max_length=1024)), + ('verification_details', models.TextField(default=b'')), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='PathEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.IntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('path_type', models.CharField(max_length=128, choices=[(b'device', b'Device'), (b'directory', b'Directory'), (b'hardlink', b'Hard Link'), (b'nonexistent', b'Non Existent'), (b'permissions', b'Permissions'), (b'symlink', b'Symlink')])), + ('detail_type', models.IntegerField(default=0, choices=[(0, b'Unused'), (1, b'Diff'), (2, b'Binary'), (3, b'Sensitive'), (4, b'Size limit exceeded'), (5, b'VCS output'), (6, b'Pruned paths')])), + ('details', models.TextField(default=b'')), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='LinkEntry', + fields=[ + ('pathentry_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='Reporting.PathEntry')), + ('target_path', models.CharField(max_length=1024, blank=True)), + ('current_path', models.CharField(max_length=1024, blank=True)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=('Reporting.pathentry',), + ), + migrations.CreateModel( + name='DeviceEntry', + fields=[ + ('pathentry_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='Reporting.PathEntry')), + ('device_type', models.CharField(max_length=16, choices=[(b'block', b'Block'), (b'char', b'Char'), (b'fifo', b'Fifo')])), + ('target_major', models.IntegerField()), + ('target_minor', models.IntegerField()), + ('current_major', models.IntegerField()), + ('current_minor', models.IntegerField()), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=('Reporting.pathentry',), + ), + migrations.CreateModel( + name='Performance', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('metric', models.CharField(max_length=128)), + ('value', models.DecimalField(max_digits=32, decimal_places=16)), + ('interaction', models.ForeignKey(related_name='performance_items', to='Reporting.Interaction')), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ServiceEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.IntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('target_status', models.CharField(default=b'', max_length=128)), + ('current_status', models.CharField(default=b'', max_length=128)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.AddField( + model_name='pathentry', + name='acls', + field=models.ManyToManyField(to='Reporting.FileAcl'), + preserve_default=True, + ), + migrations.AddField( + model_name='pathentry', + name='current_perms', + field=models.ForeignKey(related_name='+', to='Reporting.FilePerms'), + preserve_default=True, + ), + migrations.AddField( + model_name='pathentry', + name='target_perms', + field=models.ForeignKey(related_name='+', to='Reporting.FilePerms'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='packages', + field=models.ManyToManyField(to='Reporting.PackageEntry'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='paths', + field=models.ManyToManyField(to='Reporting.PathEntry'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='profile', + field=models.ForeignKey(related_name='+', to='Reporting.Group'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='services', + field=models.ManyToManyField(to='Reporting.ServiceEntry'), + preserve_default=True, + ), + migrations.AlterUniqueTogether( + name='interaction', + unique_together=set([('client', 'timestamp')]), + ), + migrations.AlterUniqueTogether( + name='fileperms', + unique_together=set([('owner', 'group', 'perms')]), + ), + migrations.AddField( + model_name='client', + name='current_interaction', + field=models.ForeignKey(related_name='parent_client', blank=True, to='Reporting.Interaction', null=True), + preserve_default=True, + ), + ] diff --git a/src/lib/Bcfg2/Reporting/migrations/0002_convert_perms_to_mode.py b/src/lib/Bcfg2/Reporting/migrations/0002_convert_perms_to_mode.py index 37cdd146c..48bfd6412 100644 --- a/src/lib/Bcfg2/Reporting/migrations/0002_convert_perms_to_mode.py +++ b/src/lib/Bcfg2/Reporting/migrations/0002_convert_perms_to_mode.py @@ -1,170 +1,23 @@ # -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models -from django.conf import settings +from __future__ import unicode_literals -class Migration(SchemaMigration): +from django.db import models, migrations - def forwards(self, orm): - # Removing unique constraint on 'FilePerms', fields ['owner', 'perms', 'group'] - db.delete_unique('Reporting_fileperms', ['owner', 'perms', 'group']) - # Renaming field 'FilePerms.perms' to 'FilePerms.mode' - db.rename_column('Reporting_fileperms', 'perms', 'mode') +class Migration(migrations.Migration): - if not settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite3': - # Adding unique constraint on 'FilePerms', fields ['owner', 'group', 'mode'] - db.create_unique('Reporting_fileperms', ['owner', 'group', 'mode']) + dependencies = [ + ('Reporting', '0001_initial'), + ] - - def backwards(self, orm): - # Removing unique constraint on 'FilePerms', fields ['owner', 'group', 'mode'] - db.delete_unique('Reporting_fileperms', ['owner', 'group', 'mode']) - - # Renaming field 'FilePerms.mode' to 'FilePerms.perms' - db.rename_column('Reporting_fileperms', 'mode', 'perms') - - if not settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite3': - # Adding unique constraint on 'FilePerms', fields ['owner', 'perms', 'group'] - db.create_unique('Reporting_fileperms', ['owner', 'perms', 'group']) - - - models = { - 'Reporting.actionentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) - }, - 'Reporting.bundle': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) - }, - 'Reporting.client': { - 'Meta': {'object_name': 'Client'}, - 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), - 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.deviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_major': ('django.db.models.fields.IntegerField', [], {}), - 'current_minor': ('django.db.models.fields.IntegerField', [], {}), - 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_major': ('django.db.models.fields.IntegerField', [], {}), - 'target_minor': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.failureentry': { - 'Meta': {'object_name': 'FailureEntry'}, - 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'message': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileacl': { - 'Meta': {'object_name': 'FileAcl'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileperms': { - 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, - 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.group': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), - 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) - }, - 'Reporting.interaction': { - 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, - 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), - 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), - 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), - 'good_count': ('django.db.models.fields.IntegerField', [], {}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), - 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), - 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.Group']"}), - 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), - 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), - 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), - 'total_count': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.linkentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) - }, - 'Reporting.packageentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, - 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), - 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) - }, - 'Reporting.pathentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, - 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), - 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), - 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) - }, - 'Reporting.performance': { - 'Meta': {'object_name': 'Performance'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), - 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) - }, - 'Reporting.serviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, - 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) - } - } - - complete_apps = ['Reporting'] + operations = [ + migrations.RenameField( + model_name='fileperms', + old_name='perms', + new_name='mode', + ), + migrations.AlterUniqueTogether( + name='fileperms', + unique_together=set([('owner', 'group', 'mode')]), + ), + ] diff --git a/src/lib/Bcfg2/Reporting/migrations/0003_expand_hash_key.py b/src/lib/Bcfg2/Reporting/migrations/0003_expand_hash_key.py index 2da1fa722..b9ae207dd 100644 --- a/src/lib/Bcfg2/Reporting/migrations/0003_expand_hash_key.py +++ b/src/lib/Bcfg2/Reporting/migrations/0003_expand_hash_key.py @@ -1,180 +1,44 @@ # -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'FailureEntry.hash_key' - db.alter_column('Reporting_failureentry', 'hash_key', self.gf('django.db.models.fields.BigIntegerField')()) - - # Changing field 'PackageEntry.hash_key' - db.alter_column('Reporting_packageentry', 'hash_key', self.gf('django.db.models.fields.BigIntegerField')()) - - # Changing field 'ServiceEntry.hash_key' - db.alter_column('Reporting_serviceentry', 'hash_key', self.gf('django.db.models.fields.BigIntegerField')()) - - # Changing field 'PathEntry.hash_key' - db.alter_column('Reporting_pathentry', 'hash_key', self.gf('django.db.models.fields.BigIntegerField')()) - - # Changing field 'ActionEntry.hash_key' - db.alter_column('Reporting_actionentry', 'hash_key', self.gf('django.db.models.fields.BigIntegerField')()) - - def backwards(self, orm): - - # Changing field 'FailureEntry.hash_key' - db.alter_column('Reporting_failureentry', 'hash_key', self.gf('django.db.models.fields.IntegerField')()) - - # Changing field 'PackageEntry.hash_key' - db.alter_column('Reporting_packageentry', 'hash_key', self.gf('django.db.models.fields.IntegerField')()) - - # Changing field 'ServiceEntry.hash_key' - db.alter_column('Reporting_serviceentry', 'hash_key', self.gf('django.db.models.fields.IntegerField')()) - - # Changing field 'PathEntry.hash_key' - db.alter_column('Reporting_pathentry', 'hash_key', self.gf('django.db.models.fields.IntegerField')()) - - # Changing field 'ActionEntry.hash_key' - db.alter_column('Reporting_actionentry', 'hash_key', self.gf('django.db.models.fields.IntegerField')()) - - models = { - 'Reporting.actionentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) - }, - 'Reporting.bundle': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) - }, - 'Reporting.client': { - 'Meta': {'object_name': 'Client'}, - 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), - 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.deviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_major': ('django.db.models.fields.IntegerField', [], {}), - 'current_minor': ('django.db.models.fields.IntegerField', [], {}), - 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_major': ('django.db.models.fields.IntegerField', [], {}), - 'target_minor': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.failureentry': { - 'Meta': {'object_name': 'FailureEntry'}, - 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'message': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileacl': { - 'Meta': {'object_name': 'FileAcl'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileperms': { - 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, - 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.group': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), - 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) - }, - 'Reporting.interaction': { - 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, - 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), - 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), - 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), - 'good_count': ('django.db.models.fields.IntegerField', [], {}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), - 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), - 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.Group']"}), - 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), - 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), - 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), - 'total_count': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.linkentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) - }, - 'Reporting.packageentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, - 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), - 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) - }, - 'Reporting.pathentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, - 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), - 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), - 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) - }, - 'Reporting.performance': { - 'Meta': {'object_name': 'Performance'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), - 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) - }, - 'Reporting.serviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, - 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) - } - } - - complete_apps = ['Reporting']
\ No newline at end of file +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('Reporting', '0002_convert_perms_to_mode'), + ] + + operations = [ + migrations.AlterField( + model_name='actionentry', + name='hash_key', + field=models.BigIntegerField(editable=False, db_index=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='failureentry', + name='hash_key', + field=models.BigIntegerField(editable=False, db_index=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='packageentry', + name='hash_key', + field=models.BigIntegerField(editable=False, db_index=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='pathentry', + name='hash_key', + field=models.BigIntegerField(editable=False, db_index=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='serviceentry', + name='hash_key', + field=models.BigIntegerField(editable=False, db_index=True), + preserve_default=True, + ), + ] diff --git a/src/lib/Bcfg2/Reporting/migrations/0004_profile_can_be_null.py b/src/lib/Bcfg2/Reporting/migrations/0004_profile_can_be_null.py index 26a053b67..d0b2de417 100644 --- a/src/lib/Bcfg2/Reporting/migrations/0004_profile_can_be_null.py +++ b/src/lib/Bcfg2/Reporting/migrations/0004_profile_can_be_null.py @@ -1,156 +1,20 @@ # -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models +from __future__ import unicode_literals +from django.db import models, migrations -class Migration(SchemaMigration): - def forwards(self, orm): +class Migration(migrations.Migration): - # Changing field 'Interaction.profile' - db.alter_column('Reporting_interaction', 'profile_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['Reporting.Group'])) + dependencies = [ + ('Reporting', '0003_expand_hash_key'), + ] - def backwards(self, orm): - - # User chose to not deal with backwards NULL issues for 'Interaction.profile' - raise RuntimeError("Cannot reverse this migration. 'Interaction.profile' and its values cannot be restored.") - - models = { - 'Reporting.actionentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) - }, - 'Reporting.bundle': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) - }, - 'Reporting.client': { - 'Meta': {'object_name': 'Client'}, - 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), - 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.deviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_major': ('django.db.models.fields.IntegerField', [], {}), - 'current_minor': ('django.db.models.fields.IntegerField', [], {}), - 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_major': ('django.db.models.fields.IntegerField', [], {}), - 'target_minor': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.failureentry': { - 'Meta': {'object_name': 'FailureEntry'}, - 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'message': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileacl': { - 'Meta': {'object_name': 'FileAcl'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileperms': { - 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, - 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.group': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), - 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) - }, - 'Reporting.interaction': { - 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, - 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), - 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), - 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), - 'good_count': ('django.db.models.fields.IntegerField', [], {}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), - 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), - 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'null': 'True', 'to': "orm['Reporting.Group']"}), - 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), - 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), - 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), - 'total_count': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.linkentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) - }, - 'Reporting.packageentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, - 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), - 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) - }, - 'Reporting.pathentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, - 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), - 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), - 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) - }, - 'Reporting.performance': { - 'Meta': {'object_name': 'Performance'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), - 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) - }, - 'Reporting.serviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, - 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) - } - } - - complete_apps = ['Reporting']
\ No newline at end of file + operations = [ + migrations.AlterField( + model_name='interaction', + name='profile', + field=models.ForeignKey(related_name='+', to='Reporting.Group', null=True), + preserve_default=True, + ), + ] diff --git a/src/lib/Bcfg2/Reporting/migrations/0005_add_selinux_entry_support.py b/src/lib/Bcfg2/Reporting/migrations/0005_add_selinux_entry_support.py index d5f5d801a..0c6934b10 100644 --- a/src/lib/Bcfg2/Reporting/migrations/0005_add_selinux_entry_support.py +++ b/src/lib/Bcfg2/Reporting/migrations/0005_add_selinux_entry_support.py @@ -1,485 +1,222 @@ # -*- coding: utf-8 -*- -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 'SELoginEntry' - db.create_table('Reporting_seloginentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('selinuxuser', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('current_selinuxuser', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), - )) - db.send_create_signal('Reporting', ['SELoginEntry']) - - # Adding model 'SEUserEntry' - db.create_table('Reporting_seuserentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('roles', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('current_roles', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), - ('prefix', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('current_prefix', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), - )) - db.send_create_signal('Reporting', ['SEUserEntry']) - - # Adding model 'SEBooleanEntry' - db.create_table('Reporting_sebooleanentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('value', self.gf('django.db.models.fields.BooleanField')(default=True)), - )) - db.send_create_signal('Reporting', ['SEBooleanEntry']) - - # Adding model 'SENodeEntry' - db.create_table('Reporting_senodeentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('current_selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), - ('proto', self.gf('django.db.models.fields.CharField')(max_length=4)), - )) - db.send_create_signal('Reporting', ['SENodeEntry']) - - # Adding model 'SEFcontextEntry' - db.create_table('Reporting_sefcontextentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('current_selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), - ('filetype', self.gf('django.db.models.fields.CharField')(max_length=16)), - )) - db.send_create_signal('Reporting', ['SEFcontextEntry']) - - # Adding model 'SEInterfaceEntry' - db.create_table('Reporting_seinterfaceentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('current_selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), - )) - db.send_create_signal('Reporting', ['SEInterfaceEntry']) - - # Adding model 'SEPermissiveEntry' - db.create_table('Reporting_sepermissiveentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - )) - db.send_create_signal('Reporting', ['SEPermissiveEntry']) - - # Adding model 'SEModuleEntry' - db.create_table('Reporting_semoduleentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('disabled', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('current_disabled', self.gf('django.db.models.fields.BooleanField')(default=False)), - )) - db.send_create_signal('Reporting', ['SEModuleEntry']) - - # Adding model 'SEPortEntry' - db.create_table('Reporting_seportentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('current_selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), - )) - db.send_create_signal('Reporting', ['SEPortEntry']) - - # Adding M2M table for field sebooleans on 'Interaction' - db.create_table('Reporting_interaction_sebooleans', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('sebooleanentry', models.ForeignKey(orm['Reporting.sebooleanentry'], null=False)) - )) - db.create_unique('Reporting_interaction_sebooleans', ['interaction_id', 'sebooleanentry_id']) - - # Adding M2M table for field seports on 'Interaction' - db.create_table('Reporting_interaction_seports', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('seportentry', models.ForeignKey(orm['Reporting.seportentry'], null=False)) - )) - db.create_unique('Reporting_interaction_seports', ['interaction_id', 'seportentry_id']) - - # Adding M2M table for field sefcontexts on 'Interaction' - db.create_table('Reporting_interaction_sefcontexts', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('sefcontextentry', models.ForeignKey(orm['Reporting.sefcontextentry'], null=False)) - )) - db.create_unique('Reporting_interaction_sefcontexts', ['interaction_id', 'sefcontextentry_id']) - - # Adding M2M table for field senodes on 'Interaction' - db.create_table('Reporting_interaction_senodes', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('senodeentry', models.ForeignKey(orm['Reporting.senodeentry'], null=False)) - )) - db.create_unique('Reporting_interaction_senodes', ['interaction_id', 'senodeentry_id']) - - # Adding M2M table for field selogins on 'Interaction' - db.create_table('Reporting_interaction_selogins', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('seloginentry', models.ForeignKey(orm['Reporting.seloginentry'], null=False)) - )) - db.create_unique('Reporting_interaction_selogins', ['interaction_id', 'seloginentry_id']) - - # Adding M2M table for field seusers on 'Interaction' - db.create_table('Reporting_interaction_seusers', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('seuserentry', models.ForeignKey(orm['Reporting.seuserentry'], null=False)) - )) - db.create_unique('Reporting_interaction_seusers', ['interaction_id', 'seuserentry_id']) - - # Adding M2M table for field seinterfaces on 'Interaction' - db.create_table('Reporting_interaction_seinterfaces', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('seinterfaceentry', models.ForeignKey(orm['Reporting.seinterfaceentry'], null=False)) - )) - db.create_unique('Reporting_interaction_seinterfaces', ['interaction_id', 'seinterfaceentry_id']) - - # Adding M2M table for field sepermissives on 'Interaction' - db.create_table('Reporting_interaction_sepermissives', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('sepermissiveentry', models.ForeignKey(orm['Reporting.sepermissiveentry'], null=False)) - )) - db.create_unique('Reporting_interaction_sepermissives', ['interaction_id', 'sepermissiveentry_id']) - - # Adding M2M table for field semodules on 'Interaction' - db.create_table('Reporting_interaction_semodules', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('semoduleentry', models.ForeignKey(orm['Reporting.semoduleentry'], null=False)) - )) - db.create_unique('Reporting_interaction_semodules', ['interaction_id', 'semoduleentry_id']) - - - def backwards(self, orm): - # Deleting model 'SELoginEntry' - db.delete_table('Reporting_seloginentry') - - # Deleting model 'SEUserEntry' - db.delete_table('Reporting_seuserentry') - - # Deleting model 'SEBooleanEntry' - db.delete_table('Reporting_sebooleanentry') - - # Deleting model 'SENodeEntry' - db.delete_table('Reporting_senodeentry') - - # Deleting model 'SEFcontextEntry' - db.delete_table('Reporting_sefcontextentry') - - # Deleting model 'SEInterfaceEntry' - db.delete_table('Reporting_seinterfaceentry') - - # Deleting model 'SEPermissiveEntry' - db.delete_table('Reporting_sepermissiveentry') - - # Deleting model 'SEModuleEntry' - db.delete_table('Reporting_semoduleentry') - - # Deleting model 'SEPortEntry' - db.delete_table('Reporting_seportentry') - - # Removing M2M table for field sebooleans on 'Interaction' - db.delete_table('Reporting_interaction_sebooleans') - - # Removing M2M table for field seports on 'Interaction' - db.delete_table('Reporting_interaction_seports') - - # Removing M2M table for field sefcontexts on 'Interaction' - db.delete_table('Reporting_interaction_sefcontexts') - - # Removing M2M table for field senodes on 'Interaction' - db.delete_table('Reporting_interaction_senodes') - - # Removing M2M table for field selogins on 'Interaction' - db.delete_table('Reporting_interaction_selogins') - - # Removing M2M table for field seusers on 'Interaction' - db.delete_table('Reporting_interaction_seusers') - - # Removing M2M table for field seinterfaces on 'Interaction' - db.delete_table('Reporting_interaction_seinterfaces') - - # Removing M2M table for field sepermissives on 'Interaction' - db.delete_table('Reporting_interaction_sepermissives') - - # Removing M2M table for field semodules on 'Interaction' - db.delete_table('Reporting_interaction_semodules') - - - models = { - 'Reporting.actionentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) - }, - 'Reporting.bundle': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) - }, - 'Reporting.client': { - 'Meta': {'object_name': 'Client'}, - 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), - 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.deviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_major': ('django.db.models.fields.IntegerField', [], {}), - 'current_minor': ('django.db.models.fields.IntegerField', [], {}), - 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_major': ('django.db.models.fields.IntegerField', [], {}), - 'target_minor': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.failureentry': { - 'Meta': {'object_name': 'FailureEntry'}, - 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'message': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileacl': { - 'Meta': {'object_name': 'FileAcl'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileperms': { - 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, - 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.group': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), - 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) - }, - 'Reporting.interaction': { - 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, - 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), - 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), - 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), - 'good_count': ('django.db.models.fields.IntegerField', [], {}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), - 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), - 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'null': 'True', 'to': "orm['Reporting.Group']"}), - 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'sebooleans': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEBooleanEntry']", 'symmetrical': 'False'}), - 'sefcontexts': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEFcontextEntry']", 'symmetrical': 'False'}), - 'seinterfaces': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEInterfaceEntry']", 'symmetrical': 'False'}), - 'selogins': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SELoginEntry']", 'symmetrical': 'False'}), - 'semodules': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEModuleEntry']", 'symmetrical': 'False'}), - 'senodes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SENodeEntry']", 'symmetrical': 'False'}), - 'sepermissives': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPermissiveEntry']", 'symmetrical': 'False'}), - 'seports': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPortEntry']", 'symmetrical': 'False'}), - 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), - 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), - 'seusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEUserEntry']", 'symmetrical': 'False'}), - 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), - 'total_count': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.linkentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) - }, - 'Reporting.packageentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, - 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), - 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) - }, - 'Reporting.pathentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, - 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), - 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), - 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) - }, - 'Reporting.performance': { - 'Meta': {'object_name': 'Performance'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), - 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) - }, - 'Reporting.sebooleanentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEBooleanEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'value': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) - }, - 'Reporting.sefcontextentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEFcontextEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'filetype': ('django.db.models.fields.CharField', [], {'max_length': '16'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.seinterfaceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEInterfaceEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.seloginentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SELoginEntry'}, - 'current_selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.semoduleentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEModuleEntry'}, - 'current_disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.senodeentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SENodeEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'proto': ('django.db.models.fields.CharField', [], {'max_length': '4'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.sepermissiveentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPermissiveEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.seportentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPortEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.serviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, - 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) - }, - 'Reporting.seuserentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEUserEntry'}, - 'current_prefix': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'current_roles': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'prefix': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'roles': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - } - } - - complete_apps = ['Reporting']
\ No newline at end of file +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('Reporting', '0004_profile_can_be_null'), + ] + + operations = [ + migrations.CreateModel( + name='SEBooleanEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.BigIntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('value', models.BooleanField(default=True)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='SEFcontextEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.BigIntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('selinuxtype', models.CharField(max_length=128)), + ('current_selinuxtype', models.CharField(max_length=128, null=True)), + ('filetype', models.CharField(max_length=16)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='SEInterfaceEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.BigIntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('selinuxtype', models.CharField(max_length=128)), + ('current_selinuxtype', models.CharField(max_length=128, null=True)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='SELoginEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.BigIntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('selinuxuser', models.CharField(max_length=128)), + ('current_selinuxuser', models.CharField(max_length=128, null=True)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='SEModuleEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.BigIntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('disabled', models.BooleanField(default=False)), + ('current_disabled', models.BooleanField(default=False)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='SENodeEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.BigIntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('selinuxtype', models.CharField(max_length=128)), + ('current_selinuxtype', models.CharField(max_length=128, null=True)), + ('proto', models.CharField(max_length=4)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='SEPermissiveEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.BigIntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='SEPortEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.BigIntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('selinuxtype', models.CharField(max_length=128)), + ('current_selinuxtype', models.CharField(max_length=128, null=True)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='SEUserEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.BigIntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('roles', models.CharField(max_length=128)), + ('current_roles', models.CharField(max_length=128, null=True)), + ('prefix', models.CharField(max_length=128)), + ('current_prefix', models.CharField(max_length=128, null=True)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.AddField( + model_name='interaction', + name='sebooleans', + field=models.ManyToManyField(to='Reporting.SEBooleanEntry'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='sefcontexts', + field=models.ManyToManyField(to='Reporting.SEFcontextEntry'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='seinterfaces', + field=models.ManyToManyField(to='Reporting.SEInterfaceEntry'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='selogins', + field=models.ManyToManyField(to='Reporting.SELoginEntry'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='semodules', + field=models.ManyToManyField(to='Reporting.SEModuleEntry'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='senodes', + field=models.ManyToManyField(to='Reporting.SENodeEntry'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='sepermissives', + field=models.ManyToManyField(to='Reporting.SEPermissiveEntry'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='seports', + field=models.ManyToManyField(to='Reporting.SEPortEntry'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='seusers', + field=models.ManyToManyField(to='Reporting.SEUserEntry'), + preserve_default=True, + ), + ] diff --git a/src/lib/Bcfg2/Reporting/migrations/0006_add_user_group_entry_support.py b/src/lib/Bcfg2/Reporting/migrations/0006_add_user_group_entry_support.py index d86e663d5..4853faaf3 100644 --- a/src/lib/Bcfg2/Reporting/migrations/0006_add_user_group_entry_support.py +++ b/src/lib/Bcfg2/Reporting/migrations/0006_add_user_group_entry_support.py @@ -1,340 +1,68 @@ # -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models +from __future__ import unicode_literals +from django.db import models, migrations -class Migration(SchemaMigration): - def forwards(self, orm): - # Adding model 'POSIXGroupEntry' - db.create_table('Reporting_posixgroupentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('gid', self.gf('django.db.models.fields.IntegerField')(null=True)), - ('current_gid', self.gf('django.db.models.fields.IntegerField')(null=True)), - )) - db.send_create_signal('Reporting', ['POSIXGroupEntry']) +class Migration(migrations.Migration): - # Adding model 'POSIXUserEntry' - db.create_table('Reporting_posixuserentry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), - ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), - ('state', self.gf('django.db.models.fields.IntegerField')()), - ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('uid', self.gf('django.db.models.fields.IntegerField')(null=True)), - ('current_uid', self.gf('django.db.models.fields.IntegerField')(null=True)), - ('group', self.gf('django.db.models.fields.CharField')(max_length=64)), - ('current_group', self.gf('django.db.models.fields.CharField')(max_length=64, null=True)), - ('gecos', self.gf('django.db.models.fields.CharField')(max_length=1024)), - ('current_gecos', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)), - ('home', self.gf('django.db.models.fields.CharField')(max_length=1024)), - ('current_home', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)), - ('shell', self.gf('django.db.models.fields.CharField')(default='/bin/bash', max_length=1024)), - ('current_shell', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)), - )) - db.send_create_signal('Reporting', ['POSIXUserEntry']) + dependencies = [ + ('Reporting', '0005_add_selinux_entry_support'), + ] - # Adding M2M table for field posixusers on 'Interaction' - db.create_table('Reporting_interaction_posixusers', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('posixuserentry', models.ForeignKey(orm['Reporting.posixuserentry'], null=False)) - )) - db.create_unique('Reporting_interaction_posixusers', ['interaction_id', 'posixuserentry_id']) - - # Adding M2M table for field posixgroups on 'Interaction' - db.create_table('Reporting_interaction_posixgroups', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), - ('posixgroupentry', models.ForeignKey(orm['Reporting.posixgroupentry'], null=False)) - )) - db.create_unique('Reporting_interaction_posixgroups', ['interaction_id', 'posixgroupentry_id']) - - - def backwards(self, orm): - # Deleting model 'POSIXGroupEntry' - db.delete_table('Reporting_posixgroupentry') - - # Deleting model 'POSIXUserEntry' - db.delete_table('Reporting_posixuserentry') - - # Removing M2M table for field posixusers on 'Interaction' - db.delete_table('Reporting_interaction_posixusers') - - # Removing M2M table for field posixgroups on 'Interaction' - db.delete_table('Reporting_interaction_posixgroups') - - - models = { - 'Reporting.actionentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) - }, - 'Reporting.bundle': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) - }, - 'Reporting.client': { - 'Meta': {'object_name': 'Client'}, - 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), - 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.deviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_major': ('django.db.models.fields.IntegerField', [], {}), - 'current_minor': ('django.db.models.fields.IntegerField', [], {}), - 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_major': ('django.db.models.fields.IntegerField', [], {}), - 'target_minor': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.failureentry': { - 'Meta': {'object_name': 'FailureEntry'}, - 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'message': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileacl': { - 'Meta': {'object_name': 'FileAcl'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileperms': { - 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, - 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.group': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), - 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) - }, - 'Reporting.interaction': { - 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, - 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), - 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), - 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), - 'good_count': ('django.db.models.fields.IntegerField', [], {}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), - 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), - 'posixgroups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.POSIXGroupEntry']", 'symmetrical': 'False'}), - 'posixusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.POSIXUserEntry']", 'symmetrical': 'False'}), - 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'null': 'True', 'to': "orm['Reporting.Group']"}), - 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'sebooleans': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEBooleanEntry']", 'symmetrical': 'False'}), - 'sefcontexts': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEFcontextEntry']", 'symmetrical': 'False'}), - 'seinterfaces': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEInterfaceEntry']", 'symmetrical': 'False'}), - 'selogins': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SELoginEntry']", 'symmetrical': 'False'}), - 'semodules': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEModuleEntry']", 'symmetrical': 'False'}), - 'senodes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SENodeEntry']", 'symmetrical': 'False'}), - 'sepermissives': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPermissiveEntry']", 'symmetrical': 'False'}), - 'seports': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPortEntry']", 'symmetrical': 'False'}), - 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), - 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), - 'seusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEUserEntry']", 'symmetrical': 'False'}), - 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), - 'total_count': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.linkentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) - }, - 'Reporting.packageentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, - 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), - 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) - }, - 'Reporting.pathentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, - 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), - 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), - 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) - }, - 'Reporting.performance': { - 'Meta': {'object_name': 'Performance'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), - 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) - }, - 'Reporting.posixgroupentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'POSIXGroupEntry'}, - 'current_gid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'gid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.posixuserentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'POSIXUserEntry'}, - 'current_gecos': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), - 'current_group': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}), - 'current_home': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), - 'current_shell': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), - 'current_uid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'gecos': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), - 'group': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'home': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'shell': ('django.db.models.fields.CharField', [], {'default': "'/bin/bash'", 'max_length': '1024'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'uid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}) - }, - 'Reporting.sebooleanentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEBooleanEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'value': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) - }, - 'Reporting.sefcontextentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEFcontextEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'filetype': ('django.db.models.fields.CharField', [], {'max_length': '16'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.seinterfaceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEInterfaceEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.seloginentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SELoginEntry'}, - 'current_selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.semoduleentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEModuleEntry'}, - 'current_disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.senodeentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SENodeEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'proto': ('django.db.models.fields.CharField', [], {'max_length': '4'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.sepermissiveentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPermissiveEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.seportentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPortEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.serviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, - 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) - }, - 'Reporting.seuserentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEUserEntry'}, - 'current_prefix': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'current_roles': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'prefix': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'roles': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - } - } - - complete_apps = ['Reporting']
\ No newline at end of file + operations = [ + migrations.CreateModel( + name='POSIXGroupEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.BigIntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('gid', models.IntegerField(null=True)), + ('current_gid', models.IntegerField(null=True)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='POSIXUserEntry', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=128, db_index=True)), + ('hash_key', models.BigIntegerField(editable=False, db_index=True)), + ('state', models.IntegerField(choices=[(0, b'Good'), (1, b'Bad'), (2, b'Modified'), (3, b'Extra')])), + ('exists', models.BooleanField(default=True)), + ('uid', models.IntegerField(null=True)), + ('current_uid', models.IntegerField(null=True)), + ('group', models.CharField(max_length=64)), + ('current_group', models.CharField(max_length=64, null=True)), + ('gecos', models.CharField(max_length=1024)), + ('current_gecos', models.CharField(max_length=1024, null=True)), + ('home', models.CharField(max_length=1024)), + ('current_home', models.CharField(max_length=1024, null=True)), + ('shell', models.CharField(default=b'/bin/bash', max_length=1024)), + ('current_shell', models.CharField(max_length=1024, null=True)), + ], + options={ + 'ordering': ('state', 'name'), + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.AddField( + model_name='interaction', + name='posixgroups', + field=models.ManyToManyField(to='Reporting.POSIXGroupEntry'), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='posixusers', + field=models.ManyToManyField(to='Reporting.POSIXUserEntry'), + preserve_default=True, + ), + ] diff --git a/src/lib/Bcfg2/Reporting/migrations/0007_add_flag_fields_interaction.py b/src/lib/Bcfg2/Reporting/migrations/0007_add_flag_fields_interaction.py index 491ecb845..1d1274288 100644 --- a/src/lib/Bcfg2/Reporting/migrations/0007_add_flag_fields_interaction.py +++ b/src/lib/Bcfg2/Reporting/migrations/0007_add_flag_fields_interaction.py @@ -1,298 +1,26 @@ # -*- coding: utf-8 -*- -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 field 'Interaction.dry_run' - db.add_column('Reporting_interaction', 'dry_run', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - # Adding field 'Interaction.only_important' - db.add_column('Reporting_interaction', 'only_important', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Interaction.dry_run' - db.delete_column('Reporting_interaction', 'dry_run') - - # Deleting field 'Interaction.only_important' - db.delete_column('Reporting_interaction', 'only_important') - - - models = { - 'Reporting.actionentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) - }, - 'Reporting.bundle': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) - }, - 'Reporting.client': { - 'Meta': {'object_name': 'Client'}, - 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), - 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.deviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_major': ('django.db.models.fields.IntegerField', [], {}), - 'current_minor': ('django.db.models.fields.IntegerField', [], {}), - 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_major': ('django.db.models.fields.IntegerField', [], {}), - 'target_minor': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.failureentry': { - 'Meta': {'object_name': 'FailureEntry'}, - 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'message': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileacl': { - 'Meta': {'object_name': 'FileAcl'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) - }, - 'Reporting.fileperms': { - 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, - 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) - }, - 'Reporting.group': { - 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), - 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) - }, - 'Reporting.interaction': { - 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, - 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), - 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), - 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), - 'dry_run': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), - 'good_count': ('django.db.models.fields.IntegerField', [], {}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'only_important': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), - 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), - 'posixgroups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.POSIXGroupEntry']", 'symmetrical': 'False'}), - 'posixusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.POSIXUserEntry']", 'symmetrical': 'False'}), - 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'null': 'True', 'to': "orm['Reporting.Group']"}), - 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'sebooleans': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEBooleanEntry']", 'symmetrical': 'False'}), - 'sefcontexts': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEFcontextEntry']", 'symmetrical': 'False'}), - 'seinterfaces': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEInterfaceEntry']", 'symmetrical': 'False'}), - 'selogins': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SELoginEntry']", 'symmetrical': 'False'}), - 'semodules': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEModuleEntry']", 'symmetrical': 'False'}), - 'senodes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SENodeEntry']", 'symmetrical': 'False'}), - 'sepermissives': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPermissiveEntry']", 'symmetrical': 'False'}), - 'seports': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPortEntry']", 'symmetrical': 'False'}), - 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), - 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), - 'seusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEUserEntry']", 'symmetrical': 'False'}), - 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), - 'total_count': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.linkentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, - 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), - 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), - 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) - }, - 'Reporting.packageentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, - 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), - 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) - }, - 'Reporting.pathentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, - 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), - 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), - 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) - }, - 'Reporting.performance': { - 'Meta': {'object_name': 'Performance'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), - 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) - }, - 'Reporting.posixgroupentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'POSIXGroupEntry'}, - 'current_gid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'gid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.posixuserentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'POSIXUserEntry'}, - 'current_gecos': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), - 'current_group': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}), - 'current_home': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), - 'current_shell': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), - 'current_uid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'gecos': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), - 'group': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'home': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'shell': ('django.db.models.fields.CharField', [], {'default': "'/bin/bash'", 'max_length': '1024'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'uid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}) - }, - 'Reporting.sebooleanentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEBooleanEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'value': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) - }, - 'Reporting.sefcontextentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEFcontextEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'filetype': ('django.db.models.fields.CharField', [], {'max_length': '16'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.seinterfaceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEInterfaceEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.seloginentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SELoginEntry'}, - 'current_selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.semoduleentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEModuleEntry'}, - 'current_disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.senodeentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SENodeEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'proto': ('django.db.models.fields.CharField', [], {'max_length': '4'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.sepermissiveentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPermissiveEntry'}, - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.seportentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPortEntry'}, - 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - }, - 'Reporting.serviceentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, - 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'state': ('django.db.models.fields.IntegerField', [], {}), - 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) - }, - 'Reporting.seuserentry': { - 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEUserEntry'}, - 'current_prefix': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'current_roles': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), - 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), - 'prefix': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'roles': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'state': ('django.db.models.fields.IntegerField', [], {}) - } - } - - complete_apps = ['Reporting']
\ No newline at end of file +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('Reporting', '0006_add_user_group_entry_support'), + ] + + operations = [ + migrations.AddField( + model_name='interaction', + name='dry_run', + field=models.BooleanField(default=False), + preserve_default=True, + ), + migrations.AddField( + model_name='interaction', + name='only_important', + field=models.BooleanField(default=False), + preserve_default=True, + ), + ] diff --git a/src/lib/Bcfg2/Reporting/models.py b/src/lib/Bcfg2/Reporting/models.py index 8e2c644fb..6ba7d3765 100644 --- a/src/lib/Bcfg2/Reporting/models.py +++ b/src/lib/Bcfg2/Reporting/models.py @@ -1,9 +1,10 @@ """Django models for Bcfg2 reports.""" import sys +import django from django.core.exceptions import ImproperlyConfigured try: - from django.db import models, backend, connections + from django.db import models, connections except ImproperlyConfigured: e = sys.exc_info()[1] print("Reports: unable to import django models: %s" % e) @@ -61,11 +62,15 @@ def _quote(value): """ global _our_backend if not _our_backend: - try: - _our_backend = backend.DatabaseOperations( - connections[get_db_label('Reporting')]) - except TypeError: - _our_backend = backend.DatabaseOperations() + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + _our_backend = connections[get_db_label('Reporting')].ops + else: + from django.db import backend + try: + _our_backend = backend.DatabaseOperations( + connections[get_db_label('Reporting')]) + except TypeError: + _our_backend = backend.DatabaseOperations() return _our_backend.quote_name(value) diff --git a/src/lib/Bcfg2/Reporting/south_migrations/0001_initial.py b/src/lib/Bcfg2/Reporting/south_migrations/0001_initial.py new file mode 100644 index 000000000..609290edb --- /dev/null +++ b/src/lib/Bcfg2/Reporting/south_migrations/0001_initial.py @@ -0,0 +1,465 @@ +# -*- coding: utf-8 -*- +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 'Client' + db.create_table('Reporting_client', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('creation', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('current_interaction', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='parent_client', null=True, to=orm['Reporting.Interaction'])), + ('expiration', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + )) + db.send_create_signal('Reporting', ['Client']) + + # Adding model 'Interaction' + db.create_table('Reporting_interaction', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('client', self.gf('django.db.models.fields.related.ForeignKey')(related_name='interactions', to=orm['Reporting.Client'])), + ('timestamp', self.gf('django.db.models.fields.DateTimeField')(db_index=True)), + ('state', self.gf('django.db.models.fields.CharField')(max_length=32)), + ('repo_rev_code', self.gf('django.db.models.fields.CharField')(max_length=64)), + ('server', self.gf('django.db.models.fields.CharField')(max_length=256)), + ('good_count', self.gf('django.db.models.fields.IntegerField')()), + ('total_count', self.gf('django.db.models.fields.IntegerField')()), + ('bad_count', self.gf('django.db.models.fields.IntegerField')(default=0)), + ('modified_count', self.gf('django.db.models.fields.IntegerField')(default=0)), + ('extra_count', self.gf('django.db.models.fields.IntegerField')(default=0)), + ('profile', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['Reporting.Group'])), + )) + db.send_create_signal('Reporting', ['Interaction']) + + # Adding unique constraint on 'Interaction', fields ['client', 'timestamp'] + db.create_unique('Reporting_interaction', ['client_id', 'timestamp']) + + # Adding M2M table for field actions on 'Interaction' + db.create_table('Reporting_interaction_actions', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('actionentry', models.ForeignKey(orm['Reporting.actionentry'], null=False)) + )) + db.create_unique('Reporting_interaction_actions', ['interaction_id', 'actionentry_id']) + + # Adding M2M table for field packages on 'Interaction' + db.create_table('Reporting_interaction_packages', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('packageentry', models.ForeignKey(orm['Reporting.packageentry'], null=False)) + )) + db.create_unique('Reporting_interaction_packages', ['interaction_id', 'packageentry_id']) + + # Adding M2M table for field paths on 'Interaction' + db.create_table('Reporting_interaction_paths', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('pathentry', models.ForeignKey(orm['Reporting.pathentry'], null=False)) + )) + db.create_unique('Reporting_interaction_paths', ['interaction_id', 'pathentry_id']) + + # Adding M2M table for field services on 'Interaction' + db.create_table('Reporting_interaction_services', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('serviceentry', models.ForeignKey(orm['Reporting.serviceentry'], null=False)) + )) + db.create_unique('Reporting_interaction_services', ['interaction_id', 'serviceentry_id']) + + # Adding M2M table for field failures on 'Interaction' + db.create_table('Reporting_interaction_failures', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('failureentry', models.ForeignKey(orm['Reporting.failureentry'], null=False)) + )) + db.create_unique('Reporting_interaction_failures', ['interaction_id', 'failureentry_id']) + + # Adding M2M table for field groups on 'Interaction' + db.create_table('Reporting_interaction_groups', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('group', models.ForeignKey(orm['Reporting.group'], null=False)) + )) + db.create_unique('Reporting_interaction_groups', ['interaction_id', 'group_id']) + + # Adding M2M table for field bundles on 'Interaction' + db.create_table('Reporting_interaction_bundles', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('bundle', models.ForeignKey(orm['Reporting.bundle'], null=False)) + )) + db.create_unique('Reporting_interaction_bundles', ['interaction_id', 'bundle_id']) + + # Adding model 'Performance' + db.create_table('Reporting_performance', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('interaction', self.gf('django.db.models.fields.related.ForeignKey')(related_name='performance_items', to=orm['Reporting.Interaction'])), + ('metric', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('value', self.gf('django.db.models.fields.DecimalField')(max_digits=32, decimal_places=16)), + )) + db.send_create_signal('Reporting', ['Performance']) + + # Adding model 'Group' + db.create_table('Reporting_group', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), + ('profile', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('public', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('category', self.gf('django.db.models.fields.CharField')(max_length=1024, blank=True)), + ('comment', self.gf('django.db.models.fields.TextField')(blank=True)), + )) + db.send_create_signal('Reporting', ['Group']) + + # Adding M2M table for field groups on 'Group' + db.create_table('Reporting_group_groups', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('from_group', models.ForeignKey(orm['Reporting.group'], null=False)), + ('to_group', models.ForeignKey(orm['Reporting.group'], null=False)) + )) + db.create_unique('Reporting_group_groups', ['from_group_id', 'to_group_id']) + + # Adding M2M table for field bundles on 'Group' + db.create_table('Reporting_group_bundles', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('group', models.ForeignKey(orm['Reporting.group'], null=False)), + ('bundle', models.ForeignKey(orm['Reporting.bundle'], null=False)) + )) + db.create_unique('Reporting_group_bundles', ['group_id', 'bundle_id']) + + # Adding model 'Bundle' + db.create_table('Reporting_bundle', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), + )) + db.send_create_signal('Reporting', ['Bundle']) + + # Adding model 'FilePerms' + db.create_table('Reporting_fileperms', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('owner', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('group', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('perms', self.gf('django.db.models.fields.CharField')(max_length=128)), + )) + db.send_create_signal('Reporting', ['FilePerms']) + + # Adding unique constraint on 'FilePerms', fields ['owner', 'group', 'perms'] + db.create_unique('Reporting_fileperms', ['owner', 'group', 'perms']) + + # Adding model 'FileAcl' + db.create_table('Reporting_fileacl', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + )) + db.send_create_signal('Reporting', ['FileAcl']) + + # Adding model 'FailureEntry' + db.create_table('Reporting_failureentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.IntegerField')(db_index=True)), + ('entry_type', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('message', self.gf('django.db.models.fields.TextField')()), + )) + db.send_create_signal('Reporting', ['FailureEntry']) + + # Adding model 'ActionEntry' + db.create_table('Reporting_actionentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.IntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('status', self.gf('django.db.models.fields.CharField')(default='check', max_length=128)), + ('output', self.gf('django.db.models.fields.IntegerField')(default=0)), + )) + db.send_create_signal('Reporting', ['ActionEntry']) + + # Adding model 'PackageEntry' + db.create_table('Reporting_packageentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.IntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('target_version', self.gf('django.db.models.fields.CharField')(default='', max_length=1024)), + ('current_version', self.gf('django.db.models.fields.CharField')(max_length=1024)), + ('verification_details', self.gf('django.db.models.fields.TextField')(default='')), + )) + db.send_create_signal('Reporting', ['PackageEntry']) + + # Adding model 'PathEntry' + db.create_table('Reporting_pathentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.IntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('path_type', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('target_perms', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['Reporting.FilePerms'])), + ('current_perms', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['Reporting.FilePerms'])), + ('detail_type', self.gf('django.db.models.fields.IntegerField')(default=0)), + ('details', self.gf('django.db.models.fields.TextField')(default='')), + )) + db.send_create_signal('Reporting', ['PathEntry']) + + # Adding M2M table for field acls on 'PathEntry' + db.create_table('Reporting_pathentry_acls', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('pathentry', models.ForeignKey(orm['Reporting.pathentry'], null=False)), + ('fileacl', models.ForeignKey(orm['Reporting.fileacl'], null=False)) + )) + db.create_unique('Reporting_pathentry_acls', ['pathentry_id', 'fileacl_id']) + + # Adding model 'LinkEntry' + db.create_table('Reporting_linkentry', ( + ('pathentry_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['Reporting.PathEntry'], unique=True, primary_key=True)), + ('target_path', self.gf('django.db.models.fields.CharField')(max_length=1024, blank=True)), + ('current_path', self.gf('django.db.models.fields.CharField')(max_length=1024, blank=True)), + )) + db.send_create_signal('Reporting', ['LinkEntry']) + + # Adding model 'DeviceEntry' + db.create_table('Reporting_deviceentry', ( + ('pathentry_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['Reporting.PathEntry'], unique=True, primary_key=True)), + ('device_type', self.gf('django.db.models.fields.CharField')(max_length=16)), + ('target_major', self.gf('django.db.models.fields.IntegerField')()), + ('target_minor', self.gf('django.db.models.fields.IntegerField')()), + ('current_major', self.gf('django.db.models.fields.IntegerField')()), + ('current_minor', self.gf('django.db.models.fields.IntegerField')()), + )) + db.send_create_signal('Reporting', ['DeviceEntry']) + + # Adding model 'ServiceEntry' + db.create_table('Reporting_serviceentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.IntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('target_status', self.gf('django.db.models.fields.CharField')(default='', max_length=128)), + ('current_status', self.gf('django.db.models.fields.CharField')(default='', max_length=128)), + )) + db.send_create_signal('Reporting', ['ServiceEntry']) + + + def backwards(self, orm): + # Removing unique constraint on 'FilePerms', fields ['owner', 'group', 'perms'] + db.delete_unique('Reporting_fileperms', ['owner', 'group', 'perms']) + + # Removing unique constraint on 'Interaction', fields ['client', 'timestamp'] + db.delete_unique('Reporting_interaction', ['client_id', 'timestamp']) + + # Deleting model 'Client' + db.delete_table('Reporting_client') + + # Deleting model 'Interaction' + db.delete_table('Reporting_interaction') + + # Removing M2M table for field actions on 'Interaction' + db.delete_table('Reporting_interaction_actions') + + # Removing M2M table for field packages on 'Interaction' + db.delete_table('Reporting_interaction_packages') + + # Removing M2M table for field paths on 'Interaction' + db.delete_table('Reporting_interaction_paths') + + # Removing M2M table for field services on 'Interaction' + db.delete_table('Reporting_interaction_services') + + # Removing M2M table for field failures on 'Interaction' + db.delete_table('Reporting_interaction_failures') + + # Removing M2M table for field groups on 'Interaction' + db.delete_table('Reporting_interaction_groups') + + # Removing M2M table for field bundles on 'Interaction' + db.delete_table('Reporting_interaction_bundles') + + # Deleting model 'Performance' + db.delete_table('Reporting_performance') + + # Deleting model 'Group' + db.delete_table('Reporting_group') + + # Removing M2M table for field groups on 'Group' + db.delete_table('Reporting_group_groups') + + # Removing M2M table for field bundles on 'Group' + db.delete_table('Reporting_group_bundles') + + # Deleting model 'Bundle' + db.delete_table('Reporting_bundle') + + # Deleting model 'FilePerms' + db.delete_table('Reporting_fileperms') + + # Deleting model 'FileAcl' + db.delete_table('Reporting_fileacl') + + # Deleting model 'FailureEntry' + db.delete_table('Reporting_failureentry') + + # Deleting model 'ActionEntry' + db.delete_table('Reporting_actionentry') + + # Deleting model 'PackageEntry' + db.delete_table('Reporting_packageentry') + + # Deleting model 'PathEntry' + db.delete_table('Reporting_pathentry') + + # Removing M2M table for field acls on 'PathEntry' + db.delete_table('Reporting_pathentry_acls') + + # Deleting model 'LinkEntry' + db.delete_table('Reporting_linkentry') + + # Deleting model 'DeviceEntry' + db.delete_table('Reporting_deviceentry') + + # Deleting model 'ServiceEntry' + db.delete_table('Reporting_serviceentry') + + + models = { + 'Reporting.actionentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) + }, + 'Reporting.bundle': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) + }, + 'Reporting.client': { + 'Meta': {'object_name': 'Client'}, + 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), + 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.deviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_major': ('django.db.models.fields.IntegerField', [], {}), + 'current_minor': ('django.db.models.fields.IntegerField', [], {}), + 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_major': ('django.db.models.fields.IntegerField', [], {}), + 'target_minor': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.failureentry': { + 'Meta': {'object_name': 'FailureEntry'}, + 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'message': ('django.db.models.fields.TextField', [], {}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileacl': { + 'Meta': {'object_name': 'FileAcl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileperms': { + 'Meta': {'unique_together': "(('owner', 'group', 'perms'),)", 'object_name': 'FilePerms'}, + 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'perms': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.group': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'Reporting.interaction': { + 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, + 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), + 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), + 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), + 'good_count': ('django.db.models.fields.IntegerField', [], {}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), + 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), + 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.Group']"}), + 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), + 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), + 'total_count': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.linkentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) + }, + 'Reporting.packageentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, + 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), + 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) + }, + 'Reporting.pathentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, + 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), + 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), + 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) + }, + 'Reporting.performance': { + 'Meta': {'object_name': 'Performance'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), + 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) + }, + 'Reporting.serviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, + 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) + } + } + + complete_apps = ['Reporting']
\ No newline at end of file diff --git a/src/lib/Bcfg2/Reporting/south_migrations/0002_convert_perms_to_mode.py b/src/lib/Bcfg2/Reporting/south_migrations/0002_convert_perms_to_mode.py new file mode 100644 index 000000000..37cdd146c --- /dev/null +++ b/src/lib/Bcfg2/Reporting/south_migrations/0002_convert_perms_to_mode.py @@ -0,0 +1,170 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models +from django.conf import settings + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Removing unique constraint on 'FilePerms', fields ['owner', 'perms', 'group'] + db.delete_unique('Reporting_fileperms', ['owner', 'perms', 'group']) + + # Renaming field 'FilePerms.perms' to 'FilePerms.mode' + db.rename_column('Reporting_fileperms', 'perms', 'mode') + + if not settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite3': + # Adding unique constraint on 'FilePerms', fields ['owner', 'group', 'mode'] + db.create_unique('Reporting_fileperms', ['owner', 'group', 'mode']) + + + def backwards(self, orm): + # Removing unique constraint on 'FilePerms', fields ['owner', 'group', 'mode'] + db.delete_unique('Reporting_fileperms', ['owner', 'group', 'mode']) + + # Renaming field 'FilePerms.mode' to 'FilePerms.perms' + db.rename_column('Reporting_fileperms', 'mode', 'perms') + + if not settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite3': + # Adding unique constraint on 'FilePerms', fields ['owner', 'perms', 'group'] + db.create_unique('Reporting_fileperms', ['owner', 'perms', 'group']) + + + models = { + 'Reporting.actionentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) + }, + 'Reporting.bundle': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) + }, + 'Reporting.client': { + 'Meta': {'object_name': 'Client'}, + 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), + 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.deviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_major': ('django.db.models.fields.IntegerField', [], {}), + 'current_minor': ('django.db.models.fields.IntegerField', [], {}), + 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_major': ('django.db.models.fields.IntegerField', [], {}), + 'target_minor': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.failureentry': { + 'Meta': {'object_name': 'FailureEntry'}, + 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'message': ('django.db.models.fields.TextField', [], {}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileacl': { + 'Meta': {'object_name': 'FileAcl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileperms': { + 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, + 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.group': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'Reporting.interaction': { + 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, + 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), + 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), + 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), + 'good_count': ('django.db.models.fields.IntegerField', [], {}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), + 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), + 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.Group']"}), + 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), + 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), + 'total_count': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.linkentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) + }, + 'Reporting.packageentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, + 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), + 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) + }, + 'Reporting.pathentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, + 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), + 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), + 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) + }, + 'Reporting.performance': { + 'Meta': {'object_name': 'Performance'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), + 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) + }, + 'Reporting.serviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, + 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) + } + } + + complete_apps = ['Reporting'] diff --git a/src/lib/Bcfg2/Reporting/south_migrations/0003_expand_hash_key.py b/src/lib/Bcfg2/Reporting/south_migrations/0003_expand_hash_key.py new file mode 100644 index 000000000..2da1fa722 --- /dev/null +++ b/src/lib/Bcfg2/Reporting/south_migrations/0003_expand_hash_key.py @@ -0,0 +1,180 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Changing field 'FailureEntry.hash_key' + db.alter_column('Reporting_failureentry', 'hash_key', self.gf('django.db.models.fields.BigIntegerField')()) + + # Changing field 'PackageEntry.hash_key' + db.alter_column('Reporting_packageentry', 'hash_key', self.gf('django.db.models.fields.BigIntegerField')()) + + # Changing field 'ServiceEntry.hash_key' + db.alter_column('Reporting_serviceentry', 'hash_key', self.gf('django.db.models.fields.BigIntegerField')()) + + # Changing field 'PathEntry.hash_key' + db.alter_column('Reporting_pathentry', 'hash_key', self.gf('django.db.models.fields.BigIntegerField')()) + + # Changing field 'ActionEntry.hash_key' + db.alter_column('Reporting_actionentry', 'hash_key', self.gf('django.db.models.fields.BigIntegerField')()) + + def backwards(self, orm): + + # Changing field 'FailureEntry.hash_key' + db.alter_column('Reporting_failureentry', 'hash_key', self.gf('django.db.models.fields.IntegerField')()) + + # Changing field 'PackageEntry.hash_key' + db.alter_column('Reporting_packageentry', 'hash_key', self.gf('django.db.models.fields.IntegerField')()) + + # Changing field 'ServiceEntry.hash_key' + db.alter_column('Reporting_serviceentry', 'hash_key', self.gf('django.db.models.fields.IntegerField')()) + + # Changing field 'PathEntry.hash_key' + db.alter_column('Reporting_pathentry', 'hash_key', self.gf('django.db.models.fields.IntegerField')()) + + # Changing field 'ActionEntry.hash_key' + db.alter_column('Reporting_actionentry', 'hash_key', self.gf('django.db.models.fields.IntegerField')()) + + models = { + 'Reporting.actionentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) + }, + 'Reporting.bundle': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) + }, + 'Reporting.client': { + 'Meta': {'object_name': 'Client'}, + 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), + 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.deviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_major': ('django.db.models.fields.IntegerField', [], {}), + 'current_minor': ('django.db.models.fields.IntegerField', [], {}), + 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_major': ('django.db.models.fields.IntegerField', [], {}), + 'target_minor': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.failureentry': { + 'Meta': {'object_name': 'FailureEntry'}, + 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'message': ('django.db.models.fields.TextField', [], {}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileacl': { + 'Meta': {'object_name': 'FileAcl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileperms': { + 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, + 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.group': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'Reporting.interaction': { + 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, + 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), + 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), + 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), + 'good_count': ('django.db.models.fields.IntegerField', [], {}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), + 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), + 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.Group']"}), + 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), + 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), + 'total_count': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.linkentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) + }, + 'Reporting.packageentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, + 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), + 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) + }, + 'Reporting.pathentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, + 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), + 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), + 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) + }, + 'Reporting.performance': { + 'Meta': {'object_name': 'Performance'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), + 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) + }, + 'Reporting.serviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, + 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) + } + } + + complete_apps = ['Reporting']
\ No newline at end of file diff --git a/src/lib/Bcfg2/Reporting/south_migrations/0004_profile_can_be_null.py b/src/lib/Bcfg2/Reporting/south_migrations/0004_profile_can_be_null.py new file mode 100644 index 000000000..26a053b67 --- /dev/null +++ b/src/lib/Bcfg2/Reporting/south_migrations/0004_profile_can_be_null.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Changing field 'Interaction.profile' + db.alter_column('Reporting_interaction', 'profile_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['Reporting.Group'])) + + def backwards(self, orm): + + # User chose to not deal with backwards NULL issues for 'Interaction.profile' + raise RuntimeError("Cannot reverse this migration. 'Interaction.profile' and its values cannot be restored.") + + models = { + 'Reporting.actionentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) + }, + 'Reporting.bundle': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) + }, + 'Reporting.client': { + 'Meta': {'object_name': 'Client'}, + 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), + 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.deviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_major': ('django.db.models.fields.IntegerField', [], {}), + 'current_minor': ('django.db.models.fields.IntegerField', [], {}), + 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_major': ('django.db.models.fields.IntegerField', [], {}), + 'target_minor': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.failureentry': { + 'Meta': {'object_name': 'FailureEntry'}, + 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'message': ('django.db.models.fields.TextField', [], {}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileacl': { + 'Meta': {'object_name': 'FileAcl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileperms': { + 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, + 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.group': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'Reporting.interaction': { + 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, + 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), + 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), + 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), + 'good_count': ('django.db.models.fields.IntegerField', [], {}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), + 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), + 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'null': 'True', 'to': "orm['Reporting.Group']"}), + 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), + 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), + 'total_count': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.linkentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) + }, + 'Reporting.packageentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, + 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), + 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) + }, + 'Reporting.pathentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, + 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), + 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), + 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) + }, + 'Reporting.performance': { + 'Meta': {'object_name': 'Performance'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), + 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) + }, + 'Reporting.serviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, + 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) + } + } + + complete_apps = ['Reporting']
\ No newline at end of file diff --git a/src/lib/Bcfg2/Reporting/south_migrations/0005_add_selinux_entry_support.py b/src/lib/Bcfg2/Reporting/south_migrations/0005_add_selinux_entry_support.py new file mode 100644 index 000000000..d5f5d801a --- /dev/null +++ b/src/lib/Bcfg2/Reporting/south_migrations/0005_add_selinux_entry_support.py @@ -0,0 +1,485 @@ +# -*- coding: utf-8 -*- +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 'SELoginEntry' + db.create_table('Reporting_seloginentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('selinuxuser', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('current_selinuxuser', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), + )) + db.send_create_signal('Reporting', ['SELoginEntry']) + + # Adding model 'SEUserEntry' + db.create_table('Reporting_seuserentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('roles', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('current_roles', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), + ('prefix', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('current_prefix', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), + )) + db.send_create_signal('Reporting', ['SEUserEntry']) + + # Adding model 'SEBooleanEntry' + db.create_table('Reporting_sebooleanentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('value', self.gf('django.db.models.fields.BooleanField')(default=True)), + )) + db.send_create_signal('Reporting', ['SEBooleanEntry']) + + # Adding model 'SENodeEntry' + db.create_table('Reporting_senodeentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('current_selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), + ('proto', self.gf('django.db.models.fields.CharField')(max_length=4)), + )) + db.send_create_signal('Reporting', ['SENodeEntry']) + + # Adding model 'SEFcontextEntry' + db.create_table('Reporting_sefcontextentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('current_selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), + ('filetype', self.gf('django.db.models.fields.CharField')(max_length=16)), + )) + db.send_create_signal('Reporting', ['SEFcontextEntry']) + + # Adding model 'SEInterfaceEntry' + db.create_table('Reporting_seinterfaceentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('current_selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), + )) + db.send_create_signal('Reporting', ['SEInterfaceEntry']) + + # Adding model 'SEPermissiveEntry' + db.create_table('Reporting_sepermissiveentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + )) + db.send_create_signal('Reporting', ['SEPermissiveEntry']) + + # Adding model 'SEModuleEntry' + db.create_table('Reporting_semoduleentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('disabled', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('current_disabled', self.gf('django.db.models.fields.BooleanField')(default=False)), + )) + db.send_create_signal('Reporting', ['SEModuleEntry']) + + # Adding model 'SEPortEntry' + db.create_table('Reporting_seportentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128)), + ('current_selinuxtype', self.gf('django.db.models.fields.CharField')(max_length=128, null=True)), + )) + db.send_create_signal('Reporting', ['SEPortEntry']) + + # Adding M2M table for field sebooleans on 'Interaction' + db.create_table('Reporting_interaction_sebooleans', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('sebooleanentry', models.ForeignKey(orm['Reporting.sebooleanentry'], null=False)) + )) + db.create_unique('Reporting_interaction_sebooleans', ['interaction_id', 'sebooleanentry_id']) + + # Adding M2M table for field seports on 'Interaction' + db.create_table('Reporting_interaction_seports', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('seportentry', models.ForeignKey(orm['Reporting.seportentry'], null=False)) + )) + db.create_unique('Reporting_interaction_seports', ['interaction_id', 'seportentry_id']) + + # Adding M2M table for field sefcontexts on 'Interaction' + db.create_table('Reporting_interaction_sefcontexts', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('sefcontextentry', models.ForeignKey(orm['Reporting.sefcontextentry'], null=False)) + )) + db.create_unique('Reporting_interaction_sefcontexts', ['interaction_id', 'sefcontextentry_id']) + + # Adding M2M table for field senodes on 'Interaction' + db.create_table('Reporting_interaction_senodes', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('senodeentry', models.ForeignKey(orm['Reporting.senodeentry'], null=False)) + )) + db.create_unique('Reporting_interaction_senodes', ['interaction_id', 'senodeentry_id']) + + # Adding M2M table for field selogins on 'Interaction' + db.create_table('Reporting_interaction_selogins', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('seloginentry', models.ForeignKey(orm['Reporting.seloginentry'], null=False)) + )) + db.create_unique('Reporting_interaction_selogins', ['interaction_id', 'seloginentry_id']) + + # Adding M2M table for field seusers on 'Interaction' + db.create_table('Reporting_interaction_seusers', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('seuserentry', models.ForeignKey(orm['Reporting.seuserentry'], null=False)) + )) + db.create_unique('Reporting_interaction_seusers', ['interaction_id', 'seuserentry_id']) + + # Adding M2M table for field seinterfaces on 'Interaction' + db.create_table('Reporting_interaction_seinterfaces', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('seinterfaceentry', models.ForeignKey(orm['Reporting.seinterfaceentry'], null=False)) + )) + db.create_unique('Reporting_interaction_seinterfaces', ['interaction_id', 'seinterfaceentry_id']) + + # Adding M2M table for field sepermissives on 'Interaction' + db.create_table('Reporting_interaction_sepermissives', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('sepermissiveentry', models.ForeignKey(orm['Reporting.sepermissiveentry'], null=False)) + )) + db.create_unique('Reporting_interaction_sepermissives', ['interaction_id', 'sepermissiveentry_id']) + + # Adding M2M table for field semodules on 'Interaction' + db.create_table('Reporting_interaction_semodules', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('semoduleentry', models.ForeignKey(orm['Reporting.semoduleentry'], null=False)) + )) + db.create_unique('Reporting_interaction_semodules', ['interaction_id', 'semoduleentry_id']) + + + def backwards(self, orm): + # Deleting model 'SELoginEntry' + db.delete_table('Reporting_seloginentry') + + # Deleting model 'SEUserEntry' + db.delete_table('Reporting_seuserentry') + + # Deleting model 'SEBooleanEntry' + db.delete_table('Reporting_sebooleanentry') + + # Deleting model 'SENodeEntry' + db.delete_table('Reporting_senodeentry') + + # Deleting model 'SEFcontextEntry' + db.delete_table('Reporting_sefcontextentry') + + # Deleting model 'SEInterfaceEntry' + db.delete_table('Reporting_seinterfaceentry') + + # Deleting model 'SEPermissiveEntry' + db.delete_table('Reporting_sepermissiveentry') + + # Deleting model 'SEModuleEntry' + db.delete_table('Reporting_semoduleentry') + + # Deleting model 'SEPortEntry' + db.delete_table('Reporting_seportentry') + + # Removing M2M table for field sebooleans on 'Interaction' + db.delete_table('Reporting_interaction_sebooleans') + + # Removing M2M table for field seports on 'Interaction' + db.delete_table('Reporting_interaction_seports') + + # Removing M2M table for field sefcontexts on 'Interaction' + db.delete_table('Reporting_interaction_sefcontexts') + + # Removing M2M table for field senodes on 'Interaction' + db.delete_table('Reporting_interaction_senodes') + + # Removing M2M table for field selogins on 'Interaction' + db.delete_table('Reporting_interaction_selogins') + + # Removing M2M table for field seusers on 'Interaction' + db.delete_table('Reporting_interaction_seusers') + + # Removing M2M table for field seinterfaces on 'Interaction' + db.delete_table('Reporting_interaction_seinterfaces') + + # Removing M2M table for field sepermissives on 'Interaction' + db.delete_table('Reporting_interaction_sepermissives') + + # Removing M2M table for field semodules on 'Interaction' + db.delete_table('Reporting_interaction_semodules') + + + models = { + 'Reporting.actionentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) + }, + 'Reporting.bundle': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) + }, + 'Reporting.client': { + 'Meta': {'object_name': 'Client'}, + 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), + 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.deviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_major': ('django.db.models.fields.IntegerField', [], {}), + 'current_minor': ('django.db.models.fields.IntegerField', [], {}), + 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_major': ('django.db.models.fields.IntegerField', [], {}), + 'target_minor': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.failureentry': { + 'Meta': {'object_name': 'FailureEntry'}, + 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'message': ('django.db.models.fields.TextField', [], {}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileacl': { + 'Meta': {'object_name': 'FileAcl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileperms': { + 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, + 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.group': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'Reporting.interaction': { + 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, + 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), + 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), + 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), + 'good_count': ('django.db.models.fields.IntegerField', [], {}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), + 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), + 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'null': 'True', 'to': "orm['Reporting.Group']"}), + 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'sebooleans': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEBooleanEntry']", 'symmetrical': 'False'}), + 'sefcontexts': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEFcontextEntry']", 'symmetrical': 'False'}), + 'seinterfaces': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEInterfaceEntry']", 'symmetrical': 'False'}), + 'selogins': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SELoginEntry']", 'symmetrical': 'False'}), + 'semodules': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEModuleEntry']", 'symmetrical': 'False'}), + 'senodes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SENodeEntry']", 'symmetrical': 'False'}), + 'sepermissives': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPermissiveEntry']", 'symmetrical': 'False'}), + 'seports': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPortEntry']", 'symmetrical': 'False'}), + 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), + 'seusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEUserEntry']", 'symmetrical': 'False'}), + 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), + 'total_count': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.linkentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) + }, + 'Reporting.packageentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, + 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), + 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) + }, + 'Reporting.pathentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, + 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), + 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), + 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) + }, + 'Reporting.performance': { + 'Meta': {'object_name': 'Performance'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), + 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) + }, + 'Reporting.sebooleanentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEBooleanEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'value': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + }, + 'Reporting.sefcontextentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEFcontextEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'filetype': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.seinterfaceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEInterfaceEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.seloginentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SELoginEntry'}, + 'current_selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.semoduleentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEModuleEntry'}, + 'current_disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.senodeentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SENodeEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'proto': ('django.db.models.fields.CharField', [], {'max_length': '4'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.sepermissiveentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPermissiveEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.seportentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPortEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.serviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, + 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) + }, + 'Reporting.seuserentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEUserEntry'}, + 'current_prefix': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'current_roles': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'prefix': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'roles': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + } + } + + complete_apps = ['Reporting']
\ No newline at end of file diff --git a/src/lib/Bcfg2/Reporting/south_migrations/0006_add_user_group_entry_support.py b/src/lib/Bcfg2/Reporting/south_migrations/0006_add_user_group_entry_support.py new file mode 100644 index 000000000..d86e663d5 --- /dev/null +++ b/src/lib/Bcfg2/Reporting/south_migrations/0006_add_user_group_entry_support.py @@ -0,0 +1,340 @@ +# -*- coding: utf-8 -*- +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 'POSIXGroupEntry' + db.create_table('Reporting_posixgroupentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('gid', self.gf('django.db.models.fields.IntegerField')(null=True)), + ('current_gid', self.gf('django.db.models.fields.IntegerField')(null=True)), + )) + db.send_create_signal('Reporting', ['POSIXGroupEntry']) + + # Adding model 'POSIXUserEntry' + db.create_table('Reporting_posixuserentry', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)), + ('hash_key', self.gf('django.db.models.fields.BigIntegerField')(db_index=True)), + ('state', self.gf('django.db.models.fields.IntegerField')()), + ('exists', self.gf('django.db.models.fields.BooleanField')(default=True)), + ('uid', self.gf('django.db.models.fields.IntegerField')(null=True)), + ('current_uid', self.gf('django.db.models.fields.IntegerField')(null=True)), + ('group', self.gf('django.db.models.fields.CharField')(max_length=64)), + ('current_group', self.gf('django.db.models.fields.CharField')(max_length=64, null=True)), + ('gecos', self.gf('django.db.models.fields.CharField')(max_length=1024)), + ('current_gecos', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)), + ('home', self.gf('django.db.models.fields.CharField')(max_length=1024)), + ('current_home', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)), + ('shell', self.gf('django.db.models.fields.CharField')(default='/bin/bash', max_length=1024)), + ('current_shell', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)), + )) + db.send_create_signal('Reporting', ['POSIXUserEntry']) + + # Adding M2M table for field posixusers on 'Interaction' + db.create_table('Reporting_interaction_posixusers', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('posixuserentry', models.ForeignKey(orm['Reporting.posixuserentry'], null=False)) + )) + db.create_unique('Reporting_interaction_posixusers', ['interaction_id', 'posixuserentry_id']) + + # Adding M2M table for field posixgroups on 'Interaction' + db.create_table('Reporting_interaction_posixgroups', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('interaction', models.ForeignKey(orm['Reporting.interaction'], null=False)), + ('posixgroupentry', models.ForeignKey(orm['Reporting.posixgroupentry'], null=False)) + )) + db.create_unique('Reporting_interaction_posixgroups', ['interaction_id', 'posixgroupentry_id']) + + + def backwards(self, orm): + # Deleting model 'POSIXGroupEntry' + db.delete_table('Reporting_posixgroupentry') + + # Deleting model 'POSIXUserEntry' + db.delete_table('Reporting_posixuserentry') + + # Removing M2M table for field posixusers on 'Interaction' + db.delete_table('Reporting_interaction_posixusers') + + # Removing M2M table for field posixgroups on 'Interaction' + db.delete_table('Reporting_interaction_posixgroups') + + + models = { + 'Reporting.actionentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) + }, + 'Reporting.bundle': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) + }, + 'Reporting.client': { + 'Meta': {'object_name': 'Client'}, + 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), + 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.deviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_major': ('django.db.models.fields.IntegerField', [], {}), + 'current_minor': ('django.db.models.fields.IntegerField', [], {}), + 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_major': ('django.db.models.fields.IntegerField', [], {}), + 'target_minor': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.failureentry': { + 'Meta': {'object_name': 'FailureEntry'}, + 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'message': ('django.db.models.fields.TextField', [], {}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileacl': { + 'Meta': {'object_name': 'FileAcl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileperms': { + 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, + 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.group': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'Reporting.interaction': { + 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, + 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), + 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), + 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), + 'good_count': ('django.db.models.fields.IntegerField', [], {}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), + 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), + 'posixgroups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.POSIXGroupEntry']", 'symmetrical': 'False'}), + 'posixusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.POSIXUserEntry']", 'symmetrical': 'False'}), + 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'null': 'True', 'to': "orm['Reporting.Group']"}), + 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'sebooleans': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEBooleanEntry']", 'symmetrical': 'False'}), + 'sefcontexts': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEFcontextEntry']", 'symmetrical': 'False'}), + 'seinterfaces': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEInterfaceEntry']", 'symmetrical': 'False'}), + 'selogins': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SELoginEntry']", 'symmetrical': 'False'}), + 'semodules': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEModuleEntry']", 'symmetrical': 'False'}), + 'senodes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SENodeEntry']", 'symmetrical': 'False'}), + 'sepermissives': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPermissiveEntry']", 'symmetrical': 'False'}), + 'seports': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPortEntry']", 'symmetrical': 'False'}), + 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), + 'seusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEUserEntry']", 'symmetrical': 'False'}), + 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), + 'total_count': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.linkentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) + }, + 'Reporting.packageentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, + 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), + 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) + }, + 'Reporting.pathentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, + 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), + 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), + 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) + }, + 'Reporting.performance': { + 'Meta': {'object_name': 'Performance'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), + 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) + }, + 'Reporting.posixgroupentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'POSIXGroupEntry'}, + 'current_gid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'gid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.posixuserentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'POSIXUserEntry'}, + 'current_gecos': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), + 'current_group': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}), + 'current_home': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), + 'current_shell': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), + 'current_uid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'gecos': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'group': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'home': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'shell': ('django.db.models.fields.CharField', [], {'default': "'/bin/bash'", 'max_length': '1024'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'uid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}) + }, + 'Reporting.sebooleanentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEBooleanEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'value': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + }, + 'Reporting.sefcontextentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEFcontextEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'filetype': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.seinterfaceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEInterfaceEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.seloginentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SELoginEntry'}, + 'current_selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.semoduleentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEModuleEntry'}, + 'current_disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.senodeentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SENodeEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'proto': ('django.db.models.fields.CharField', [], {'max_length': '4'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.sepermissiveentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPermissiveEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.seportentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPortEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.serviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, + 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) + }, + 'Reporting.seuserentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEUserEntry'}, + 'current_prefix': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'current_roles': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'prefix': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'roles': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + } + } + + complete_apps = ['Reporting']
\ No newline at end of file diff --git a/src/lib/Bcfg2/Reporting/south_migrations/0007_add_flag_fields_interaction.py b/src/lib/Bcfg2/Reporting/south_migrations/0007_add_flag_fields_interaction.py new file mode 100644 index 000000000..491ecb845 --- /dev/null +++ b/src/lib/Bcfg2/Reporting/south_migrations/0007_add_flag_fields_interaction.py @@ -0,0 +1,298 @@ +# -*- coding: utf-8 -*- +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 field 'Interaction.dry_run' + db.add_column('Reporting_interaction', 'dry_run', + self.gf('django.db.models.fields.BooleanField')(default=False), + keep_default=False) + + # Adding field 'Interaction.only_important' + db.add_column('Reporting_interaction', 'only_important', + self.gf('django.db.models.fields.BooleanField')(default=False), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'Interaction.dry_run' + db.delete_column('Reporting_interaction', 'dry_run') + + # Deleting field 'Interaction.only_important' + db.delete_column('Reporting_interaction', 'only_important') + + + models = { + 'Reporting.actionentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ActionEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'output': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'default': "'check'", 'max_length': '128'}) + }, + 'Reporting.bundle': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Bundle'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) + }, + 'Reporting.client': { + 'Meta': {'object_name': 'Client'}, + 'creation': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'current_interaction': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parent_client'", 'null': 'True', 'to': "orm['Reporting.Interaction']"}), + 'expiration': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.deviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'DeviceEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_major': ('django.db.models.fields.IntegerField', [], {}), + 'current_minor': ('django.db.models.fields.IntegerField', [], {}), + 'device_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_major': ('django.db.models.fields.IntegerField', [], {}), + 'target_minor': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.failureentry': { + 'Meta': {'object_name': 'FailureEntry'}, + 'entry_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'message': ('django.db.models.fields.TextField', [], {}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileacl': { + 'Meta': {'object_name': 'FileAcl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}) + }, + 'Reporting.fileperms': { + 'Meta': {'unique_together': "(('owner', 'group', 'mode'),)", 'object_name': 'FilePerms'}, + 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mode': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'Reporting.group': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Group'}, + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'category': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'profile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'Reporting.interaction': { + 'Meta': {'ordering': "['-timestamp']", 'unique_together': "(('client', 'timestamp'),)", 'object_name': 'Interaction'}, + 'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ActionEntry']", 'symmetrical': 'False'}), + 'bad_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'bundles': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Bundle']", 'symmetrical': 'False'}), + 'client': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'interactions'", 'to': "orm['Reporting.Client']"}), + 'dry_run': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'extra_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'failures': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FailureEntry']", 'symmetrical': 'False'}), + 'good_count': ('django.db.models.fields.IntegerField', [], {}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.Group']", 'symmetrical': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'modified_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'only_important': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'packages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PackageEntry']", 'symmetrical': 'False'}), + 'paths': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.PathEntry']", 'symmetrical': 'False'}), + 'posixgroups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.POSIXGroupEntry']", 'symmetrical': 'False'}), + 'posixusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.POSIXUserEntry']", 'symmetrical': 'False'}), + 'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'null': 'True', 'to': "orm['Reporting.Group']"}), + 'repo_rev_code': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'sebooleans': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEBooleanEntry']", 'symmetrical': 'False'}), + 'sefcontexts': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEFcontextEntry']", 'symmetrical': 'False'}), + 'seinterfaces': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEInterfaceEntry']", 'symmetrical': 'False'}), + 'selogins': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SELoginEntry']", 'symmetrical': 'False'}), + 'semodules': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEModuleEntry']", 'symmetrical': 'False'}), + 'senodes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SENodeEntry']", 'symmetrical': 'False'}), + 'sepermissives': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPermissiveEntry']", 'symmetrical': 'False'}), + 'seports': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEPortEntry']", 'symmetrical': 'False'}), + 'server': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'services': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.ServiceEntry']", 'symmetrical': 'False'}), + 'seusers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.SEUserEntry']", 'symmetrical': 'False'}), + 'state': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'timestamp': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), + 'total_count': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.linkentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'LinkEntry', '_ormbases': ['Reporting.PathEntry']}, + 'current_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'pathentry_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['Reporting.PathEntry']", 'unique': 'True', 'primary_key': 'True'}), + 'target_path': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}) + }, + 'Reporting.packageentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PackageEntry'}, + 'current_version': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024'}), + 'verification_details': ('django.db.models.fields.TextField', [], {'default': "''"}) + }, + 'Reporting.pathentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'PathEntry'}, + 'acls': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['Reporting.FileAcl']", 'symmetrical': 'False'}), + 'current_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}), + 'detail_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'details': ('django.db.models.fields.TextField', [], {'default': "''"}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'path_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_perms': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['Reporting.FilePerms']"}) + }, + 'Reporting.performance': { + 'Meta': {'object_name': 'Performance'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'interaction': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'performance_items'", 'to': "orm['Reporting.Interaction']"}), + 'metric': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '32', 'decimal_places': '16'}) + }, + 'Reporting.posixgroupentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'POSIXGroupEntry'}, + 'current_gid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'gid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.posixuserentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'POSIXUserEntry'}, + 'current_gecos': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), + 'current_group': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}), + 'current_home': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), + 'current_shell': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}), + 'current_uid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'gecos': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'group': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'home': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'shell': ('django.db.models.fields.CharField', [], {'default': "'/bin/bash'", 'max_length': '1024'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'uid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}) + }, + 'Reporting.sebooleanentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEBooleanEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'value': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + }, + 'Reporting.sefcontextentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEFcontextEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'filetype': ('django.db.models.fields.CharField', [], {'max_length': '16'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.seinterfaceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEInterfaceEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.seloginentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SELoginEntry'}, + 'current_selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxuser': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.semoduleentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEModuleEntry'}, + 'current_disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'disabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.senodeentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SENodeEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'proto': ('django.db.models.fields.CharField', [], {'max_length': '4'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.sepermissiveentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPermissiveEntry'}, + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.seportentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEPortEntry'}, + 'current_selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'selinuxtype': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + }, + 'Reporting.serviceentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'ServiceEntry'}, + 'current_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {}), + 'target_status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128'}) + }, + 'Reporting.seuserentry': { + 'Meta': {'ordering': "('state', 'name')", 'object_name': 'SEUserEntry'}, + 'current_prefix': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'current_roles': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'exists': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'hash_key': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'prefix': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'roles': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'state': ('django.db.models.fields.IntegerField', [], {}) + } + } + + complete_apps = ['Reporting']
\ No newline at end of file diff --git a/src/lib/Bcfg2/Reporting/south_migrations/__init__.py b/src/lib/Bcfg2/Reporting/south_migrations/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/lib/Bcfg2/Reporting/south_migrations/__init__.py diff --git a/src/lib/Bcfg2/Reporting/templatetags/bcfg2_tags.py b/src/lib/Bcfg2/Reporting/templatetags/bcfg2_tags.py index 09aebc7fd..5c50c614d 100644 --- a/src/lib/Bcfg2/Reporting/templatetags/bcfg2_tags.py +++ b/src/lib/Bcfg2/Reporting/templatetags/bcfg2_tags.py @@ -1,11 +1,11 @@ import sys from copy import copy +import django from django import template from django.conf import settings from django.core.urlresolvers import resolve, reverse, \ Resolver404, NoReverseMatch -from django.template.loader import get_template_from_string from django.utils.encoding import smart_str from django.utils.safestring import mark_safe from datetime import datetime, timedelta @@ -394,6 +394,13 @@ class SortLinkNode(template.Node): self.sort_key = template.Variable(sort_key) self.text = template.Variable(text) + def _render_template(self, context): + if django.VERSION[0] == 1 and django.VERSION[1] >= 8: + return context.template.engine.from_string(self.__TMPL__) + else: + from django.template.loader import get_template_from_string + return get_template_from_string(self.__TMPL__).render(context) + def render(self, context): try: try: @@ -419,7 +426,7 @@ class SortLinkNode(template.Node): context.push() context['key'] = sort_key context['text'] = mark_safe(text) - output = get_template_from_string(self.__TMPL__).render(context) + output = self._render_template(context) context.pop() return output except: diff --git a/src/lib/Bcfg2/Server/Admin.py b/src/lib/Bcfg2/Server/Admin.py index c294e6be5..b038980a1 100644 --- a/src/lib/Bcfg2/Server/Admin.py +++ b/src/lib/Bcfg2/Server/Admin.py @@ -25,15 +25,19 @@ import Bcfg2.Server.Plugins.Metadata try: from django.core.exceptions import ImproperlyConfigured from django.core import management + import django import django.conf import Bcfg2.Server.models HAS_DJANGO = True - try: - import south # pylint: disable=W0611 + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: HAS_REPORTS = True - except ImportError: - HAS_REPORTS = False + else: + try: + import south # pylint: disable=W0611 + HAS_REPORTS = True + except ImportError: + HAS_REPORTS = False except ImportError: HAS_DJANGO = False HAS_REPORTS = False @@ -877,6 +881,7 @@ if HAS_DJANGO: Django management system """ command = None args = [] + kwargs = {} def run(self, _): '''Call a django command''' @@ -885,7 +890,7 @@ if HAS_DJANGO: else: command = self.__class__.__name__.lower() args = [command] + self.args - management.call_command(*args) + management.call_command(*args, **self.kwargs) class DBShell(_DjangoProxyCmd): """ Call the Django 'dbshell' command on the database """ @@ -901,7 +906,6 @@ if HAS_DJANGO: """ Sync the Django ORM with the configured database """ def run(self, setup): - Bcfg2.Server.models.load_models() try: Bcfg2.DBSettings.sync_databases( interactive=False, @@ -915,6 +919,17 @@ if HAS_DJANGO: self.logger.error("Database update failed: %s" % err) raise SystemExit(1) + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + class Makemigrations(_DjangoProxyCmd): + """ Call the 'makemigrations' command on the database """ + args = ['Reporting'] + + else: + class Schemamigration(_DjangoProxyCmd): + """ Call the South 'schemamigration' command on the database """ + args = ['Bcfg2.Reporting'] + kwargs = {'auto': True} + if HAS_REPORTS: import datetime @@ -1194,6 +1209,10 @@ class CLI(Bcfg2.Options.CommandRegistry): components=[self]) parser.add_options(self.subcommand_options) parser.parse() + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + # this has been introduced in django 1.7, so pylint fails with + # older django releases + django.setup() # pylint: disable=E1101 def run(self): """ Run bcfg2-admin """ diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py index dc9c91556..a9628c024 100644 --- a/src/lib/Bcfg2/Server/Core.py +++ b/src/lib/Bcfg2/Server/Core.py @@ -27,6 +27,7 @@ from Bcfg2.Server.Statistics import track_statistics try: from django.core.exceptions import ImproperlyConfigured + import django import django.conf HAS_DJANGO = True except ImportError: @@ -83,10 +84,14 @@ def close_db_connection(func): """ The decorated function """ rv = func(self, *args, **kwargs) if self._database_available: # pylint: disable=W0212 - from django import db self.logger.debug("%s: Closing database connection" % threading.current_thread().getName()) - db.close_connection() + + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + for connection in django.db.connections.all(): + connection.close() + else: + django.db.close_connection() return rv return inner @@ -430,6 +435,7 @@ class Core(object): self.logger.error("Unexpected instantiation failure for plugin %s" % plugin, exc_info=1) + @close_db_connection def shutdown(self): """ Perform plugin and FAM shutdown tasks. """ if not self._running: @@ -444,10 +450,6 @@ class Core(object): for plugin in list(self.plugins.values()): plugin.shutdown() self.logger.info("%s: All plugins shut down" % self.name) - if self._database_available: - from django import db - self.logger.info("%s: Closing database connection" % self.name) - db.close_connection() @property def metadata_cache_mode(self): @@ -682,7 +684,7 @@ class Core(object): self.logger.debug("Building configuration for %s" % client) start = time.time() config = lxml.etree.Element("Configuration", version='2.0', - revision=self.revision) + revision=str(self.revision)) try: meta = self.build_metadata(client) except MetadataConsistencyError: diff --git a/src/lib/Bcfg2/Server/FileMonitor/Inotify.py b/src/lib/Bcfg2/Server/FileMonitor/Inotify.py index c4b34a469..8f6e136fd 100644 --- a/src/lib/Bcfg2/Server/FileMonitor/Inotify.py +++ b/src/lib/Bcfg2/Server/FileMonitor/Inotify.py @@ -214,6 +214,7 @@ class Inotify(Pseudo, pyinotify.ProcessEvent): def shutdown(self): if self.started and self.notifier: self.notifier.stop() + Pseudo.shutdown(self) shutdown.__doc__ = Pseudo.shutdown.__doc__ def list_watches(self): diff --git a/src/lib/Bcfg2/Server/Plugins/AWSTags.py b/src/lib/Bcfg2/Server/Plugins/AWSTags.py index 0d6eefaaa..556805bde 100644 --- a/src/lib/Bcfg2/Server/Plugins/AWSTags.py +++ b/src/lib/Bcfg2/Server/Plugins/AWSTags.py @@ -172,6 +172,11 @@ class AWSTags(Bcfg2.Server.Plugin.Plugin, def start_client_run(self, metadata): self.expire_cache(key=metadata.hostname) + if self.core.metadata_cache_mode == 'aggressive': + self.logger.warning("AWSTags is incompatible with aggressive " + "client metadata caching, try 'cautious' " + "or 'initial'") + self.core.metadata_cache.expire(metadata.hostname) def get_additional_data(self, metadata): return self.get_tags(metadata) diff --git a/src/lib/Bcfg2/Server/Plugins/Bundler.py b/src/lib/Bcfg2/Server/Plugins/Bundler.py index 6c35ada59..f5bcbe797 100644 --- a/src/lib/Bcfg2/Server/Plugins/Bundler.py +++ b/src/lib/Bcfg2/Server/Plugins/Bundler.py @@ -128,7 +128,7 @@ class Bundler(Plugin, # dependent bundle -- add it to the list of # bundles for this client if child.get("name") not in bundles_added: - bundles.append(child.get("name")) + bundles.add(child.get("name")) bundles_added.add(child.get("name")) if child.get('inherit_modification', 'false') == 'true': if metadata.version_info >= \ diff --git a/src/lib/Bcfg2/Server/Plugins/GroupLogic.py b/src/lib/Bcfg2/Server/Plugins/GroupLogic.py index b60f60e65..184b362f9 100644 --- a/src/lib/Bcfg2/Server/Plugins/GroupLogic.py +++ b/src/lib/Bcfg2/Server/Plugins/GroupLogic.py @@ -13,6 +13,17 @@ class GroupLogicConfig(Bcfg2.Server.Plugin.StructFile): create = lxml.etree.Element("GroupLogic", nsmap=dict(py="http://genshi.edgewall.org/")) + def __init__(self, filename, core): + Bcfg2.Server.Plugin.StructFile.__init__(self, filename, + should_monitor=True) + self.core = core + + def Index(self): + Bcfg2.Server.Plugin.StructFile.Index(self) + + if self.core.metadata_cache_mode in ['cautious', 'aggressive']: + self.core.metadata_cache.expire() + def _match(self, item, metadata, *args): if item.tag == 'Group' and not len(item.getchildren()): return [item] @@ -39,7 +50,7 @@ class GroupLogic(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Plugin.__init__(self, core) Bcfg2.Server.Plugin.Connector.__init__(self) self.config = GroupLogicConfig(os.path.join(self.data, "groups.xml"), - should_monitor=True) + core=core) self._local = local() def get_additional_groups(self, metadata): diff --git a/src/lib/Bcfg2/Server/Plugins/Ohai.py b/src/lib/Bcfg2/Server/Plugins/Ohai.py index 461be9ba8..b314e60a0 100644 --- a/src/lib/Bcfg2/Server/Plugins/Ohai.py +++ b/src/lib/Bcfg2/Server/Plugins/Ohai.py @@ -94,7 +94,12 @@ class Ohai(Bcfg2.Server.Plugin.Plugin, return [self.probe] def ReceiveData(self, meta, datalist): - self.cache[meta.hostname] = datalist[0].text + if meta.hostname not in self.cache or \ + self.cache[meta.hostname] != datalist[0].text: + self.cache[meta.hostname] = datalist[0].text + + if self.core.metadata_cache_mode in ['cautious', 'aggressive']: + self.core.metadata_cache.expire(meta.hostname) def get_additional_data(self, meta): if meta.hostname in self.cache: diff --git a/src/lib/Bcfg2/Server/Plugins/Probes.py b/src/lib/Bcfg2/Server/Plugins/Probes.py index 76aab69b5..573c9af71 100644 --- a/src/lib/Bcfg2/Server/Plugins/Probes.py +++ b/src/lib/Bcfg2/Server/Plugins/Probes.py @@ -74,6 +74,7 @@ class ProbeStore(Debuggable): def __init__(self, core, datadir): # pylint: disable=W0613 Debuggable.__init__(self) + self.core = core self._groupcache = Bcfg2.Server.Cache.Cache("Probes", "probegroups") self._datacache = Bcfg2.Server.Cache.Cache("Probes", "probedata") @@ -134,7 +135,7 @@ class DBProbeStore(ProbeStore, Bcfg2.Server.Plugin.DatabaseBacked): Bcfg2.Server.Cache.expire("Probes", "probegroups", hostname) groupdata = ProbesGroupsModel.objects.filter(hostname=hostname) self._groupcache[hostname] = list(set(r.group for r in groupdata)) - Bcfg2.Server.Cache.expire("Metadata", hostname) + self.core.metadata_cache.expire(hostname) @Bcfg2.Server.Plugin.DatabaseBacked.get_db_lock def set_groups(self, hostname, groups): @@ -155,7 +156,7 @@ class DBProbeStore(ProbeStore, Bcfg2.Server.Plugin.DatabaseBacked): ProbesGroupsModel.objects.filter( hostname=hostname).exclude(group__in=groups).delete() if olddata != groups: - Bcfg2.Server.Cache.expire("Metadata", hostname) + self.core.metadata_cache.expire(hostname) def _load_data(self, hostname): Bcfg2.Server.Cache.expire("Probes", "probegroups", hostname) @@ -168,7 +169,7 @@ class DBProbeStore(ProbeStore, Bcfg2.Server.Plugin.DatabaseBacked): time.mktime(pdata.timestamp.timetuple()) ts_set = True self._datacache[hostname][pdata.probe] = ProbeData(pdata.data) - Bcfg2.Server.Cache.expire("Metadata", hostname) + self.core.metadata_cache.expire(hostname) @Bcfg2.Server.Plugin.DatabaseBacked.get_db_lock def set_data(self, hostname, data): @@ -198,7 +199,7 @@ class DBProbeStore(ProbeStore, Bcfg2.Server.Plugin.DatabaseBacked): qset.delete() expire_metadata = True if expire_metadata: - Bcfg2.Server.Cache.expire("Metadata", hostname) + self.core.metadata_cache.expire(hostname) class XMLProbeStore(ProbeStore): @@ -234,7 +235,7 @@ class XMLProbeStore(ProbeStore): self._groupcache[client.get('name')].append( pdata.get('name')) - Bcfg2.Server.Cache.expire("Metadata") + self.core.metadata_cache.expire() def _load_groups(self, hostname): self._load_data(hostname) @@ -274,7 +275,7 @@ class XMLProbeStore(ProbeStore): olddata = self._groupcache.get(hostname, []) self._groupcache[hostname] = groups if olddata != groups: - Bcfg2.Server.Cache.expire("Metadata", hostname) + self.core.metadata_cache.expire(hostname) def set_data(self, hostname, data): Bcfg2.Server.Cache.expire("Probes", "probedata", hostname) @@ -285,7 +286,7 @@ class XMLProbeStore(ProbeStore): self._datacache[hostname][probe] = pdata expire_metadata |= olddata != data if expire_metadata: - Bcfg2.Server.Cache.expire("Metadata", hostname) + self.core.metadata_cache.expire(hostname) class ClientProbeDataSet(dict): diff --git a/src/lib/Bcfg2/Server/Plugins/Properties.py b/src/lib/Bcfg2/Server/Plugins/Properties.py index c4dd75e60..e6549b714 100644 --- a/src/lib/Bcfg2/Server/Plugins/Properties.py +++ b/src/lib/Bcfg2/Server/Plugins/Properties.py @@ -35,13 +35,17 @@ LOGGER = logging.getLogger(__name__) class PropertyFile(object): """ Base Properties file handler """ - def __init__(self, name): + def __init__(self, name, core): """ :param name: The filename of this properties file. + :type name: string + :param core: The Bcfg2.Server.Core initializing the Properties plugin + :type core: Bcfg2.Server.Core .. automethod:: _write """ self.name = name + self.core = core def write(self): """ Write the data in this data structure back to the property @@ -69,6 +73,12 @@ class PropertyFile(object): file. """ raise NotImplementedError + def _expire_metadata_cache(self): + """ Expires the metadata cache, if it is required by the caching + mode. """ + if self.core.metadata_cache_mode in ['cautious', 'aggressive']: + self.core.metadata_cache.expire() + def validate_data(self): """ Verify that the data in this file is valid. """ raise NotImplementedError @@ -81,9 +91,9 @@ class PropertyFile(object): class JSONPropertyFile(Bcfg2.Server.Plugin.FileBacked, PropertyFile): """Handle JSON Properties files.""" - def __init__(self, name): + def __init__(self, name, core): Bcfg2.Server.Plugin.FileBacked.__init__(self, name) - PropertyFile.__init__(self, name) + PropertyFile.__init__(self, name, core) self.json = None def Index(self): @@ -93,10 +103,13 @@ class JSONPropertyFile(Bcfg2.Server.Plugin.FileBacked, PropertyFile): err = sys.exc_info()[1] raise PluginExecutionError("Could not load JSON data from %s: %s" % (self.name, err)) + self._expire_metadata_cache() + Index.__doc__ = Bcfg2.Server.Plugin.FileBacked.Index.__doc__ def _write(self): json.dump(self.json, open(self.name, 'wb')) return True + _write.__doc__ = PropertyFile._write.__doc__ def validate_data(self): try: @@ -105,6 +118,7 @@ class JSONPropertyFile(Bcfg2.Server.Plugin.FileBacked, PropertyFile): err = sys.exc_info()[1] raise PluginExecutionError("Data for %s cannot be dumped to JSON: " "%s" % (self.name, err)) + validate_data.__doc__ = PropertyFile.validate_data.__doc__ def __str__(self): return str(self.json) @@ -116,11 +130,10 @@ class JSONPropertyFile(Bcfg2.Server.Plugin.FileBacked, PropertyFile): class YAMLPropertyFile(Bcfg2.Server.Plugin.FileBacked, PropertyFile): """ Handle YAML Properties files. """ - def __init__(self, name): + def __init__(self, name, core): Bcfg2.Server.Plugin.FileBacked.__init__(self, name) - PropertyFile.__init__(self, name) + PropertyFile.__init__(self, name, core) self.yaml = None - __init__.__doc__ = Bcfg2.Server.Plugin.FileBacked.__init__.__doc__ def Index(self): try: @@ -129,6 +142,7 @@ class YAMLPropertyFile(Bcfg2.Server.Plugin.FileBacked, PropertyFile): err = sys.exc_info()[1] raise PluginExecutionError("Could not load YAML data from %s: %s" % (self.name, err)) + self._expire_metadata_cache() Index.__doc__ = Bcfg2.Server.Plugin.FileBacked.Index.__doc__ def _write(self): @@ -155,10 +169,15 @@ class YAMLPropertyFile(Bcfg2.Server.Plugin.FileBacked, PropertyFile): class XMLPropertyFile(Bcfg2.Server.Plugin.StructFile, PropertyFile): """ Handle XML Properties files. """ - def __init__(self, name, should_monitor=False): + def __init__(self, name, core, should_monitor=False): Bcfg2.Server.Plugin.StructFile.__init__(self, name, should_monitor=should_monitor) - PropertyFile.__init__(self, name) + PropertyFile.__init__(self, name, core) + + def Index(self): + Bcfg2.Server.Plugin.StructFile.Index(self) + self._expire_metadata_cache() + Index.__doc__ = Bcfg2.Server.Plugin.StructFile.Index.__doc__ def _write(self): open(self.name, "wb").write( @@ -258,11 +277,11 @@ class Properties(Bcfg2.Server.Plugin.Plugin, :class:`PropertyFile` """ if fname.endswith(".xml"): - return XMLPropertyFile(fname) + return XMLPropertyFile(fname, self.core) elif HAS_JSON and fname.endswith(".json"): - return JSONPropertyFile(fname) + return JSONPropertyFile(fname, self.core) elif HAS_YAML and (fname.endswith(".yaml") or fname.endswith(".yml")): - return YAMLPropertyFile(fname) + return YAMLPropertyFile(fname, self.core) else: raise Bcfg2.Server.Plugin.PluginExecutionError( "Properties: Unknown extension %s" % fname) diff --git a/src/lib/Bcfg2/Server/Plugins/PuppetENC.py b/src/lib/Bcfg2/Server/Plugins/PuppetENC.py index 59fbe6f03..e2d8a058f 100644 --- a/src/lib/Bcfg2/Server/Plugins/PuppetENC.py +++ b/src/lib/Bcfg2/Server/Plugins/PuppetENC.py @@ -117,7 +117,7 @@ class PuppetENC(Bcfg2.Server.Plugin.Plugin, self.logger.warning("PuppetENC is incompatible with aggressive " "client metadata caching, try 'cautious' or " "'initial' instead") - self.core.expire_caches_by_type(Bcfg2.Server.Plugin.Metadata) + self.core.metadata_cache.expire() def end_statistics(self, metadata): self.end_client_run(self, metadata) diff --git a/src/lib/Bcfg2/Server/Plugins/Reporting.py b/src/lib/Bcfg2/Server/Plugins/Reporting.py index 5c73546b4..e372006c7 100644 --- a/src/lib/Bcfg2/Server/Plugins/Reporting.py +++ b/src/lib/Bcfg2/Server/Plugins/Reporting.py @@ -9,12 +9,15 @@ from Bcfg2.Reporting.Transport.base import TransportError from Bcfg2.Server.Plugin import Statistics, PullSource, Threaded, \ PluginInitError, PluginExecutionError -# required for reporting try: - import south # pylint: disable=W0611 - HAS_SOUTH = True + import django + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + HAS_REPORTING = True + else: + import south # pylint: disable=W0611 + HAS_REPORTING = True except ImportError: - HAS_SOUTH = False + HAS_REPORTING = False def _rpc_call(method): @@ -48,8 +51,8 @@ class Reporting(Statistics, Threaded, PullSource): self.whoami = platform.node() self.transport = None - if not HAS_SOUTH: - msg = "Django south is required for Reporting" + if not HAS_REPORTING: + msg = "Django 1.7+ or Django south is required for Reporting" self.logger.error(msg) raise PluginInitError(msg) diff --git a/src/lib/Bcfg2/Server/Plugins/SSHbase.py b/src/lib/Bcfg2/Server/Plugins/SSHbase.py index 7736bd050..7f20e72eb 100644 --- a/src/lib/Bcfg2/Server/Plugins/SSHbase.py +++ b/src/lib/Bcfg2/Server/Plugins/SSHbase.py @@ -286,6 +286,10 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin, self.debug_log("New public key %s; invalidating " "ssh_known_hosts cache" % event.filename) self.skn = False + + if self.core.metadata_cache_mode in ['cautious', + 'aggressive']: + self.core.metadata_cache.expire() return if event.filename == 'info.xml': diff --git a/src/lib/Bcfg2/Server/Plugins/TemplateHelper.py b/src/lib/Bcfg2/Server/Plugins/TemplateHelper.py index b0b8d0061..ff67571fa 100644 --- a/src/lib/Bcfg2/Server/Plugins/TemplateHelper.py +++ b/src/lib/Bcfg2/Server/Plugins/TemplateHelper.py @@ -15,9 +15,10 @@ MODULE_RE = re.compile(r'(?P<filename>(?P<module>[^\/]+)\.py)$') class HelperModule(Debuggable): """ Representation of a TemplateHelper module """ - def __init__(self, name): + def __init__(self, name, core): Debuggable.__init__(self) self.name = name + self.core = core #: The name of the module as used by get_additional_data(). #: the name of the file with .py stripped off. @@ -44,6 +45,10 @@ class HelperModule(Debuggable): if event and event.code2str() not in ['exists', 'changed', 'created']: return + # expire the metadata cache, because the module might have changed + if self.core.metadata_cache_mode in ['cautious', 'aggressive']: + self.core.metadata_cache.expire() + try: module = imp.load_source( safe_module_name('TemplateHelper', self._module_name), @@ -101,7 +106,6 @@ class TemplateHelper(Plugin, Connector, DirectoryBacked, TemplateDataProvider): __author__ = 'chris.a.st.pierre@gmail.com' ignore = re.compile(r'^(\.#.*|.*~|\..*\.(sw[px])|.*\.py[co])$') patterns = MODULE_RE - __child__ = HelperModule def __init__(self, core): Plugin.__init__(self, core) @@ -109,6 +113,10 @@ class TemplateHelper(Plugin, Connector, DirectoryBacked, TemplateDataProvider): DirectoryBacked.__init__(self, self.data) TemplateDataProvider.__init__(self) + # The HelperModule needs access to the core, so we have to construct + # it manually and add the custom argument. + self.__child__ = lambda fname: HelperModule(fname, core) + def get_additional_data(self, _): return dict([(h._module_name, h) # pylint: disable=W0212 for h in self.entries.values()]) diff --git a/src/lib/Bcfg2/Server/Reports/reports/models.py b/src/lib/Bcfg2/Server/Reports/reports/models.py index ac4c8eac4..67aa425d9 100644 --- a/src/lib/Bcfg2/Server/Reports/reports/models.py +++ b/src/lib/Bcfg2/Server/Reports/reports/models.py @@ -266,7 +266,7 @@ class Reason(models.Model): current_to = models.CharField(max_length=1024, blank=True) version = models.CharField(max_length=1024, blank=True) current_version = models.CharField(max_length=1024, blank=True) - current_exists = models.BooleanField() # False means its missing. Default True + current_exists = models.BooleanField(default=True) # False means its missing. current_diff = models.TextField(max_length=1024*1024, blank=True) is_binary = models.BooleanField(default=False) is_sensitive = models.BooleanField(default=False) diff --git a/src/lib/Bcfg2/Server/Reports/updatefix.py b/src/lib/Bcfg2/Server/Reports/updatefix.py index 91c370994..09b218464 100644 --- a/src/lib/Bcfg2/Server/Reports/updatefix.py +++ b/src/lib/Bcfg2/Server/Reports/updatefix.py @@ -4,7 +4,7 @@ import django.core.management import sys import logging import traceback -from Bcfg2.Server.models import InternalDatabaseVersion +from Bcfg2.Server.models import internal_database_version logger = logging.getLogger('Bcfg2.Server.Reports.UpdateFix') @@ -138,7 +138,7 @@ def rollupdate(current_version): exc_info=1) # since array start at 0 but version start at 1 # we add 1 to the normal count - ret = InternalDatabaseVersion.objects.create(version=i + 1) + ret = internal_database_version().create(version=i + 1) return ret else: return None @@ -149,10 +149,10 @@ def update_database(): try: logger.debug("Running upgrade of models to the new one") django.core.management.call_command("syncdb", interactive=False, verbosity=0) - know_version = InternalDatabaseVersion.objects.order_by('-version') + know_version = internal_database_version().order_by('-version') if not know_version: logger.debug("No version, creating initial version") - know_version = InternalDatabaseVersion.objects.create(version=lastversion) + know_version = internal_database_version().create(version=lastversion) else: know_version = know_version[0] logger.debug("Presently at %s" % know_version) diff --git a/src/lib/Bcfg2/Server/models.py b/src/lib/Bcfg2/Server/models.py index 8d6642a25..9c0153c74 100644 --- a/src/lib/Bcfg2/Server/models.py +++ b/src/lib/Bcfg2/Server/models.py @@ -8,6 +8,7 @@ import Bcfg2.Server.Plugins LOGGER = logging.getLogger(__name__) MODELS = [] +INTERNAL_DATABASE_VERSION = None class _OptionContainer(object): @@ -56,15 +57,23 @@ def load_models(plugins=None): setattr(sys.modules[__name__], sym, obj) MODELS.append(sym) - class InternalDatabaseVersion(models.Model): - """ Object that tell us to which version the database is """ - version = models.IntegerField() - updated = models.DateTimeField(auto_now_add=True) +def internal_database_version(): + global INTERNAL_DATABASE_VERSION - def __str__(self): - return "version %d updated %s" % (self.version, - self.updated.isoformat()) + if INTERNAL_DATABASE_VERSION is None: + from django.db import models + class InternalDatabaseVersion(models.Model): + """ Object that tell us to which version the database is """ + version = models.IntegerField() + updated = models.DateTimeField(auto_now_add=True) - class Meta: # pylint: disable=C0111,W0232 - app_label = "reports" - get_latest_by = "version" + def __str__(self): + return "version %d updated %s" % (self.version, + self.updated.isoformat()) + + class Meta: # pylint: disable=C0111,W0232 + app_label = "reports" + get_latest_by = "version" + INTERNAL_DATABASE_VERSION = InternalDatabaseVersion + + return INTERNAL_DATABASE_VERSION.objects diff --git a/src/lib/Bcfg2/manage.py b/src/lib/Bcfg2/manage.py index 3e4eedc9f..f88233133 100755 --- a/src/lib/Bcfg2/manage.py +++ b/src/lib/Bcfg2/manage.py @@ -1,14 +1,23 @@ #!/usr/bin/env python -from django.core.management import execute_manager -import imp -try: - imp.find_module('settings') # Assumed to be in the same directory. -except ImportError: - import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__) - sys.exit(1) +import os +import sys +import django +import Bcfg2.Options +import Bcfg2.DBSettings -import settings +Bcfg2.Options.get_parser().parse() + +if django.VERSION[0] == 1 and django.VERSION[1] <= 6: + try: + imp.find_module('settings') # Assumed to be in the same directory. + except ImportError: + import sys + sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__) + sys.exit(1) if __name__ == "__main__": - execute_manager(settings) + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + from django.core.management import execute_from_command_line + execute_from_command_line(sys.argv) + else: + execute_manager(settings) |