mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
Add migration and restore Credential logic
This commit is contained in:
@@ -159,4 +159,69 @@ class Migration(migrations.Migration):
|
|||||||
name='allow_simultaneous',
|
name='allow_simultaneous',
|
||||||
field=models.BooleanField(default=False),
|
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
|
return field in self.credential_type.askable_fields
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
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
|
self.PASSWORD_FIELDS = self.credential_type.secret_fields
|
||||||
|
|
||||||
if self.pk:
|
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
|
# Look up the currently persisted value so that we can replace
|
||||||
# $encrypted$ with the actual DB-backed value
|
# $encrypted$ with the actual DB-backed value
|
||||||
for field in self.PASSWORD_FIELDS:
|
for field in self.PASSWORD_FIELDS:
|
||||||
|
|||||||
Reference in New Issue
Block a user