mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 06:51:10 +03:00
Add migration and restore Credential logic
This commit is contained in:
parent
11eb99820d
commit
dd52e2be30
@ -159,4 +159,69 @@ class Migration(migrations.Migration):
|
||||
name='allow_simultaneous',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
|
||||
# Permission and Deprecated Field Removal
|
||||
migrations.RemoveField(
|
||||
model_name='permission',
|
||||
name='created_by',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='permission',
|
||||
name='inventory',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='permission',
|
||||
name='modified_by',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='permission',
|
||||
name='project',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='permission',
|
||||
name='tags',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='permission',
|
||||
name='team',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='permission',
|
||||
name='user',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='activitystream',
|
||||
name='permission',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='credential',
|
||||
name='deprecated_team',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='credential',
|
||||
name='deprecated_user',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='organization',
|
||||
name='deprecated_admins',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='organization',
|
||||
name='deprecated_projects',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='organization',
|
||||
name='deprecated_users',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='team',
|
||||
name='deprecated_projects',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='team',
|
||||
name='deprecated_users',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='Permission',
|
||||
),
|
||||
]
|
||||
|
@ -379,12 +379,11 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
|
||||
return field in self.credential_type.askable_fields
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
inputs_before = {}
|
||||
# If update_fields has been specified, add our field names to it,
|
||||
# if hit hasn't been specified, then we're just doing a normal save.
|
||||
self.PASSWORD_FIELDS = self.credential_type.secret_fields
|
||||
|
||||
if self.pk:
|
||||
cred_before = Credential.objects.get(pk=self.pk)
|
||||
inputs_before = cred_before.inputs
|
||||
# Look up the currently persisted value so that we can replace
|
||||
# $encrypted$ with the actual DB-backed value
|
||||
for field in self.PASSWORD_FIELDS:
|
||||
|
Loading…
Reference in New Issue
Block a user