Add Device.Managed

This commit is contained in:
Christian Müller 2019-05-16 16:42:06 +02:00
parent d277069c44
commit 5c25f8b28d

View file

@ -13,6 +13,7 @@ const (
DevicePropertyInterface = DeviceInterface + ".Interface" DevicePropertyInterface = DeviceInterface + ".Interface"
DevicePropertyIpInterface = DeviceInterface + ".IpInterface" DevicePropertyIpInterface = DeviceInterface + ".IpInterface"
DevicePropertyState = DeviceInterface + ".State" DevicePropertyState = DeviceInterface + ".State"
DevicePropertyManaged = DeviceInterface + ".Managed"
DevicePropertyIP4Config = DeviceInterface + ".Ip4Config" DevicePropertyIP4Config = DeviceInterface + ".Ip4Config"
DevicePropertyDeviceType = DeviceInterface + ".DeviceType" DevicePropertyDeviceType = DeviceInterface + ".DeviceType"
DevicePropertyAvailableConnections = DeviceInterface + ".AvailableConnections" DevicePropertyAvailableConnections = DeviceInterface + ".AvailableConnections"
@ -77,6 +78,12 @@ type Device interface {
// connection that is currently 'available' through this device. // connection that is currently 'available' through this device.
GetAvailableConnections() []Connection GetAvailableConnections() []Connection
// Whether or not this device is managed by NetworkManager. Setting this property
// has a similar effect to configuring the device as unmanaged via the
// keyfile.unmanaged-devices setting in NetworkManager.conf. Changes to this value
// are not persistent and lost after NetworkManager restart.
GetManaged() bool
MarshalJSON() ([]byte, error) MarshalJSON() ([]byte, error)
} }
@ -156,6 +163,10 @@ func (d *device) GetAvailableConnections() []Connection {
return conns return conns
} }
func (d *device) GetManaged() bool {
return d.getBoolProperty(DevicePropertyManaged)
}
func (d *device) marshalMap() map[string]interface{} { func (d *device) marshalMap() map[string]interface{} {
return map[string]interface{}{ return map[string]interface{}{
"Interface": d.GetInterface(), "Interface": d.GetInterface(),