From 5da39592f00ba5b1dc766f4d0b7a0d42b987c239 Mon Sep 17 00:00:00 2001 From: Justin Field Date: Fri, 25 Jan 2019 14:40:32 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20Trim=20whitespace=20when=20restoring=20d?= =?UTF-8?q?ata=20that=20is=20potentially=20created=20=E2=80=A6=20(#184)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Trim whitespace when restoring data that is potentially created from before we removed whitespace from the db via an upgrade script, and add another upgrade script to remove any whitespace that snuck in. * Update gradle.properties --- gradle.properties | 2 +- src/main/java/com/nike/cerberus/service/MetadataService.java | 2 +- ...remove_trailing_whitespace_from_iam_principal_arns_again.sql | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/com/nike/cerberus/migration/V1.6.4.0__remove_trailing_whitespace_from_iam_principal_arns_again.sql diff --git a/gradle.properties b/gradle.properties index 32f581546..46917a88a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,6 +14,6 @@ # limitations under the License. # -version=3.25.2 +version=3.25.3 groupId=com.nike.cerberus artifactId=cms diff --git a/src/main/java/com/nike/cerberus/service/MetadataService.java b/src/main/java/com/nike/cerberus/service/MetadataService.java index a5e97305f..9a788a546 100644 --- a/src/main/java/com/nike/cerberus/service/MetadataService.java +++ b/src/main/java/com/nike/cerberus/service/MetadataService.java @@ -108,7 +108,7 @@ private Set getIamPrincipalPermissionSet(SDBMetadata sdb sdbMetadata.getIamRolePermissions().forEach((iamPrincipalArn, roleName) -> { iamPrincipalPermissionSet.add(new IamPrincipalPermission() - .withIamPrincipalArn(iamPrincipalArn) + .withIamPrincipalArn(iamPrincipalArn.trim()) .withRoleId(getRoleIdFromName(roleName)) ); }); diff --git a/src/main/resources/com/nike/cerberus/migration/V1.6.4.0__remove_trailing_whitespace_from_iam_principal_arns_again.sql b/src/main/resources/com/nike/cerberus/migration/V1.6.4.0__remove_trailing_whitespace_from_iam_principal_arns_again.sql new file mode 100644 index 000000000..152f98749 --- /dev/null +++ b/src/main/resources/com/nike/cerberus/migration/V1.6.4.0__remove_trailing_whitespace_from_iam_principal_arns_again.sql @@ -0,0 +1 @@ +UPDATE AWS_IAM_ROLE set AWS_IAM_ROLE_ARN = TRIM(AWS_IAM_ROLE_ARN); \ No newline at end of file