Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): prevent app permissions from being lost during an app upse… #2217

Merged
merged 1 commit into from
May 8, 2018

Conversation

danielpeach
Copy link
Contributor

…rt operation

@danielpeach danielpeach requested review from lwander and ttomsu May 7, 2018 21:11
@@ -44,10 +45,15 @@ class UpsertApplicationTask extends AbstractFront50Task {
} else {
log.info("Creating application (name: ${application.name})")
front50Service.create(application)
if (application?.permission?.permissions == null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably groovify this with if (!application?.permission?.permissions)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want this condition to be true for an empty map - null should mean no change to the permissions, whereas [:] should mean an empty set of permissions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll also be true if application or permission are null when written like this -- is that intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for permission, no for application, so I'll take out the null check for application.

}

try {
front50Service.updatePermission(application.name, application.permission)
if (application?.permission?.permissions != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar here to above

@danielpeach danielpeach force-pushed the fix-app-upsert branch 2 times, most recently from 548ba3d to bf987e9 Compare May 8, 2018 13:11
@ttomsu
Copy link
Member

ttomsu commented May 8, 2018

LGTM

@danielpeach danielpeach merged commit 8a5674d into spinnaker:master May 8, 2018
@danielpeach danielpeach deleted the fix-app-upsert branch May 8, 2018 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants