Bug #2954

I'm unable to update template which contains "Custom vars" with apostrophe (CONTEXT)

Added by Anonymous about 7 years ago. Updated about 7 years ago.

Status:ClosedStart date:05/28/2014
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Sunstone
Target version:Release 4.8
Resolution:fixed Pull request:
Affected Versions:OpenNebula 4.6

Description

Hello.

I have a problem with updating the template which contains "Cuctom vars" like: $NETWORK[ NETWORK_ADDRESS, NETWORK="Internal Network" ]

If I create the following template:

NAME=test123
cat > /var/tmp/${NAME}_win7_vnc.conf << EOF
NAME = "${NAME} - Windows 7 64-bit"
CPU = 1.0
VCPU = 2
MEMORY = 1024
FEATURES = [ LOCALTIME = "yes" ]
DISK = [ IMAGE = "${NAME} - Win7 Disk (15G)", IMAGE_UNAME="admin" ]
NIC = [ NETWORK="Internal Network", MODEL= "virtio", NETWORK_UNAME="admin" ]
GRAPHICS = [ TYPE="vnc", LISTEN = "0.0.0.0" ]
INPUT = [TYPE=tablet, BUS=usb]
CONTEXT = [
NETWORK = "YES",
FILES_DS = "\$FILE[IMAGE=\"context.ps1\"] \$FILE[IMAGE=\"admin_run_first_as_normal_user.bat\"]",
SET_HOSTNAME = "-${NAME}.example.com",
DNS = "\$NETWORK[ DNS, NETWORK=\"Internal Network\" ]",
ETH0_IP = "1.1.1.1",
ETH0_MASK = "\$NETWORK[ NETWORK_MASK, NETWORK=\"Internal Network\" ]",
ETH0_NETWORK = "\$NETWORK[ NETWORK_ADDRESS, NETWORK=\"Internal Network\" ]",
ETH0_GATEWAY = "\$NETWORK[ GATEWAY, NETWORK=\"Internal Network\" ]",
INIT_SCRIPTS = "admin_run_first_as_normal_user.bat"
]
EOF
onetemplate create /var/tmp/${NAME}_win7_vnc.conf

The template is successfully created and working fine. If I want to update it using the WebGUI - I got the following error:

[TemplateUpdateTemplate] Cannot update template. Parse error: syntax error, unexpected VARIABLE, expecting COMMA or CBRACKET at line 15, columns 238:246

The problem is the web GUI is changing the \" into " and it's not possible to update it properly (see the attached screenshot scr1.png). If I manually put change the " into \" (attached scr2.png) then I'm able to update it properly.

I'm using the latest stable opennebula 4.6.1:

# rpm -qa | grep sunstone
opennebula-sunstone-4.6.1-1.x86_64

Thanks for checking it.

PetrR

scr2.png (37.3 KB) Anonymous, 05/28/2014 11:44 AM

scr1.png (50.7 KB) Anonymous, 05/28/2014 11:44 AM

History

#1 Updated by Ruben S. Montero about 7 years ago

  • Status changed from Pending to New
  • Target version set to Release 4.8

#2 Updated by Anonymous about 7 years ago

This issue has been fixed in 4.6.2

Thank you

PetrR

#3 Updated by Ruben S. Montero about 7 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

Also available in: Atom PDF