@ -564,6 +564,10 @@ Parameters;
If this is set to C << 1 >> , any connetions found to be down and not referencing any devices will be assigned the unroutable IP C << 169.0 .0 . x >> , where C << x >> is a sequential number . This should bring up unconfigured devices .
= head3 up ( optional , default '0' )
If this is set to C << 1 >> , any configured interfaces ( determined by checking for C << match . interface - name >> ) that are down will be started , if possible .
= cut
sub collect_data
{
@ -574,8 +578,10 @@ sub collect_data
$ anvil - > Log - > entry ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , key = > "log_0125" , variables = > { method = > "Network->check_internet()" } } ) ;
my $ start = defined $ parameter - > { start } ? $ parameter - > { start } : "" ;
my $ up = defined $ parameter - > { up } ? $ parameter - > { up } : "" ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > $ debug , list = > {
start = > $ start ,
up = > $ up ,
} } ) ;
if ( exists $ anvil - > data - > { nmcli } )
@ -1121,6 +1127,29 @@ sub collect_data
}
}
# Should we bring up interfaces?
if ( $ up )
{
foreach my $ uuid ( sort { $ a cmp $ b } keys % { $ anvil - > data - > { nmcli } { uuid } } )
{
$ anvil - > data - > { nmcli } { uuid } { $ uuid } { 'match.interface-name' } = "" if not defined $ anvil - > data - > { nmcli } { uuid } { $ uuid } { 'match.interface-name' } ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > 2 , list = > {
"nmcli::uuid::${uuid}::active" = > $ anvil - > data - > { nmcli } { uuid } { $ uuid } { active } ,
"nmcli::uuid::${uuid}::match.interface-name" = > $ anvil - > data - > { nmcli } { uuid } { $ uuid } { 'match.interface-name' } ,
} } ) ;
if ( ( not $ anvil - > data - > { nmcli } { uuid } { $ uuid } { active } ) && ( $ anvil - > data - > { nmcli } { uuid } { $ uuid } { 'match.interface-name' } ) )
{
my $ shell_call = $ anvil - > data - > { path } { exe } { nmcli } . " connection up " . $ uuid ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > 2 , list = > { shell_call = > $ shell_call } } ) ;
my ( $ output , $ return_code ) = $ anvil - > System - > call ( { shell_call = > $ shell_call } ) ;
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > 2 , list = > {
output = > $ output ,
return_code = > $ return_code ,
} } ) ;
}
}
}
# Should we start interfaces?
if ( $ start )
{
@ -1133,7 +1162,7 @@ sub collect_data
{
$ anvil - > Log - > variables ( { source = > $ THIS_FILE , line = > __LINE__ , level = > 2 , list = > {
"nmcli::uuid::${uuid}::active" = > $ anvil - > data - > { nmcli } { uuid } { $ uuid } { active } ,
"nmcli::uuid::${uuid}::activ e" = > $ anvil - > data - > { nmcli } { uuid } { $ uuid } { 'connection.interface-name' } ,
"nmcli::uuid::${uuid}::connection.interface-nam e" = > $ anvil - > data - > { nmcli } { uuid } { $ uuid } { 'connection.interface-name' } ,
} } ) ;
if ( ( not $ anvil - > data - > { nmcli } { uuid } { $ uuid } { active } ) && ( not $ anvil - > data - > { nmcli } { uuid } { $ uuid } { 'connection.interface-name' } ) )
{