added some protection against potential error cases if grokerSubdomain isn't properly set

This commit is contained in:
David Sulpy
2015-09-14 17:45:04 -05:00
parent 61d2aac45a
commit 6eac6affcf

View File

@@ -248,6 +248,9 @@ def updated() {
if (atomicState.eventBuffer == null) {
atomicState.eventBuffer = []
}
if (atomicState.grokerSubdomain == null || atomicState.grokerSubdomain == "") {
atomicState.grokerSubdomain = "groker"
}
subscribeToEvents()
@@ -260,6 +263,11 @@ def uninstalled() {
def tryCreateBucket() {
// can't ship events if there is no grokerSubdomain
if (atomicState.grokerSubdomain == null || atomicState.grokerSubdomain == "") {
return
}
// if the bucket has already been created, no need to continue
if (atomicState.isBucketCreated) {
return
@@ -346,6 +354,10 @@ def eventHandler(name, value) {
// a helper function for shipping the atomicState.eventBuffer to Initial State
def tryShipEvents() {
// can't ship events if there is no grokerSubdomain
if (atomicState.grokerSubdomain == null || atomicState.grokerSubdomain == "") {
return
}
// can't ship if access key and bucket key are null, so finish trying
if (atomicState.accessKey == null || atomicState.bucketKey == null) {
return