Problem updating Contextualisation Custom Vars Key Value containing a $

Hello ,

We upgraded from 5.2.1 to 5.4.13. For some reason it is no longer possible to update the value of a custom key variable if it contains a $-sign.

Steps to reproduce:

  • Poweroff VM,
  • select VM in GUI,
  • select Conf,
  • select Update Configuration button,
  • select Context and Custom vars
  • change the value of any key so it contains a $ sign.

The error eg: SOME_KEY and Some_Value_containing_a_$ :

[one.vm.updateconf] Error parsing: DISK_ID=1@^^@ETH0_CONTEXT_FORCE_IPV4=@^^@ETH0_DNS=x.x.x.x x.x.x.x.@^^@ETH0_GATEWAY=x.x.x.x@^^@ETH0_GATEWAY6=@^^@ETH0_IP=x.x.x.x@^^@ETH0_IP6=@^^@ETH0_IP6_PREFIX_LENGTH=@^^@ETH0_IP6_ULA=@^^@ETH0_MAC=02:00:d9:77:ed:7b@^^@ETH0_MASK=x.x.x.x@^^@ETH0_MTU=@^^@ETH0_NETWORK=x.x.x.x@^^@ETH0_SEARCH_DOMAIN=@^^@ETH0_VLAN_ID=@^^@ETH0_VROUTER_IP=@^^@ETH0_VROUTER_IP6=@^^@ETH0_VROUTER_MANAGEMENT=@^^@NETWORK=YES@^^@SET_HOSTNAME=rolftest@^^@SOME_KEY=Some_Vaulue_containing_a_$@^^@SSH_PUBLIC_KEY=$USER[SSH_PUBLIC_KEY]@^^@TARGET=hda. syntax error, unexpected EOA, expecting $end or VARIABLE or RSTRING at line 32591, columns 528:529

(ip-address redacted)

There is no problem filling the contextualisation with a $ at creation time, only afterwards. In 5.2.1 this was no issue. Not sure if this issue was introduced after 5.4.6.

The customer makes this change thru the XML-RPC API, but the problem is the same.

It seems the $ is also used for a template variable, like .e.g $VMID, is it a restricted char now ?

Any idea ?

Regards,
Rolf

Hello!

This symbol can’t be set at the end, because OpenNebula will try to resolve it like a variable, so that symbol needs to be continued with a name.

Hi Juan,

Unforfunately the $ is not at the end, but occurs somewhere in a string.

Regards,
Rolf

Hello,

I’ve managed to reproduce what you say, but I do not think it’s an OpenNebula problem, the problem is the name of the variable, $-sing, that (-) between the symbol and the word, make it fail, the symbol is not supported (-) after the symbol .

More info

Hello Juan,

Thanks for your input, but that is not exactly the issue either.

E.g. just changing a value from none to none$ or $none or no$ne no longer works is 5.4.13. A $ seems to be a reserved charater now.

This used to work fine in 5.2 and 4.14.

Regards,
Rolf
Root/Echelon

Hello Juan,

I can confirm this issue has been introduced somewhere after 5.4.6.
The issue did not occur in 5.4.6, In that version a -character not continued with a name didn't got interpreted. For instance: file:{karaf.home}/${karaf.default.repository}…

To be exact: the $-character gets interpreted in the CONTEXT attribute values but not in the User Template part.


User template

REMARK = “test$VMID”

Template

CONTEXT = [
REMARK = “test220” <- $VMID gets interpreted when updating the contextualization
…
]


Is the interpreting a new feature after 5.4.6? We can’t find anything about this in the docs.

Any help ?

Regards,

Hi,

We did some more digging, this issue seems to be related to a bug fix in 5.4.10, https://github.com/OpenNebula/one/issues/1774.

It seems that a feature request #4320: “Make variable substitution when updating CONTEXT” was done and introduced on april 22 2016. It looks like this has been introduced in in 5.0, so was already included in 5.2.1

From the code on github:

updateconf_desc = <<-EOT.unindent

Updates the configuration of a VM. The VM cannot be in an active (running)

state, valid states are: pending, failure, poweroff, undeploy, hold or

cloning.

This command accepts a template file or opens an editor, the full list of

configuration attributes are:

OS = [“ARCH”, “MACHINE”, “KERNEL”, “INITRD”, “BOOTLOADER”, “BOOT”]

FEATURES = [“ACPI”, “PAE”, “APIC”, “LOCALTIME”, “HYPERV”, “GUEST_AGENT”]

INPUT = [“TYPE”, “BUS”]

GRAPHICS = [“TYPE”, “LISTEN”, “PASSWD”, “KEYMAP” ]

RAW = [“DATA”, “DATA_VMX”, “TYPE”]

_CONTEXT (any value, variable substitution will be made) _

EOT

However this never seemed to work until it was recently fixed in hotfix 5.4.10.

So this means that when a dollar-sign is included into a variable it automatically tries to do a variable substitution. But this basically makes the dollar-sign unavailable to be used in a variable. Escaping with a \ or a double \ does not seem to work either. Is this intended?

Can anybody confirm our interpretation?

Kind Regards,
Rolf Benneker
Root / Echelon

Hello,

Yes, now the dolar-sign is automatically interpreted to use variables in the templates.

Hi Juan,

Thanks for the confirmation.

But this poses a new issue: the $-sign is now impossible to use in an updated context field. (Sidenote: strange that it still can be used during instantiation, but not updated. This will cause confusion and should probably be fixed as well.)

So we will have to ask for a bug fix annex feature request so that the $-sign can be used again since also it can not be escaped at this moment. It seems currently only a double quote (") can be escaped.

Would you consider this a feature request or a bug fix ? Is there another workaround ?

Regards,
Rolf Benneker

1 Like