Skip to content

Commit f6a56b3

Browse files
author
Frederic Dewinne
committed
fix infinite loop issue
1 parent 59c85bb commit f6a56b3

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/Aws/Task/CloudFormation/RunStackTask.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,12 @@ public function main()
191191
// update
192192
$cloudFormation->updateStack($stackProperties);
193193
} catch (CloudFormationException $e) {
194-
if ($this->getUpdateOnConflict()) {
195-
$cloudFormation->createStack($stackProperties);
196-
} else {
197-
throw new \BuildException('Stack ' . $this->getName() . ' already exists!');
194+
if ($e->getMessage() != 'No updates are to be performed.') {
195+
if ($this->getUpdateOnConflict()) {
196+
$cloudFormation->createStack($stackProperties);
197+
} else {
198+
throw new \BuildException('Stack ' . $this->getName() . ' already exists!');
199+
}
198200
}
199201
}
200202

@@ -211,7 +213,8 @@ protected function stackIsReady()
211213
->describeStacks([
212214
'StackName' => $this->getName()
213215
]);
214-
switch ($stack['Stack']['StackStatus']) {
216+
217+
switch ($stack['Stacks'][0]['StackStatus']) {
215218
case 'CREATE_COMPLETE':
216219
case 'UPDATE_COMPLETE':
217220
case 'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS':
@@ -221,7 +224,7 @@ protected function stackIsReady()
221224
case 'CREATE_IN_PROGRESS':
222225
return false;
223226
default:
224-
throw new \BuildException('Failed to run stack ' . $this->getName() . ' (' . $stack['Stack']['StackStatus'] . ') !');
227+
throw new \BuildException('Failed to run stack ' . $this->getName() . ' (' . $stack['Stacks'][0]['StackStatus'] . ') !');
225228
}
226229
} catch (CloudFormationException $e) {
227230
return false;
@@ -245,4 +248,4 @@ protected function validate() {
245248

246249
}
247250

248-
}
251+
}

0 commit comments

Comments
 (0)