diff --git a/apps/assets/migrations/0090_auto_20220412_1145.py b/apps/assets/migrations/0090_auto_20220412_1145.py index c2cb879aa..434b7b3cf 100644 --- a/apps/assets/migrations/0090_auto_20220412_1145.py +++ b/apps/assets/migrations/0090_auto_20220412_1145.py @@ -3,6 +3,20 @@ from django.db import migrations, models +def create_internal_platform(apps, schema_editor): + model = apps.get_model("assets", "Platform") + db_alias = schema_editor.connection.alias + type_platforms = ( + ('AIX', 'Unix', None), + ) + for name, base, meta in type_platforms: + defaults = {'name': name, 'base': base, 'meta': meta, 'internal': True} + model.objects.using(db_alias).update_or_create( + name=name, defaults=defaults + ) + migrations.RunPython(create_internal_platform) + + class Migration(migrations.Migration): dependencies = [ @@ -15,4 +29,5 @@ class Migration(migrations.Migration): name='number', field=models.CharField(blank=True, max_length=128, null=True, verbose_name='Asset number'), ), + migrations.RunPython(create_internal_platform) ] diff --git a/apps/assets/models/asset.py b/apps/assets/models/asset.py index 7d46a4b25..7dde0862f 100644 --- a/apps/assets/models/asset.py +++ b/apps/assets/models/asset.py @@ -142,10 +142,6 @@ class Platform(models.Model): internal = models.BooleanField(default=False, verbose_name=_("Internal")) comment = models.TextField(blank=True, null=True, verbose_name=_("Comment")) - @property - def algorithm(self): - return self.meta.get('algorithm') - @classmethod def default(cls): linux, created = cls.objects.get_or_create( diff --git a/apps/assets/tasks/push_system_user.py b/apps/assets/tasks/push_system_user.py index 46734e4be..98d2a0922 100644 --- a/apps/assets/tasks/push_system_user.py +++ b/apps/assets/tasks/push_system_user.py @@ -244,7 +244,7 @@ def push_system_user_util(system_user, assets, task_name, username=None): for u in usernames: for a in _assets: system_user.load_asset_special_auth(a, u) - algorithm = a.platform.algorithm + algorithm = 'des' if a.platform.name == 'AIX' else 'sha512' tasks = get_push_system_user_tasks( system_user, platform, username=u, algorithm=algorithm