# _install_ansible() - Install and Configure Ansible program
function _install_ansible {
- local version=$(grep "ansible_version" ${kud_playbooks}/kud-vars.yml |
- awk -F ': ' '{print $2}')
+ local version
+ version=$(grep "ansible_version" ${kud_playbooks}/kud-vars.yml |
+ awk -F ': ' '{print $2}') || return 1
mkdir -p /etc/ansible/
pip install --no-cache-dir ansible==$version
}
function _clean_docker {
local matchExp=""
if [ "$1" == "--reset" ]; then
- # Remove all containers regardless of state
+ # Remove all containers regardless of state
docker rm -vf $(docker ps -a -q) 2>/dev/null || \
echo "No more containers to remove."
exit 0
exit 0
fi
else
- # This alternate only removes "stopped" containers
+ # This alternate only removes "stopped" containers
docker rm -vf $(docker ps -a | grep "Exited" | \
awk '{print $2}') 2>/dev/null || echo "No stopped containers to remove."
fi
done </tmp/docker-list.txt
rm /tmp/docker-list.txt
else
- # Remove all images which are not used by existing container
+ # Remove all images which are not used by existing container
docker image prune -a || echo "No untagged images to delete."
fi
if $(ansible --version &>/dev/null); then
sudo pip uninstall -y ansible
fi
- local version=$(grep "ansible_version" ${kud_playbooks}/kud-vars.yml | awk -F ': ' '{print $2}')
+ local version
+ version=$(grep "ansible_version" ${kud_playbooks}/kud-vars.yml | awk -F ': ' '{print $2}') || return 1
sudo mkdir -p /etc/ansible/
sudo -E pip install --no-cache-dir ansible==$version
}
sudo apt-get install -y sshpass make unzip # install make to run mitogen target and unzip is mitogen playbook dependency
sudo apt-get install -y gnupg2 software-properties-common
_install_ansible
- wget https://github.com/kubernetes-incubator/kubespray/archive/$tarball
+ wget -nv https://github.com/kubernetes-incubator/kubespray/archive/$tarball
sudo tar -C $dest_folder -xzf $tarball
sudo chown -R $USER $dest_folder/kubespray-$version
sudo mkdir -p ${local_release_dir}/containers
pushd "${CSAR_DIR}/$1"
print_msg "Create Helm Chart Archives for m3db"
rm -f *.tar.gz
- #tar -czf m3db.tar.gz -C $test_folder/vnfs/comp-app/collection/app3-latest/helm .
- #tar -czf m3db_profile.tar.gz -C $test_folder/vnfs/comp-app/collection/app3-latest/profile .
+ #tar -czf m3db.tar.gz -C $test_folder/vnfs/comp-app/collection/app3-latest/helm .
+ #tar -czf m3db_profile.tar.gz -C $test_folder/vnfs/comp-app/collection/app3-latest/profile .
tar -czf m3db.tar.gz -C $test_folder/vnfs/comp-app/collection/m3db/helm .
tar -czf m3db_profile.tar.gz -C $test_folder/vnfs/comp-app/collection/m3db/profile .
export m3db_helm_path="${CSAR_DIR}/$1/m3db.tar.gz"
#and performs validation of http_code
local status
- local curl_response_file="$(mktemp -p /tmp)"
+ local curl_response_file
+ curl_response_file="$(mktemp -p /tmp)" || return 1
local curl_common_flags=(-s -w "%{http_code}" -o "${curl_response_file}")
local command=(curl "${curl_common_flags[@]}" "$@")
#and performs validation of http_code
local status
- local curl_response_file="$(mktemp -p /tmp)"
+ local curl_response_file
+ curl_response_file="$(mktemp -p /tmp)" || return 1
local curl_common_flags=(-s -w "%{http_code}" -o "${curl_response_file}")
local command=(curl "${curl_common_flags[@]}" "$@")
},
"spec": {
"host": "${rsynccontrollername}",
- "port": 9041
+ "port": 9041
}
}
EOF
}
function deleteOrchestratorData {
- # TODO- delete rsync controller and any other controller
+ # TODO- delete rsync controller and any other controller
delete_resource "${base_url_orchestrator}/controllers/${rsynccontrollername}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${operators_compositeapp_name}/${compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/intents/${deployment_intents_in_group_name}"
deleteData
createData
instantiate
-
},
"spec": {
"host": "${rsynccontrollername}",
- "port": 9041
+ "port": 9041
}
}
EOF
}
function deleteOrchestratorData {
- # TODO- delete rsync controller and any other controller
+ # TODO- delete rsync controller and any other controller
delete_resource "${base_url_orchestrator}/controllers/${rsynccontrollername}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${operators_compositeapp_name}/${compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/intents/${deployment_intents_in_group_name}"
deleteData
createData
instantiate
-
function generate_CRD_for_macvlan_cni {
local csar_id=$1
- local master_name=$(ssh_cluster ip route | grep 'default' | awk '{print $5}' |head -n 1)
+ local master_name
+ master_name=$(ssh_cluster ip route | grep 'default' | awk '{print $5}' |head -n 1) || return 1
_checks_args $csar_id
pushd ${CSAR_DIR}/${csar_id}
function generate_CRD_for_ipvlan_cni {
local csar_id=$1
- local master_name=$(ssh_cluster ip route | grep 'default' | awk '{print $5}' |head -n 1)
+ local master_name
+ master_name=$(ssh_cluster ip route | grep 'default' | awk '{print $5}' |head -n 1) || return 1
_checks_args $csar_id
pushd ${CSAR_DIR}/${csar_id}
#and performs validation of http_code
local status
- local curl_response_file="$(mktemp -p /tmp)"
+ local curl_response_file
+ curl_response_file="$(mktemp -p /tmp)" || return 1
local curl_common_flags=(-s -w "%{http_code}" -o "${curl_response_file}")
local command=(curl "${curl_common_flags[@]}" "$@")
}
-# Create a test rpoject
+# Create a test rpoject
# EOF must start as first chracter in a line for cat to identify the end
function create_project {
project_name="test_project"
"spec":{
"intent":{
"${genericPlacementIntent}":"${genericPlacementIntentName}",
- "${hpaIntent}" : "${hpaControllerIntentName}",
+ "${hpaIntent}" : "${hpaControllerIntentName}",
"${trafficIntent}" : "${trafficControllerIntentName}",
"${CostBasedIntent}" : "${CostBasedIntentName}",
"${OVNintent}" : "${OVNintentName}"
call_api -d "${payload}" "${base_url}/projects/${project_name}/composite-apps/${composite_app_name}/${composite_app_version}/deployment-intent-groups/${deploymentIntentGroupName}/intents"
# END: Adding intents to an intent group
}
-
function create_pod_yaml_with_nodeSelector {
# Get the major kernel version of a worker node in the cluster:
# this will be used below in the node selector of the test pod
- local -r node_name=$(kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name} {.spec.taints[?(@.effect=="NoSchedule")].effect}{"\n"}{end}' | awk 'NF==1 {print $0;exit}')
- local -r kernel_version=$(kubectl get node ${node_name} -o jsonpath='{.metadata.labels.feature\.node\.kubernetes\.io/kernel-version\.major}')
+ local node_name
+ node_name=$(kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name} {.spec.taints[?(@.effect=="NoSchedule")].effect}{"\n"}{end}' | awk 'NF==1 {print $0;exit}') || return 1
+ local kernel_version
+ kernel_version=$(kubectl get node ${node_name} -o jsonpath='{.metadata.labels.feature\.node\.kubernetes\.io/kernel-version\.major}') || return 1
+ readonly node_name
+ readonly kernel_version
cat << POD > $HOME/$pod_name-nodeSelector.yaml
apiVersion: v1
echo "onap svc health check is success"
exit 0
fi
- ((timeout-=1))
+ $((timeout-=1))
done
}
},
"spec": {
"host": "${rsynccontrollername}",
- "port": 9041
+ "port": 9041
}
}
EOF
}
function deleteOrchestratorData {
- # TODO- delete rsync controller and any other controller
+ # TODO- delete rsync controller and any other controller
delete_resource "${base_url_orchestrator}/controllers/${rsynccontrollername}"
delete_resource "${base_url_orchestrator}/projects/${projectname}/composite-apps/${collection_compositeapp_name}/${compositeapp_version}/deployment-intent-groups/${deployment_intent_group_name}/intents/${deployment_intents_in_group_name}"
deleteData
createData
instantiate
-
envlist = bashate
[testenv]
-passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
+passenv =
+ http_proxy
+ HTTP_PROXY
+ https_proxy
+ HTTPS_PROXY
+ no_proxy
+ NO_PROXY
usedevelop = False
install_command = pip install --no-cache-dir {opts} {packages}
[testenv:bashate]
deps =
{env:BASHATE_INSTALL_PATH:bashate}
- rstcheck
-whitelist_externals = bash
+ rstcheck[sphinx]
+allowlist_externals = bash
commands = bash -c "find {toxinidir} -not -path {toxinidir}/.tox/\* \
-not -path {toxinidir}/pkg/dep/\* \
-not -path {toxinidir}/pkg/mod/\* \
# E006 check for lines longer than 79 columns
-print0 | xargs -0 bashate -v -iE006"
bash -c "find {toxinidir}/docs \
- -name \*.rst -type f -print0 | xargs -0 rstcheck --report warning"
+ -name \*.rst -type f -print0 | xargs -0 rstcheck --report-level warning"
[testenv:docs]
deps =