Bug #980
Context variables cannot support escaped brackets
Status: | Closed | Start date: | 11/11/2011 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | Core & System | |||
Target version: | - | |||
Resolution: | worksforme | Pull request: | ||
Affected Versions: | OpenNebula 3.0 |
Description
I have a custom context script that bootstraps a chef instance. I'm hoping to have it read from a context variable like this:
CONTEXT=[ RUN_LIST="role[base] role[memcached]" ]
But when I save this template, I get the error message [TemplateUpdateTemplate] Can not update template. Parse error: syntax error, unexpected VARIABLE, expecting COMMA or CBRACKET at line 7, columns 688:696.
I tried escaping the square brackets (role\[base\] role\[memcached\]
) but that didn't help.
I understand that I'm stepping perilously close to the template variable syntax for multi-valued variables documented at http://www.opennebula.org/documentation:rel3.0:template, but there should be a way to handle this - either by recognizing I'm not prefixing the variable with a $, or escaping the square brackets explicitly.
History
#1 Updated by Ruben S. Montero over 9 years ago
Hi
Can you post the whole template?. I can not reproduce this one:
NAME = test MEMORY = 128 CPU = 1 CONTEXT = [ RUN_LIST="role[base] role[mem]" ]
This get parsed and gives:
> onevm show 6 VIRTUAL MACHINE 6 INFORMATION ID : 6 NAME : test USER : ruben GROUP : oneadmin STATE : PENDING LCM_STATE : LCM_INIT START TIME : 11/12 00:14:17 END TIME : - DEPLOY ID : - VIRTUAL MACHINE MONITORING USED MEMORY : 0 USED CPU : 0 NET_TX : 0 NET_RX : 0 VIRTUAL MACHINE TEMPLATE CONTEXT=[ RUN_LIST="role[base] role[mem]", TARGET=hdb ] CPU=1 MEMORY=128 NAME=test VMID=6
#2 Updated by Paul Paradise over 9 years ago
My bad, I was missing a comma after that run_list line and got too held up by the CBRACKET comment in the error message. Sorry for the trouble!
#3 Updated by Ruben S. Montero over 9 years ago
- Status changed from New to Closed
- Resolution set to worksforme
no problem, closing this one
#4 Updated by Paul Paradise over 9 years ago
I did notice a related problem that I'm more sure of. When running onetemplate update
on the template, the quotation marks around the value are removed, and if you don't re-add them the template fails to save. Easy workaround, but annoying to have to remember to do each time.
#5 Updated by Ruben S. Montero over 9 years ago
Added a separate issue for that http://dev.opennebula.org/issues/981