Incorrect attribute quotation (works in 4.14, broken in 5.0)

Hello,

I have discovered that my VM templates stopped working when instantiated under ONe 5.0
(they used to work in 4.14 or 4.12). Steps to reproduce:

  • Set the following user attribute:

CRYPTED_PASSWORD=$6$FF6vBSp81IKWPycG$gyanGclUN8mBi0Wyjqf2Oi9uCfBW16H4v.eQg8dn1C2zzg5JfNCsFv6M1NTi8AOJpfqvlq26..xU4VcKaRrJ6/

(not really my password, its cleartext is “opennebula”)

  • use this attribute in the VM template:

    CONTEXT = [
    CRYPTED_PASSWORD = “$USER[CRYPTED_PASSWORD]”,

  • instantiate the template.

In 4.x, the resulting context.sh contained the following assignment:

CRYPTED_PASSWORD='$6$FF6...rJ6/"

In 5.0, there is the following line in context.sh:

CRYPTED_PASSWORD=".eQg8...rJ6/"

Without the leading “$6$...”. I think the reason is that misquoted dollar signs are taken as undefined shell variables. Is it a bug, or is itdocumented somewhere? In any case, the behaviour of 5.0 is different than that of 4.14.

Thanks,

-Yenya

Hi Yenya,

This is in fact a bug, but not related to context parsing itself, but
introduced with the reconfiguration feature. With 5.0 context is generated
every time the VM is booted, so you can capture changes in networking
configuration. The problem is:

1.- When the VM is instantiated (VM in pending) context is generated
correctly CONTEXT = [ CRYPTED_PASSWORD=’$6$FF6…rJ6/", …]
2.- When the VM is booted, the context is regenerated so CRTYPTED_PASSWORD
is parsed again, in this case $6 and $FF6… are treated as variables and
they are empty, so we get CRYPTED_PASSWORD=".eQg8…rJ6/

I’ve filled an issue for this:

http://dev.opennebula.org/issues/4774

THANKS for reporting

Ruben,

thanks for the fast reply. I look forward to the fix, as my users are confused that our preinstalled images do not work for them.

-Yenya

Can you try the following patch, it is for the one-5.0 branch

https://github.com/OpenNebula/one/commit/590805581ac64257f2b58d5e52f9c9e3b1a8755a

Ruben, thanks for the patch. I took the src.rpm for CentOS 7, edited the .spec file to use the abovementioned patch, compiled it, and installed. I have verified that the patch fixes my problem - the context.sh file contains correctly written CRYPTED_PASSWORD variable value (both for the new VM and after the undeploy/resume cycle).

Do you plan to make a new release any time soon? If not, I can put the RPMs I have compiled somewhere for other users to download.

Anyway, thanks very much for the fix!

-Yenya

GREAT!!! Thanks for the feedback. We’ve just released 5.2 beta, the final
stable release should be in a couple of weeks depending on the number of
bugs we managed to include in the new version :wink:

Excellent. I look forward especially to the group-bound tokens system in 5.2.

-Yenya