Bug #4660
VM template special characters
Status: | Pending | Start date: | 07/20/2016 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | - | |||
Target version: | - | |||
Resolution: | Pull request: | |||
Affected Versions: | OpenNebula 5.0 |
Description
I use cloud-init to configure the cloud-images from ubuntu, And in 4.14 I stumpled upon a problem when creating a user as chown below, the hash breaks the validator due to special characters.
in 4.14 I was able to do a workaround, set a variable outside the USER_DATA, and simple use it inside the USER_DATA eg passwd: '$INSTALLER_PW'
this behaviour changed in 5.0, and now I can't get any combination to work. even if I use $INSTALLER_PW inside the template, it seems like its replacing it to the string before the validation take place and therefore it breaks.
to summarize, I cannot create or boot any VM without replacing the passwd hash to eg '123' or 'hello', how do I use the hash inside the USER_DATA so that I can create the user account properly?
here below is the output from "onevm show 339"
USER TEMPLATE
HOSTNAME="host1"
HYPERVISOR="kvm"
INSTALLER_PW="$6$SALT$/57L/E0BXzd81nPixyXgUHT4b6i6oPhcOmzlb4wunE4192bSKSyjj6d7hH2FlAO623f5auNMEpI3SEMMiNtp/0"
LOGO="images/logos/ubuntu.png"
SCHED_RANK="-RUNNING_VMS"
SCHED_REQUIREMENTS="ENOUGH_RESOURCES = 1"
USER_INPUTS=[
HOSTNAME="M|text|hostname" ]
VIRTUAL MACHINE TEMPLATE
AUTOMATIC_REQUIREMENTS="CLUSTER_ID = 100 & !(PUBLIC_CLOUD = YES)"
CONTEXT=[
DISK_ID="1",
ETH0_MAC="02:00:ec:7e:07:1a",
HOSTNAME="host1",
NETWORK="YES",
SSH_PUBLIC_KEY="ssh-rsa foo@bar",
TARGET="hda",
USER_DATA="#cloud-config
bootcmd:
- ifdown a
hostname: 'host1'
fqdn: 'host1'
manage_etc_hosts: true
apt_update: true
apt_upgrade: true
apt_reboot_if_required: true
timezone: Europe/Stockholm
packages:
- nano
users:
- name: installer
sudo: ALL=(ALL) ALL
lock_passwd: false
passwd: '$6$SALT$/57L/E0BXzd81nPixyXgUHT4b6i6oPhcOmzlb4wunE4192bSKSyjj6d7hH2FlAO623f5auNMEpI3SEMMiNtp/0'
apt_sources:
- source: 'deb http://apt/chef trusty main'
key: |
-----BEGIN PGP PUBLIC KEY BLOCK----
Version: GnuPG v1.4.12 (Darwin)
Comment: GPGTools - http://gpgtools.org
-----END PGP PUBLIC KEY BLOCK-----
chef:
force_install: false
server_url: 'https://chef/organizations/org'
node_name: 'hostname1'
validation_name:validator
validation_cert: |
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
run_list:
- 'role[Stuff1]'
- 'role[Stuff2]'
runcmd:
- /opt/chef/embedded/bin/gem install chef_handler_foreman
- chef-client
output: {all: '| tee -a /var/log/cloud-init-output.log'}
" ]
CPU="2"
GRAPHICS=[
LISTEN="0.0.0.0",
PORT="6245",
TYPE="VNC" ]
MEMORY="4096"
NIC_DEFAULT=[
MODEL="virtio" ]
OS=[
BOOT="network,hd" ]
RAW=[
DATA="<cpu mode='custom' match='exact'>
<model fallback='forbid'>SandyBridge</model>
<vendor>Intel</vendor>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='osxsave'/>
<feature policy='require' name='dca'/>
<feature policy='require' name='pcid'/>
<feature policy='require' name='pdcm'/>
<feature policy='require' name='xtpr'/>
<feature policy='require' name='tm2'/>
<feature policy='require' name='est'/>
<feature policy='require' name='smx'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='ds_cpl'/>
<feature policy='require' name='monitor'/>
<feature policy='require' name='dtes64'/>
<feature policy='require' name='pbe'/>
<feature policy='require' name='tm'/>
<feature policy='require' name='ht'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='acpi'/>
<feature policy='require' name='ds'/>
<feature policy='require' name='vme'/>
</cpu>",
TYPE="kvm" ]
TEMPLATE_ID="24"
VCPU="2"
VMID="345"