OSTEMPLATE directive value is left empty in VZ VPS config after creation in SolusVM 2

Have more questions? Submit a request

Applicable to:

  • SolusVM 2

Symptoms 

OSTEMPLATE directive value is left empty in VZ VPS config after creation in SolusVM 2

Cause

SolusVM 2 bug with ID #SVM2-468 which will be fixed in future SolusVM 2 updates.

Resolution

As a workaround:

  1. Connect to OpenVZ Compute Resource via SSH
  2. Create a directory for hook scripts:

    # mkdir -p /usr/local/solus/hooks

  3. Create a script file and set execution permission to it:

    # touch /usr/local/solus/hooks/hook.sh
    # chmod +x /usr/local/solus/hooks/hook.sh

  4. Add the following content into the script:

    CONFIG_TEXT: #!/bin/bash -x
    tfile=$(mktemp /tmp/foo.XXXXXXXXX)
    cat /dev/stdin >"$tfile"
    trap 'rm -f $tfile' EXIT
    if [ false = "$(jq -j '[contains({action: "server-create", stage: "post"})]|any' <"$tfile")" ]; then
            exit 0
    fi
    UUID=`jq -j '.data.uuid' <"$tfile"`
    OSTEMPLATE=`jq -j '.data.os_template' <"$tfile"`
    sleep 5
    vzctl set $UUID --ostemplate $OSTEMPLATE --save

Articles in this section

Was this article helpful?
0 out of 0 found this helpful
Share

Comments

0 comments

Please sign in to leave a comment.