+function cleanup {
+ while IFS=',' read -r name ipmi_username ipmi_password ipmi_address os_username os_password os_image_name; do
+ kubectl delete --ignore-not-found=true bmh $name -n metal3
+ kubectl delete --ignore-not-found=true secrets $name-bmc-secret -n metal3
+ kubectl delete --ignore-not-found=true secrets $name-user-data -n metal3
+ if [ -f $name-bm-node.yaml ]; then
+ rm -rf $name-bm-node.yaml
+ fi
+
+ if [ -f $name-user-data-credential.yaml ]; then
+ rm -rf $name-user-data-credential.yaml
+ fi
+
+ if [ -f $name-userdata.yaml ]; then
+ rm -rf $name-userdata.yaml
+ fi
+ done
+}
+
+function clean_all {
+ list_nodes | cleanup
+ if [ -f $IRONIC_DATA_DIR/nodes.json ]; then
+ rm -rf $IRONIC_DATA_DIR/nodes.json
+ fi
+}
+