Reviewed the messages on the screen. Added information messages

This commit is contained in:
2025-07-23 13:09:27 +02:00
parent 7dd6a29b08
commit 8cd2eb5a05
2 changed files with 6 additions and 9 deletions

View File

@ -100,13 +100,13 @@ vm_net_get_ip()
# Obtener la dirección MAC de la interfaz de red # Obtener la dirección MAC de la interfaz de red
MAC_VM=$(vm_net_get_mac $VM) MAC_VM=$(vm_net_get_mac $VM)
if [[ -z "$MAC_VM" ]]; then if [[ -z "$MAC_VM" ]]; then
echo "Error: No se pudo encontrar la dirección MAC para '$VM'" echo "Error: The MAC address could not be found for '$VM'"
return 1 return 1
fi fi
# Obtener la dirección IP a partir de la dirección MAC # Obtener la dirección IP a partir de la dirección MAC
VM_IP_ADDRESS=$(arp -a | grep "$MAC_VM" | awk '{ print $2 }' | sed 's/[()]//g') VM_IP_ADDRESS=$(arp -a | grep "$MAC_VM" | awk '{ print $2 }' | sed 's/[()]//g')
if [[ -z "$VM_IP_ADDRESS" ]]; then if [[ -z "$VM_IP_ADDRESS" ]]; then
echo "Error: No se pudo encontrar la dirección IP para la dirección MAC '$MAC_VM'" echo "Error: Could not find IP address for MAC address '$MAC_VM'"
return 1 return 1
fi fi
echo "$VM_IP_ADDRESS" echo "$VM_IP_ADDRESS"
@ -170,7 +170,6 @@ vm_connect()
vm_delete () vm_delete ()
{ {
local VM=$1 local VM=$1
echo "VM: $VM"
if [[ -f "$VM_IMAGE_PATH" ]]; then if [[ -f "$VM_IMAGE_PATH" ]]; then
# Safely remove the VM with confirmation # Safely remove the VM with confirmation
read -p "Are you sure you want to remove the VM '$VM' (y/N)? " confirm read -p "Are you sure you want to remove the VM '$VM' (y/N)? " confirm
@ -215,7 +214,6 @@ vm_download_base_image()
vm_create_guest_image() vm_create_guest_image()
{ {
echo "Creating a qcow2 image file ${VM_BASE_DIR}/images/${VM_HOSTNAME}.${VM_DISK_EXTENSION} that uses the cloud image file ${VM_BASE_IMAGE_LOCATION} as its base"
if [[ "$VM_OS_TYPE" == "freebsd" ]]; then if [[ "$VM_OS_TYPE" == "freebsd" ]]; then
if ! test -f "${VM_BASE_DIR}/images/${VM_HOSTNAME}.qcow"; then if ! test -f "${VM_BASE_DIR}/images/${VM_HOSTNAME}.qcow"; then
xz -d ${VM_BASE_IMAGE_LOCATION} xz -d ${VM_BASE_IMAGE_LOCATION}
@ -356,6 +354,8 @@ vm_guest_install()
eval virt-install $VM_INSTALL_OPTS eval virt-install $VM_INSTALL_OPTS
virsh dumpxml "${VM_HOSTNAME}" > "${VM_BASE_DIR}/xml/${VM_HOSTNAME}.xml" virsh dumpxml "${VM_HOSTNAME}" > "${VM_BASE_DIR}/xml/${VM_HOSTNAME}.xml"
echo "Root password: $VM_ROOT_PASS" clear
echo "User password: $VM_USER_PASS" echo "VM ${VM_HOSTNAME} Created!"
echo "NOTE: It may take some time for the virtual machine to be available if it is a BSD flavor. You can check the status of the virtual machine with the following command:"
echo "virsh console ${VM_HOSTNAME} --safe"
} }

View File

@ -121,8 +121,6 @@ case "${ACTION}" in
fi fi
VM_HOSTNAME="$1" VM_HOSTNAME="$1"
source env_scripts/common.sh source env_scripts/common.sh
echo "Action: ${ACTION}"
echo "VM Name: ${VM_HOSTNAME}"
if [[ "${ACTION}" == 'delete' ]]; then if [[ "${ACTION}" == 'delete' ]]; then
vm_delete ${VM_HOSTNAME} vm_delete ${VM_HOSTNAME}
elif [[ "${ACTION}" == 'info' ]]; then elif [[ "${ACTION}" == 'info' ]]; then
@ -133,7 +131,6 @@ case "${ACTION}" in
;; ;;
list) list)
#echo "Action: list"
vm_list vm_list
;; ;;