Skip to content

Commit

Permalink
added some protection against potential error cases if grokerSubdomai…
Browse files Browse the repository at this point in the history
…n isn't properly set
  • Loading branch information
davidsulpy committed Sep 14, 2015
1 parent 61d2aac commit 6eac6af
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ def updated() {
if (atomicState.eventBuffer == null) {
atomicState.eventBuffer = []
}
if (atomicState.grokerSubdomain == null || atomicState.grokerSubdomain == "") {
atomicState.grokerSubdomain = "groker"
}

subscribeToEvents()

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6eac6af

Please sign in to comment.