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(mahe): check property structure on cleanup #1752

Merged
merged 1 commit into from
Oct 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class FastPropertyCleanupListener implements ExecutionListener {
break
case PropertyAction.UPDATE.toString():
stage.context.originalProperties.each { Map originalProp ->
Map property = originalProp.property
Map property = originalProp.property ?: originalProp
Map updatedProperty = (Map) stage.context.persistedProperties.find { it.propertyId == property.propertyId }
String propertyId = property.propertyId
if (shouldRollback(updatedProperty)) {
Expand All @@ -84,8 +84,8 @@ class FastPropertyCleanupListener implements ExecutionListener {
}
break
case PropertyAction.DELETE.toString():
stage.context.originalProperties.each { Map prop ->
Map property = prop.property
stage.context.originalProperties.each { Map originalProp ->
Map property = originalProp.property ?: originalProp
if (propertyExists(property)) {
log.info("Property ${property.propertyId} exists, not restoring to original state after delete.")
} else {
Expand All @@ -94,7 +94,7 @@ class FastPropertyCleanupListener implements ExecutionListener {
}
log.info("Rolling back the delete of: ${property.key}|${property.value} on execution ${execution.id} by re-creating")

Response response = mahe.upsertProperty(prop)
Response response = mahe.upsertProperty(originalProp)
resolveRollbackResponse(response, stage.context.propertyAction.toString(), property)
}
}
Expand All @@ -111,7 +111,7 @@ class FastPropertyCleanupListener implements ExecutionListener {
Response propertyResponse = mahe.getPropertyById(propertyId, env)
Map currentProperty = mapper.readValue(propertyResponse.body.in().text, Map)
return currentProperty.property.ts == property.ts
}, 3, 2, false)
}, 3, 2000, false)
} catch (RetrofitError error) {
if (error.response.status == 404) {
return false
Expand Down