PK

ADDRLIN : /etc/one-context.d/
FLL :
Current File : //etc/one-context.d/net-99-report-ready

#!/usr/bin/env bash

# -------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems                #
#                                                                            #
# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
# not use this file except in compliance with the License. You may obtain    #
# a copy of the License at                                                   #
#                                                                            #
# http://www.apache.org/licenses/LICENSE-2.0                                 #
#                                                                            #
# Unless required by applicable law or agreed to in writing, software        #
# distributed under the License is distributed on an "AS IS" BASIS,          #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
# See the License for the specific language governing permissions and        #
# limitations under the License.                                             #
#--------------------------------------------------------------------------- #

ENV_FILE=${ENV_FILE:-/var/run/one-context/one_env}
RETRY_COUNT="${RETRY_COUNT:-3}"
RETRY_WAIT_PERIOD="${RETRY_WAIT_PERIOD:-10}"

if [ "$REPORT_READY" != "YES" ]; then
    exit 0
fi

# $TOKENTXT is available only through the env. file
if [ -f "${ENV_FILE}" ]; then
    # shellcheck disable=SC1090
    . "${ENV_FILE}"
fi

###

if command -v curl ; then
    _command=curl
elif command -v wget && ! wget --help 2>&1 | grep -q BusyBox; then
    _command=wget
elif command -v onegate ; then
    _command=onegate
else
    echo "ERROR: No way to signal READY=YES (no usable binary)" >&2
    exit 1
fi > /dev/null # this will not drop the error message which goes to stderr

while [ "$RETRY_COUNT" -gt 0 ] ; do
    case "$_command" in
        curl)
            curl -X "PUT" "${ONEGATE_ENDPOINT}/vm" \
                --header "X-ONEGATE-TOKEN: $TOKENTXT" \
                --header "X-ONEGATE-VMID: $VMID" \
                --max-time 10 \
                --insecure \
                -d "READY=YES"
            ;;
        wget)
            wget --method=PUT "${ONEGATE_ENDPOINT}/vm" \
                --body-data="READY=YES" \
                --header "X-ONEGATE-TOKEN: $TOKENTXT" \
                --header "X-ONEGATE-VMID: $VMID" \
                --timeout=10 \
                --no-check-certificate
            ;;
        onegate)
            if command -v timeout >/dev/null; then
                timeout 10 onegate vm update --data "READY=YES"
            else
                onegate vm update --data "READY=YES"
            fi
            ;;
    esac

    # shellcheck disable=SC2181
    if [ "$?" = "0" ]; then
        exit 0
    fi

    RETRY_COUNT=$(( RETRY_COUNT - 1 ))
    sleep "${RETRY_WAIT_PERIOD}"
done

exit 1


PK 99
E-SHOP || DASHBOARD
404

Page Not Found

It looks like you found a glitch in the matrix...

← Back to Home