gordon
gordon copied to clipboard
Unable to use parameter reference for memory setting
If I have a parameters file called dev.yml with:
---
stageMemory: 128
and then a settings file for an application with
---
lambdas:
helloworld:
code: helloworld
handler: code.handler
runtime: python
memory: ref://stageMemory
Then I get
user@machine:~/code/test4/demo$ gordon build
Loading project resources
Loading installed applications
contrib_lambdas:
✓ lambdas:version
firstapp:
✓ lambdas:helloworld
Building project...
0001_p.json
0002_pr_r.json
Traceback (most recent call last):
File "/usr/local/bin/gordon", line 9, in <module>
load_entry_point('gordon==0.2.1', 'console_scripts', 'gordon')()
File "/usr/local/lib/python2.7/dist-packages/gordon/bin.py", line 106, in main
getattr(obj, options.func)()
File "/usr/local/lib/python2.7/dist-packages/gordon/core.py", line 243, in build
self._build_resources_template()
File "/usr/local/lib/python2.7/dist-packages/gordon/core.py", line 334, in _build_resources_template
r.register_resources_template(template)
File "/usr/local/lib/python2.7/dist-packages/gordon/resources/lambdas.py", line 275, in register_resources_template
MemorySize=self.get_memory(),
File "/usr/local/lib/python2.7/dist-packages/gordon/resources/lambdas.py", line 68, in get_memory
memory = int(self.settings.get('memory', 128))
TypeError: int() argument must be a string or a number, not 'Ref'
This is because int() is being called at build time but references are set as parameters at deploy time, and you can't call int() on the reference type.
The documentation here seems to indicate it works as a reference: https://gordon.readthedocs.io/en/latest/lambdas.html#memory
Either the doc needs updating if this isn't supported or the int() needs to be called at deploy time as a check.
I realise now that parameters can't contain underscores, but that doesn't affect this particular case