Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteOtter committed Apr 25, 2024
1 parent c0aa30e commit 0f89b21
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/publisher/publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub fn register_machine(
let interface_id = match create_interface(client, interface_payload) {
Ok(id) => id,
Err(e) => {
println!("{}", e);
eprintln!("{}", e);
process::exit(1);
}
};
Expand Down
20 changes: 15 additions & 5 deletions src/publisher/translator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,27 @@ pub fn information_to_interface(
// payload.bridge = todo!();
// payload.lag = todo!();
// payload.mtu = todo!();

// Get the interfce we are looking for as primary, then get its parameters.
// These filter statements can probably be split off into their own function.
payload.mac_address = match &config_data.system.primary_network_interface {
Some(nwi_name) => {
let interface = machine.network_information.iter().find(|nwi| nwi.name == nwi_name.to_owned());
let interface = machine
.network_information
.iter()
.find(|nwi| nwi.name == nwi_name.to_owned());
interface.map(|nwi| nwi.mac_addr.clone()).flatten()
},
}
None => None,
};
payload.speed = match config_data.system.primary_network_interface {
Some(nwi_name) => {
let interface = machine.network_information.iter().find(|nwi| nwi.name == nwi_name);
let interface = machine
.network_information
.iter()
.find(|nwi| nwi.name == nwi_name);
interface.map(|nwi| nwi.interface_speed.clone()).flatten()
},
}
None => None,
};
payload.description = String::from("This interface was automatically created by Nazara.");
Expand All @@ -211,6 +217,10 @@ pub fn information_to_interface(
/// # Parameters
///
/// * state: `&ThanixClient` - The client required for searching for the platform.
///
/// # Returns
///
/// Returns `Some(i64)` if the specified platform exists, else returns `None`.
fn get_platform_id(state: &ThanixClient, platform_name: String) -> Option<i64> {
println!("Searching for id of platform '{}' ... ", platform_name);
let platform_list: Vec<Platform>;
Expand Down

0 comments on commit 0f89b21

Please sign in to comment.