fn run_generator(log: Logger, args: Args, kernel_args: NetworkGeneratorArgs) -> Result<()> {
    let dropin = Dropin {
        target: ETH_NETWORK_UNIT_FILENAME.into(),
        unit: NetworkUnit {
            match_section: NetworkUnitMatchSection {
                name: "eth*".to_string(),
                mac_address: kernel_args.mac_address,
            },
        },
        dropin_filename: Some("match.conf".to_string()),
    };

    write_dropin_to_disk(
        &dropin,
        log.clone(),
        &args.network_unit_dir,
        Path::new("match.conf"),
    )
    .context("failed to write dropin to disk")?;

    // IMPORTANT: this MUST be the last thing that the generator does, otherwise
    // any bugs in the generator can be masked and cause future hard-to-diagnose
    // failures
    update_default_target(args)
        .context("failed to update default target after successful generator run")?;
    info!(
        log,
        "successfully updated default target after successful generator run"
    );
    Ok(())
}
/// This is the main logic of the code and it's in its own function so that we can unit test
/// and pass in mocked out args and kernel args.
This is the main logic of the code and it's in its own function so that we can unit test
and pass in mocked out args and kernel args.
This is the main logic of the code and it ' s in its own function so that we can unit test and pass in mocked out args and kernel args .
fn run_generator(log: Logger, args: Args, kernel_args: NetworkGeneratorArgs) -> Result<()> {
    let dropin = Dropin {
        target: ETH_NETWORK_UNIT_FILENAME.into(),
        unit: NetworkUnit {
            match_section: NetworkUnitMatchSection {
                name: "eth*".to_string(),
                mac_address: kernel_args.mac_address,
            },
        },
        dropin_filename: Some("match.conf".to_string()),
    };
    write_dropin_to_disk(
        &dropin,
        log.clone(),
        &args.network_unit_dir,
        Path::new("match.conf"),
    )
    .context("failed to write dropin to disk")?;
    // IMPORTANT: this MUST be the last thing that the generator does, otherwise
    // any bugs in the generator can be masked and cause future hard-to-diagnose
    // failures
    update_default_target(args)
        .context("failed to update default target after successful generator run")?;
    info!(
        log,
        "successfully updated default target after successful generator run"
    );
    Ok(())
}
fn run_generator ( log : Logger , args : Args , kernel_args : NetworkGeneratorArgs ) -> Result < ( ) > { let dropin = Dropin { target : ETH_NETWORK_UNIT_FILENAME . into ( ) , unit : NetworkUnit { match_section : NetworkUnitMatchSection { name : " " . to_string ( ) , mac_address : kernel_args . mac_address , } , } , dropin_filename : Some ( " " . to_string ( ) ) , } ; write_dropin_to_disk ( & dropin , log . clone ( ) , & args . network_unit_dir , Path :: new ( " " ) , ) . context ( " " ) ? ; // IMPORTANT: this MUST be the last thing that the generator does, otherwise // any bugs in the generator can be masked and cause future hard-to-diagnose // failures update_default_target ( args ) . context ( " " ) ? ; info ! ( log " " ) ; Ok ( ( ) ) }
This is the main logic of the code and it's in its own function so that we can unit test
and pass in mocked out args and kernel args.
This is the main logic of the code and it ' s in its own function so that we can unit test and pass in mocked out args and kernel args .
log
Logger
args
Args
kernel_args
NetworkGeneratorArgs
log
Logger
args
Args
kernel_args
NetworkGeneratorArgs