diff --git a/Cargo.lock b/Cargo.lock index a018bdeb2..3ed1e6642 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -333,7 +333,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "agent" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-debug-echo", "akri-discovery-utils", @@ -401,7 +401,7 @@ dependencies = [ [[package]] name = "akri-debug-echo" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-discovery-utils", "akri-shared", @@ -421,7 +421,7 @@ dependencies = [ [[package]] name = "akri-discovery-utils" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-shared", "anyhow", @@ -443,7 +443,7 @@ dependencies = [ [[package]] name = "akri-onvif" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-discovery-utils", "akri-shared", @@ -471,7 +471,7 @@ dependencies = [ [[package]] name = "akri-opcua" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-discovery-utils", "akri-shared", @@ -495,7 +495,7 @@ dependencies = [ [[package]] name = "akri-shared" -version = "0.8.27" +version = "0.9.0" dependencies = [ "anyhow", "async-trait", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "akri-udev" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-discovery-utils", "anyhow", @@ -992,7 +992,7 @@ checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" [[package]] name = "controller" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-shared", "anyhow", @@ -1202,7 +1202,7 @@ dependencies = [ [[package]] name = "debug-echo-discovery-handler" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-debug-echo", "akri-discovery-utils", @@ -2433,7 +2433,7 @@ checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] name = "onvif-discovery-handler" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-discovery-utils", "akri-onvif", @@ -2483,7 +2483,7 @@ dependencies = [ [[package]] name = "opcua-discovery-handler" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-discovery-utils", "akri-opcua", @@ -4144,7 +4144,7 @@ dependencies = [ [[package]] name = "udev-discovery-handler" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-discovery-utils", "akri-udev", @@ -4155,7 +4155,7 @@ dependencies = [ [[package]] name = "udev-video-broker" -version = "0.8.27" +version = "0.9.0" dependencies = [ "akri-shared", "env_logger", @@ -4425,7 +4425,7 @@ dependencies = [ [[package]] name = "webhook-configuration" -version = "0.8.27" +version = "0.9.0" dependencies = [ "actix", "actix-rt 2.7.0", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index cc25fac8a..315025184 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "agent" -version = "0.8.27" +version = "0.9.0" authors = ["Kate Goldenring ", ""] edition = "2018" rust-version = "1.63.0" diff --git a/controller/Cargo.toml b/controller/Cargo.toml index e73e23bc3..77ebe5b52 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "controller" -version = "0.8.27" +version = "0.9.0" authors = ["", ""] edition = "2018" rust-version = "1.63.0" diff --git a/deployment/helm/Chart.yaml b/deployment/helm/Chart.yaml index a6a9d6208..c7b34aeda 100644 --- a/deployment/helm/Chart.yaml +++ b/deployment/helm/Chart.yaml @@ -15,9 +15,9 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.8.27 +version: 0.9.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 0.8.27 +appVersion: 0.9.0 diff --git a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml index f5d6a919a..a59ebe256 100644 --- a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "debug-echo-discovery-handler" -version = "0.8.27" +version = "0.9.0" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.63.0" diff --git a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml index eec635744..cfc2ab9eb 100644 --- a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "onvif-discovery-handler" -version = "0.8.27" +version = "0.9.0" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.63.0" diff --git a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml index 2e649b8e2..826a6fd05 100644 --- a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "opcua-discovery-handler" -version = "0.8.27" +version = "0.9.0" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.63.0" diff --git a/discovery-handler-modules/udev-discovery-handler/Cargo.toml b/discovery-handler-modules/udev-discovery-handler/Cargo.toml index 433b1f667..e90ea927d 100644 --- a/discovery-handler-modules/udev-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/udev-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "udev-discovery-handler" -version = "0.8.27" +version = "0.9.0" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.63.0" diff --git a/discovery-handlers/debug-echo/Cargo.toml b/discovery-handlers/debug-echo/Cargo.toml index 4d0dc9708..c5205f97c 100644 --- a/discovery-handlers/debug-echo/Cargo.toml +++ b/discovery-handlers/debug-echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-debug-echo" -version = "0.8.27" +version = "0.9.0" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.63.0" diff --git a/discovery-handlers/onvif/Cargo.toml b/discovery-handlers/onvif/Cargo.toml index 9385d969c..b01884bac 100644 --- a/discovery-handlers/onvif/Cargo.toml +++ b/discovery-handlers/onvif/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-onvif" -version = "0.8.27" +version = "0.9.0" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.63.0" diff --git a/discovery-handlers/opcua/Cargo.toml b/discovery-handlers/opcua/Cargo.toml index 7f3e151b9..0e3679887 100644 --- a/discovery-handlers/opcua/Cargo.toml +++ b/discovery-handlers/opcua/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-opcua" -version = "0.8.27" +version = "0.9.0" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.63.0" diff --git a/discovery-handlers/udev/Cargo.toml b/discovery-handlers/udev/Cargo.toml index 2391f25c6..4ffe5d3a8 100644 --- a/discovery-handlers/udev/Cargo.toml +++ b/discovery-handlers/udev/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-udev" -version = "0.8.27" +version = "0.9.0" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.63.0" diff --git a/discovery-handlers/udev/src/discovery_handler.rs b/discovery-handlers/udev/src/discovery_handler.rs index 493fe4933..77f44243c 100644 --- a/discovery-handlers/udev/src/discovery_handler.rs +++ b/discovery-handlers/udev/src/discovery_handler.rs @@ -1,4 +1,7 @@ -use super::{discovery_impl::do_parse_and_find, wrappers::udev_enumerator}; +use super::{ + discovery_impl::{do_parse_and_find, DeviceProperties}, + wrappers::udev_enumerator, +}; use akri_discovery_utils::discovery::{ discovery_handler::{deserialize_discovery_details, DISCOVERED_DEVICES_CHANNEL_CAPACITY}, v0::{ @@ -65,7 +68,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { } break; } - let mut devpaths: HashSet = HashSet::new(); + let mut devpaths: HashSet = HashSet::new(); udev_rules.iter().for_each(|rule| { let enumerator = udev_enumerator::create_enumerator(); let paths = do_parse_and_find(enumerator, rule).unwrap(); @@ -79,9 +82,12 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { ); let discovered_devices = devpaths .into_iter() - .map(|path| { + .map(|(path, node)| { let mut properties = std::collections::HashMap::new(); - properties.insert(super::UDEV_DEVNODE_LABEL_ID.to_string(), path.clone()); + if let Some(devnode) = node { + properties.insert(super::UDEV_DEVNODE_LABEL_ID.to_string(), devnode); + } + properties.insert(super::UDEV_DEVPATH_LABEL_ID.to_string(), path.clone()); let mount = Mount { container_path: path.clone(), host_path: path.clone(), diff --git a/discovery-handlers/udev/src/discovery_impl.rs b/discovery-handlers/udev/src/discovery_impl.rs index 618780dfa..e53bb0090 100644 --- a/discovery-handlers/udev/src/discovery_impl.rs +++ b/discovery-handlers/udev/src/discovery_impl.rs @@ -23,18 +23,21 @@ pub struct UdevFilter<'a> { value: String, } +/// A udev device is defined by its devpath and devnode (if exists) +pub(crate) type DeviceProperties = (String, Option); + /// This parses the udev rule into UdevFilters and finds all devices that match those filters pub fn do_parse_and_find( enumerator: impl Enumerator, udev_rule_string: &str, -) -> Result, anyhow::Error> { +) -> Result, anyhow::Error> { let udev_filters = parse_udev_rule(udev_rule_string)?; - let devpaths = find_devices(enumerator, udev_filters)?; + let devices = find_devices(enumerator, udev_filters)?; trace!( "do_parse_and_find - returning discovered devices with devpaths: {:?}", - devpaths + devices ); - Ok(devpaths) + Ok(devices) } /// This parses a udev rule and returns a list of UdevFilter objects that specify which devices to search for. @@ -103,7 +106,7 @@ fn parse_udev_rule(udev_rule_string: &str) -> Result, anyhow::Er fn find_devices( enumerator: impl Enumerator, udev_filters: Vec, -) -> std::io::Result> { +) -> std::io::Result> { let mut enumerator = enumerator; trace!("find_devices - enter with udev_filters {:?}", udev_filters); @@ -147,18 +150,13 @@ fn find_devices( let devices: Vec = enumerator.scan_devices()?.collect(); let final_devices = filter_by_remaining_udev_filters(devices, remaining_udev_filters); - let device_devpaths: Vec = final_devices + let device_devpaths: Vec = final_devices .into_iter() - .filter_map(|device| { - if let Some(devnode) = get_devnode(&device) { - Some(devnode.to_str().unwrap().to_string()) - } else { - trace!( - "find_devices - ignoring device with devpath {:?} due to having no devnode", - get_devpath(&device) - ); - None - } + .map(|device| { + ( + get_devpath(&device).to_str().unwrap().to_string(), + get_devnode(&device).map(|devnode| devnode.to_str().unwrap().to_string()), + ) }) .collect(); diff --git a/discovery-handlers/udev/src/lib.rs b/discovery-handlers/udev/src/lib.rs index 38a85da6d..433ca4fd8 100644 --- a/discovery-handlers/udev/src/lib.rs +++ b/discovery-handlers/udev/src/lib.rs @@ -10,8 +10,11 @@ mod discovery_impl; mod wrappers; /// Name of environment variable that is set in udev brokers. Contains devnode for udev device -/// the broker should connect to. +/// the broker should use. pub const UDEV_DEVNODE_LABEL_ID: &str = "UDEV_DEVNODE"; +/// Name of environment variable that is set in udev brokers. Contains devpath for udev device +/// the broker should connect to. +pub const UDEV_DEVPATH_LABEL_ID: &str = "UDEV_DEVPATH"; /// Name that udev discovery handlers use when registering with the Agent pub const DISCOVERY_HANDLER_NAME: &str = "udev"; /// Defines whether this discovery handler discovers local devices on nodes rather than ones visible to multiple nodes diff --git a/discovery-utils/Cargo.toml b/discovery-utils/Cargo.toml index ccb58fcc2..ce59be03c 100644 --- a/discovery-utils/Cargo.toml +++ b/discovery-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-discovery-utils" -version = "0.8.27" +version = "0.9.0" authors = ["Kate Goldenring "] edition = "2018" rust-version = "1.63.0" diff --git a/samples/brokers/udev-video-broker/Cargo.toml b/samples/brokers/udev-video-broker/Cargo.toml index 8b12e49f5..95b2f00c2 100644 --- a/samples/brokers/udev-video-broker/Cargo.toml +++ b/samples/brokers/udev-video-broker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "udev-video-broker" -version = "0.8.27" +version = "0.9.0" authors = ["Kate Goldenring ", ""] edition = "2018" rust-version = "1.63.0" diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 0a7a00cd0..465777611 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-shared" -version = "0.8.27" +version = "0.9.0" authors = [""] edition = "2018" rust-version = "1.63.0" diff --git a/version.txt b/version.txt index 54e9046cf..ac39a106c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.8.27 +0.9.0 diff --git a/webhooks/validating/configuration/Cargo.toml b/webhooks/validating/configuration/Cargo.toml index 8da9dbd41..61b64328d 100644 --- a/webhooks/validating/configuration/Cargo.toml +++ b/webhooks/validating/configuration/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "webhook-configuration" -version = "0.8.27" +version = "0.9.0" authors = ["DazWilkin "] edition = "2018" rust-version = "1.63.0"