@ -3605,7 +3605,7 @@ sub insert_or_update_bonds
my $ bond_down_delay = defined $ parameter - > { bond_down_delay } ? $ parameter - > { bond_down_delay } : "" ;
my $ bond_mac_address = defined $ parameter - > { bond_mac_address } ? $ parameter - > { bond_mac_address } : "" ;
my $ bond_operational = defined $ parameter - > { bond_operational } ? $ parameter - > { bond_operational } : "" ;
my $ bond_bridge_uuid = defined $ parameter - > { bond_bridge_uuid } ? $ parameter - > { bond_bridge_uuid } : "" ;
my $ bond_bridge_uuid = defined $ parameter - > { bond_bridge_uuid } ? $ parameter - > { bond_bridge_uuid } : 'NULL' ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
uuid = > $ uuid ,
file = > $ file ,
@ -3851,7 +3851,7 @@ WHERE
my $ old_bond_down_delay = $ row - > [ 9 ] ;
my $ old_bond_mac_address = $ row - > [ 10 ] ;
my $ old_bond_operational = $ row - > [ 11 ] ;
my $ old_bond_bridge_uuid = $ row - > [ 12 ] ;
my $ old_bond_bridge_uuid = defined $ row - > [ 12 ] ? $ row - > [ 12 ] : 'NULL' ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
old_bond_host_uuid = > $ old_bond_host_uuid ,
old_bond_name = > $ old_bond_name ,
@ -3905,6 +3905,7 @@ SET
WHERE
bond_uuid = ".$anvil->Database->quote($bond_uuid)."
" ;
$ query =~ s/'NULL'/NULL/g ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { query = > $ query } } ) ;
$ anvil - > Database - > write ( { uuid = > $ uuid , query = > $ query , source = > $ file ? $ file . " -> " . $ THIS_FILE : $ THIS_FILE , line = > $ line ? $ line . " -> " . __LINE__ : __LINE__ } ) ;
}
@ -5110,8 +5111,34 @@ sub insert_or_update_ip_addresses
# If we don't have a UUID, see if we can find one for the given ip_address name.
if ( not $ ip_address_uuid )
{
### NOTE: An IP can be on multiple machines at the same time (ie: 192.168.122.1), so we need
### to restrict to this host.
# We'll try to find the existing interface a couple ways. First we'll look up using
# '_on_uuid' as that's as specific as it gets.
my $ query = "
SELECT
ip_address_uuid
FROM
ip_addresses
WHERE
ip_address_on_uuid = ".$anvil->Database->quote($ip_address_on_uuid)."
; " ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { query = > $ query } } ) ;
my $ results = $ anvil - > Database - > query ( { uuid = > $ uuid , query = > $ query , source = > $ file ? $ file . " -> " . $ THIS_FILE : $ THIS_FILE , line = > $ line ? $ line . " -> " . __LINE__ : __LINE__ } ) ;
my $ count = @ { $ results } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
results = > $ results ,
count = > $ count ,
} } ) ;
if ( $ count )
{
$ ip_address_uuid = $ results - > [ 0 ] - > [ 0 ] ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { ip_address_uuid = > $ ip_address_uuid } } ) ;
}
if ( not $ ip_address_uuid )
{
# No luck there... An IP can be on multiple machines at the same time
# (ie: 192.168.122.1), so we need to restrict to this host.
my $ query = "
SELECT
ip_address_uuid
@ -5136,6 +5163,7 @@ AND
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > { ip_address_uuid = > $ ip_address_uuid } } ) ;
}
}
}
if ( $ delete )
{