mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Explicitly continue if new encryption is already being used.
This commit is contained in:
@@ -15,11 +15,10 @@ def _notification_templates(apps):
|
|||||||
for nt in NotificationTemplate.objects.all():
|
for nt in NotificationTemplate.objects.all():
|
||||||
for field in filter(lambda x: nt.notification_class.init_parameters[x]['type'] == "password",
|
for field in filter(lambda x: nt.notification_class.init_parameters[x]['type'] == "password",
|
||||||
nt.notification_class.init_parameters):
|
nt.notification_class.init_parameters):
|
||||||
try:
|
if nt.notification_configuration[field].startswith('$encrypted$AESCBC4'):
|
||||||
value = decrypt_field(nt, 'notification_configuration', subfield=field)
|
|
||||||
nt.notification_configuration[field] = value
|
|
||||||
except ValueError:
|
|
||||||
continue
|
continue
|
||||||
|
value = decrypt_field(nt, 'notification_configuration', subfield=field)
|
||||||
|
nt.notification_configuration[field] = value
|
||||||
nt.save()
|
nt.save()
|
||||||
|
|
||||||
|
|
||||||
@@ -28,11 +27,11 @@ def _credentials(apps):
|
|||||||
for credential in Credential.objects.all():
|
for credential in Credential.objects.all():
|
||||||
for field_name, value in credential.inputs.items():
|
for field_name, value in credential.inputs.items():
|
||||||
if field_name in credential.credential_type.secret_fields:
|
if field_name in credential.credential_type.secret_fields:
|
||||||
try:
|
value = getattr(credential, field_name)
|
||||||
value = decrypt_field(credential, field_name)
|
if value.startswith('$encrypted$AESCBC$'):
|
||||||
credential.inputs[field_name] = value
|
|
||||||
except ValueError:
|
|
||||||
continue
|
continue
|
||||||
|
value = decrypt_field(credential, field_name)
|
||||||
|
credential.inputs[field_name] = value
|
||||||
credential.save()
|
credential.save()
|
||||||
|
|
||||||
|
|
||||||
@@ -40,9 +39,8 @@ def _unified_jobs(apps):
|
|||||||
UnifiedJob = apps.get_model('main', 'UnifiedJob')
|
UnifiedJob = apps.get_model('main', 'UnifiedJob')
|
||||||
for uj in UnifiedJob.objects.all():
|
for uj in UnifiedJob.objects.all():
|
||||||
if uj.start_args is not None:
|
if uj.start_args is not None:
|
||||||
try:
|
if uj.start_args.startswith('$encrypted$AESCBC$'):
|
||||||
start_args = decrypt_field(uj, 'start_args')
|
|
||||||
uj.start_args = start_args
|
|
||||||
uj.save()
|
|
||||||
except ValueError:
|
|
||||||
continue
|
continue
|
||||||
|
start_args = decrypt_field(uj, 'start_args')
|
||||||
|
uj.start_args = start_args
|
||||||
|
uj.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user