Fix verify-python job 55/142055/2 master
authorFiete Ostkamp <fiete.ostkamp@telekom.de>
Tue, 16 Sep 2025 07:50:27 +0000 (09:50 +0200)
committerFiete Ostkamp <fiete.ostkamp@telekom.de>
Tue, 16 Sep 2025 07:56:30 +0000 (09:56 +0200)
- fix passenv notation in tox.ini
- fix bashate (bash linter) warnings in bash scripts
- fix rstcheck linting

Issue-ID: MULTICLOUD-1513
Change-Id: I18b7836abca8eb6f2c1ad4610e9a432ed0356075
Signed-off-by: Fiete Ostkamp <fiete.ostkamp@telekom.de>
13 files changed:
kud/hosting_providers/containerized/installer.sh
kud/hosting_providers/vagrant/cleanup.sh
kud/hosting_providers/vagrant/installer.sh
kud/tests/_common.sh
kud/tests/_functions.sh
kud/tests/cluster1-m3db-operator-test.sh
kud/tests/cluster2-m3db-operator-test.sh
kud/tests/multus.sh
kud/tests/negative_tests/_test_functions.sh
kud/tests/nfd.sh
kud/tests/onap4k8s.sh
kud/tests/prometheus-test.sh
tox.ini

index e8c0b86..4d4174e 100755 (executable)
@@ -38,8 +38,9 @@ function install_prerequisites {
 
 # _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
 }
index 75e6de1..559f6e6 100755 (executable)
@@ -14,7 +14,7 @@
 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
@@ -46,7 +46,7 @@ elif [ "$1" == "--purge" ]; then
         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
@@ -63,7 +63,7 @@ if [ "$1" == "--nuclear" ]; then
     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
 
index 099874a..b69a0b3 100755 (executable)
@@ -49,7 +49,8 @@ function _install_ansible {
     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
 }
@@ -74,7 +75,7 @@ function install_k8s {
     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
index efeded6..3384c9a 100644 (file)
@@ -1285,8 +1285,8 @@ function populate_CSAR_m3db_helm {
     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"
index e2d9207..4c26195 100755 (executable)
@@ -78,7 +78,8 @@ function call_api {
     #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[@]}" "$@")
 
@@ -111,7 +112,8 @@ function call_api_nox {
     #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[@]}" "$@")
 
index 5dd95c6..dd991a2 100755 (executable)
@@ -94,7 +94,7 @@ rsynccontrollerdata="$(cat<<EOF
   },
   "spec": {
     "host": "${rsynccontrollername}",
-    "port": 9041 
+    "port": 9041
   }
 }
 EOF
@@ -318,7 +318,7 @@ function createOrchestratorData {
 }
 
 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}"
@@ -383,4 +383,3 @@ populate_CSAR_operator_helm "$csar_id"
 deleteData
 createData
 instantiate
-
index 54ca434..f33166f 100755 (executable)
@@ -94,7 +94,7 @@ rsynccontrollerdata="$(cat<<EOF
   },
   "spec": {
     "host": "${rsynccontrollername}",
-    "port": 9041 
+    "port": 9041
   }
 }
 EOF
@@ -318,7 +318,7 @@ function createOrchestratorData {
 }
 
 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}"
@@ -383,4 +383,3 @@ populate_CSAR_operator_helm "$csar_id"
 deleteData
 createData
 instantiate
-
index 24c5314..8c30a8d 100755 (executable)
@@ -41,7 +41,8 @@ NET
 
 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}
 
@@ -67,7 +68,8 @@ NET
 
 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}
 
index f4e9472..f05c21f 100755 (executable)
@@ -37,7 +37,8 @@ function call_api_negative {
     #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[@]}" "$@")
 
@@ -71,7 +72,7 @@ function get_resource_negative {
 }
 
 
-# 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"
@@ -331,7 +332,7 @@ payload="$(cat <<EOF
    "spec":{
       "intent":{
          "${genericPlacementIntent}":"${genericPlacementIntentName}",
-         "${hpaIntent}" : "${hpaControllerIntentName}", 
+         "${hpaIntent}" : "${hpaControllerIntentName}",
          "${trafficIntent}" : "${trafficControllerIntentName}",
          "${CostBasedIntent}" : "${CostBasedIntentName}",
          "${OVNintent}" : "${OVNintentName}"
@@ -343,4 +344,3 @@ EOF
 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
 }
-
index 324d550..e3a7865 100755 (executable)
@@ -69,8 +69,12 @@ POD
 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
index 67aae58..c5381ed 100755 (executable)
@@ -29,7 +29,7 @@ function check_onap_svc {
             echo "onap svc health check is success"
             exit 0
         fi
-        ((timeout-=1))
+        $((timeout-=1))
     done
 }
 
index b746b88..5634b09 100755 (executable)
@@ -133,7 +133,7 @@ rsynccontrollerdata="$(cat<<EOF
   },
   "spec": {
     "host": "${rsynccontrollername}",
-    "port": 9041 
+    "port": 9041
   }
 }
 EOF
@@ -428,7 +428,7 @@ function createOrchestratorData {
 }
 
 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}"
@@ -522,4 +522,3 @@ populate_CSAR_composite_app_helm "$csar_id"
 deleteData
 createData
 instantiate
-
diff --git a/tox.ini b/tox.ini
index dff3a8b..7a1c1b7 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -13,15 +13,21 @@ skipsdist = True
 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/\* \
@@ -31,7 +37,7 @@ commands = bash -c "find {toxinidir} -not -path {toxinidir}/.tox/\* \
 # 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 =