TT#168102 check: Add a YAML schema and validation for instances.yml

Change-Id: I5134d10b7b438e2d6ce60d838034df68e4bc71cb
mr11.0
Guillem Jover 3 years ago committed by ngcp-config
parent 0f20e0ffe5
commit c27e56ce86

@ -16,6 +16,7 @@ PERL_SCRIPTS = \
sbin/ngcp-sync-grants \
# EOL
YAML_SCHEMAS = \
schemas/instances.yml \
schemas/sites.yml \
# EOL
RESULTS ?= results

@ -20,6 +20,7 @@ sbin/ngcp-network-validator usr/sbin/
sbin/ngcp-sync-constants usr/sbin/
sbin/ngcp-sync-grants usr/sbin/
sbin/ngcpcfg usr/sbin/
schemas/instances.yml usr/share/ngcp-ngcpcfg/schemas/
schemas/sites.yml usr/share/ngcp-ngcpcfg/schemas/
scripts/apply usr/share/ngcp-ngcpcfg/scripts/
scripts/build usr/share/ngcp-ngcpcfg/scripts/

@ -0,0 +1,17 @@
name: instances.yml
desc: Kwalify schema for NGCP instances.yml
type: map
mapping:
"sources":
type: seq
required: yes
sequence:
- type: map
required: yes
mapping:
"orig": { type: str, required: yes,
desc: "Specify the original service pathname." }
"dest": { type: str, required: yes,
desc: "Specify the destination service pathname." }
"label": { type: str, required: yes,
desc: "Specify service label." }

@ -172,7 +172,7 @@ validate_config() {
local schema
case "${name}" in
sites.yml)
sites.yml|instances.yml)
if ! [ -e "${f}" ]; then
continue
fi
@ -275,7 +275,8 @@ check_shared_storage() {
if [ "$*" = "" ] ; then
SITES_FILE="${SITES_FILE:-${NGCPCTL_MAIN}/sites.yml}"
config_files="${NGCPCTL_CONFIG:-} ${NODE_CONFIG:-} ${PAIR_CONFIG:-} ${HOST_CONFIG:-} ${LOCAL_CONFIG:-} ${NETWORK_CONFIG:-} ${EXTRA_CONFIG_FILES[*]} ${CONSTANTS_CONFIG:-} ${SITES_FILE:-}"
INSTANCES_FILE="${INSTANCES_FILE:-${NGCPCTL_MAIN}/instances.yml}"
config_files="${NGCPCTL_CONFIG:-} ${NODE_CONFIG:-} ${PAIR_CONFIG:-} ${HOST_CONFIG:-} ${LOCAL_CONFIG:-} ${NETWORK_CONFIG:-} ${EXTRA_CONFIG_FILES[*]} ${CONSTANTS_CONFIG:-} ${SITES_FILE:-} ${INSTANCES_FILE:-}"
else
config_files="$*"
fi

Loading…
Cancel
Save