There are a few bugs I found while using the python create rstudio script:
If you have multiple stage files (or just any files that end with .yml or .yaml), the script loops through all of them and arbitrarily uses the last one as the fileName later on. If your stage file is not the last one alphabetically, this will cause issues.
The script assumes the user will be using the default AWS profile even though the configuration file and stage file asks for the AWS Profile name and region. We should use the values from the file to account for the case that the user is not using the default profile.
The check on stack status is broken. The second if statement in describeStack would always evaluated to true with how the conditions were listed. In the weird case that the stack is not yet in create_complete state when that method is called, the second if statement would trigger the deleting of that stack. If the stack was still in create_in_progress, this would try to delete the stack before it has finished, which should fail.
After changing the script, I tested that:
packer still works with additional stageName parameter in configuration.json
script found the right stage file even if it is not the first in the directory tree
script found the right stage file even if it is not the last in the directory tree
script successfully failed when there is not stage file that matches the stageName parameter provided in the configuration.json file
script creates resources in the proper AWS account and region with setting the session profile name and region from the configuration.json file
(before changes, I tested that) the second describeStackif statement always did evaluate to true
the new second if in describeStack does only evaluate to true if the status is one of the states that is supposed to trigger the delete stack method.
There are a few bugs I found while using the python create rstudio script:
.yml
or.yaml
), the script loops through all of them and arbitrarily uses the last one as thefileName
later on. If your stage file is not the last one alphabetically, this will cause issues.if
statement indescribeStack
would always evaluated to true with how the conditions were listed. In the weird case that the stack is not yet increate_complete
state when that method is called, the second if statement would trigger the deleting of that stack. If the stack was still increate_in_progress
, this would try to delete the stack before it has finished, which should fail.After changing the script, I tested that:
stageName
parameter inconfiguration.json
stageName
parameter provided in theconfiguration.json
fileconfiguration.json
filedescribeStack
if
statement always did evaluate to trueif
indescribeStack
does only evaluate to true if the status is one of the states that is supposed to trigger the delete stack method.