From c554c10c5c5df8dbae5fef75e2f83ae814e1f2d2 Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Thu, 15 Jun 2017 11:08:22 -0400 Subject: [PATCH] remove credential_type iteration, explicitly check for encyption with startswith --- awx/main/migrations/_reencrypt.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/awx/main/migrations/_reencrypt.py b/awx/main/migrations/_reencrypt.py index 2aa1d2fbb0..39b00d85e3 100644 --- a/awx/main/migrations/_reencrypt.py +++ b/awx/main/migrations/_reencrypt.py @@ -32,13 +32,11 @@ def _credentials(apps): utils.get_current_apps = lambda: apps for credential in apps.get_model('main', 'Credential').objects.all(): for field_name, value in credential.inputs.items(): - if field_name in credential.credential_type.inputs.get('fields', []): - value = getattr(credential, field_name) - if value.startswith('$encrypted$AESCBC$'): - continue - elif value.startswith('$encrypted$AES$'): - value = decrypt_field(credential, field_name) - credential.inputs[field_name] = value + if value.startswith('$encrypted$AESCBC$'): + continue + elif value.startswith('$encrypted$AES$'): + value = decrypt_field(credential, field_name) + credential.inputs[field_name] = value credential.save() finally: utils.get_current_apps = orig_current_apps