-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetworkManager.Settings.Connection cannot round-trip, calling Update with what GetSettings returned #124
Comments
I've had success on my machine with applying this transformation between def fix_types(settings)
types = {
"connection.permissions" => "as",
"802-11-wireless.mac-address" => "ay",
"802-11-wireless.mac-address-blacklist" => "as",
"802-11-wireless.ssid" => "ay",
"ipv4.address-data" => "aa{sv}",
"ipv4.addresses" => "aau",
"ipv4.dns" => "au",
"ipv4.dns-search" => "as",
"ipv4.route-data" => "aa{sv}",
"ipv4.routes" => "aau",
"ipv6.address-data" => "aa{sv}",
"ipv6.addresses" => "a(ayuay)",
"ipv6.dns" => "aay",
"ipv6.dns-search" => "as",
"ipv6.route-data" => "aa{sv}",
"ipv6.routes" => "a(ayuayu)"
}
types.each do |dot_prop, type|
section, prop = dot_prop.split "."
settings[section][prop] = ::DBus::Data.make_typed(type, settings[section][prop])
end
end
fix_types(conn_settings) See https://www.rubydoc.info/gems/ruby-dbus/0.18.1/DBus/Data#make_typed-class_method "A-Ayu-Ayu!" is my favorite type from now on! |
In general, I'd like to improve the library so that you'll be able to specify that a method call (like |
It works just fine. Having an API to do this kind of type annotation is more than enough for us. Thanks! |
(reported by @imobachgs)
We would like to use ruby-dbus to interact with NetworkManager through D-Bus. The following example tries to use the method to
Update
a connection. It basically asks for the current configuration (GetSettings
) an tries to apply the same configuration (callingUpdate
).However, it fails because data types for empty values (empty arrays and hashes) are not what NetworkManager expects. Our guess is that there is no typing information available, so ruby-dbus cannot figure out what to send in such cases.
Even if we do not send any empty attribute (cleaning up the settings), we find an additional problem with
ipv4.address-data
:Are our assumptions right? Do we have a way to workaround this problem?
Thanks!
The text was updated successfully, but these errors were encountered: