realestate-com-au / stackup

a simple CLI and Ruby API for AWS CloudFormation
MIT License
97 stars 34 forks source link

stackup -p errors out when file is not found #66

Closed vinaydigitalsocial closed 4 years ago

vinaydigitalsocial commented 5 years ago

It sounds trivial that the file must exist before using it during an override, but if the stackup command can deal with a missing file then it would be great.

Example - $ stackup myapp-test up -t template.json \ -p defaults.json \ -p overrides.json \ -p filedoesnotexist.json

the above command should not fail

mdub commented 5 years ago

Hmm; I think silently ignoring missing files would be dangerous, and could be the source of surprising bugs. Better to fail fast, IMHO.

I would suggest wrapping your call to stackup with a little bit of script that checks for presence of the file concerned, and selectively adds the extra -p <file> arguments.

vinaydigitalsocial commented 5 years ago

Could you please give an example on this - " selectively adds the extra -p arguments".

I am trying to use it in a make file.

vinaydigitalsocial commented 5 years ago

I was thinking along the lines of overrides := $(shell if [ if [ -f "filenotfound.json" ] ]; then echo "-p defaults.json \ -p overrides.json"; else echo "-p defaults.json \ -p overrides.json \p filedoesnotexist.json"; fi)

stackup echo ${overrides} --- not sure if this syntax works

vinaydigitalsocial commented 5 years ago

stackup $(overrides)... i think is the right syntax... will try it out

mdub commented 5 years ago

Make, huh? Something like this might work:

OPTIONAL_OVERRIDES = $(patsubst %,-p %,$(wildcard extra-overrides.json))

up:
    stackup mystack up -t template.json $(OPTIONAL_OVERRIDES)
ps-jay commented 4 years ago

I don't think this is a bug.

mdub commented 4 years ago

I don't think this is a bug.

Agreed.