]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Cleanup network stuff before shutting down template VM
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 16 Nov 2023 16:25:21 +0000 (17:25 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 16 Nov 2023 16:25:21 +0000 (17:25 +0100)
lib/cr_vmware_tpl/__init__.py
lib/cr_vmware_tpl/handler/vm.py

index 8987e4f12b93c4d65b2bc90955d729dadd4b2d26..301210ec1d80ccc28ba655e34622ae83e90029e0 100644 (file)
@@ -3,7 +3,7 @@
 
 import time
 
-__version__ = '3.1.2'
+__version__ = '3.1.3'
 
 DEFAULT_CONFIG_DIR = 'pixelpark'
 DEFAULT_DISTRO_ARCH = 'x86_64'
index 69313d5dc75d5f22e6880b86a3ec33d22f6d8da2..48570e462bb6d28843373b24e4e1a8ad88be9f39 100644 (file)
@@ -26,7 +26,7 @@ from fb_tools.errors import HandlerError, ExpectedHandlerError
 from .. import print_section_start, print_section_end
 from ..xlate import XLATOR
 
-__version__ = '0.2.7'
+__version__ = '0.2.8'
 
 LOG = logging.getLogger(__name__)
 
@@ -375,6 +375,51 @@ class HandlerVmMixin():
         echo
         /usr/sbin/ip route show
         echo
+        echo "NetworkManager connections:
+        echo
+        /bin/nmcli connection show
+
+        echo
+        echo "-----------------------------------------------------------"
+        echo "Networking config files:"
+        echo
+        echo "Searching for file like /etc/sysconfig/network-scripts/ifcfg-* ..."
+        for f in /etc/sysconfig/network-scripts/ifcfg-* ; do
+            if [ ! -f "${f}" ] ; then
+                continue
+            fi
+            base_name=$( basename "${f}" )
+            if [ "${base_name}" = 'ifcfg-lo' ] ; then
+                continue
+            fi
+            echo "${f}:"
+            ls -l "${f}"
+            echo
+            echo "Content:"
+            echo "---------- snip ----------"
+            cat "${f}"
+            echo "---------- snip ----------"
+            echo "Removing ${f} ..."
+            rm -vf "${f}"
+        done
+        echo
+        echo "DHCP leases:"
+        echo
+        echo "Searching for file like /var/lib/dhclient/*.leases ..."
+        for f in /var/lib/dhclient/*.leases ; do
+            if [ ! -f "${f}" ] ; then
+                continue
+            fi
+            echo "${f}:"
+            ls -l "${f}"
+            echo
+            echo "Content:"
+            echo "---------- snip ----------"
+            cat "${f}"
+            echo "---------- snip ----------"
+            echo "Removing ${f} ..."
+            rm -vf "${f}"
+        done
 
         """).replace('@@@LOGFILES@@@', ' '.join(logfiles))