BryanDavis has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/364138 )
Change subject: Tools LDAP model migrations ...................................................................... Tools LDAP model migrations Django really wants to manage all the models it can find. This doesn't work out very well with the LDAP backend so we need to remember to mark LDAP models as unmanaged. I'm not really sure why they don't do this in the base class. Even when marked as unmanaged Django wants to have a no-op migration that tell it that the models exist. Change-Id: Ie38d4fabb275665837ad23e5cdf0e05f07a8a14c --- A striker/tools/migrations/0008_ldap_models.py M striker/tools/models.py 2 files changed, 78 insertions(+), 0 deletions(-) Approvals: BryanDavis: Looks good to me, approved jenkins-bot: Verified diff --git a/striker/tools/migrations/0008_ldap_models.py b/striker/tools/migrations/0008_ldap_models.py new file mode 100644 index 0000000..e608b06 --- /dev/null +++ b/striker/tools/migrations/0008_ldap_models.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import ldapdb.models.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('tools', '0007_toolinfo_tags'), + ] + + operations = [ + migrations.CreateModel( + # Unmanaged model. This won't actually apply when you run the + # migration. There's no way to convince Django not to generate + # these migrations in the first place. + name='SudoRole', + fields=[ + ('dn', models.CharField(primary_key=True, serialize=False, max_length=200)), + ('cn', ldapdb.models.fields.CharField(primary_key=True, db_column='cn', serialize=False, max_length=200)), + ('users', ldapdb.models.fields.ListField(db_column='sudoUser')), + ('hosts', ldapdb.models.fields.ListField(db_column='sudoHost')), + ('commands', ldapdb.models.fields.ListField(db_column='sudoCommand')), + ('options', ldapdb.models.fields.ListField(db_column='sudoOption')), + ('runas_users', ldapdb.models.fields.ListField(db_column='sudoRunAsUser')), + ], + options={ + 'managed': False, + }, + ), + migrations.CreateModel( + # Unmanaged model. This won't actually apply when you run the + # migration. There's no way to convince Django not to generate + # these migrations in the first place. + name='ToolUser', + fields=[ + ('dn', models.CharField(primary_key=True, serialize=False, max_length=200)), + ('uid', ldapdb.models.fields.CharField(primary_key=True, db_column='uid', serialize=False, max_length=200)), + ('cn', ldapdb.models.fields.CharField(db_column='cn', unique=True, max_length=200)), + ('sn', ldapdb.models.fields.CharField(db_column='sn', unique=True, max_length=200)), + ('uid_number', ldapdb.models.fields.IntegerField(db_column='uidNumber', unique=True)), + ('gid_number', ldapdb.models.fields.IntegerField(db_column='gidNumber')), + ('home_directory', ldapdb.models.fields.CharField(db_column='homeDirectory', max_length=200)), + ('login_shell', ldapdb.models.fields.CharField(db_column='loginShell', max_length=64)), + ], + options={ + 'managed': False, + }, + ), + migrations.AlterModelOptions( + # Unmanaged model. This won't actually apply when you run the + # migration. There's no way to convince Django not to generate + # these migrations in the first place. + name='maintainer', + options={'managed': False}, + ), + migrations.AlterModelOptions( + # Unmanaged model. This won't actually apply when you run the + # migration. There's no way to convince Django not to generate + # these migrations in the first place. + name='tool', + options={'managed': False}, + ), + ] diff --git a/striker/tools/models.py b/striker/tools/models.py index 3feae27..9384b12 100644 --- a/striker/tools/models.py +++ b/striker/tools/models.py @@ -60,6 +60,9 @@ objects = MaintainerManager() + class Meta: + managed = False + def __str__(self): return self.username @@ -80,6 +83,9 @@ cn = fields.CharField(db_column='cn', max_length=200, primary_key=True) gid_number = fields.IntegerField(db_column='gidNumber', unique=True) members = fields.ListField(db_column='member') + + class Meta: + managed = False @property def name(self): @@ -142,6 +148,9 @@ db_column='homeDirectory', max_length=200) login_shell = fields.CharField(db_column='loginShell', max_length=64) + class Meta: + managed = False + @property def name(self): return self.cn[6:] @@ -165,6 +174,9 @@ options = fields.ListField(db_column='sudoOption') runas_users = fields.ListField(db_column='sudoRunAsUser') + class Meta: + managed = False + def __str__(self): return 'cn=%s,%s' % (self.cn, self.base_dn) -- To view, visit https://gerrit.wikimedia.org/r/364138 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie38d4fabb275665837ad23e5cdf0e05f07a8a14c Gerrit-PatchSet: 2 Gerrit-Project: labs/striker Gerrit-Branch: master Gerrit-Owner: BryanDavis <bda...@wikimedia.org> Gerrit-Reviewer: Andrew Bogott <abog...@wikimedia.org> Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org> Gerrit-Reviewer: Madhuvishy <mviswanat...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits