ActiveCOnnection : do not create an object if the path is '/', return nil instead
This commit is contained in:
parent
7525115948
commit
2b5c8106ad
1 changed files with 6 additions and 18 deletions
|
@ -160,26 +160,18 @@ func (a *activeConnection) GetPropertyDefault() (bool, error) {
|
||||||
|
|
||||||
func (a *activeConnection) GetPropertyIP4Config() (IP4Config, error) {
|
func (a *activeConnection) GetPropertyIP4Config() (IP4Config, error) {
|
||||||
path, err := a.getObjectProperty(ActiveConnectionPropertyIp4Config)
|
path, err := a.getObjectProperty(ActiveConnectionPropertyIp4Config)
|
||||||
if err != nil {
|
if err != nil || path == "/" {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
r, err := NewIP4Config(path)
|
return NewIP4Config(path)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return r, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *activeConnection) GetPropertyDHCP4Config() (DHCP4Config, error) {
|
func (a *activeConnection) GetPropertyDHCP4Config() (DHCP4Config, error) {
|
||||||
path, err := a.getObjectProperty(ActiveConnectionPropertyDhcp4Config)
|
path, err := a.getObjectProperty(ActiveConnectionPropertyDhcp4Config)
|
||||||
if err != nil {
|
if err != nil || path == "/" {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
r, err := NewDHCP4Config(path)
|
return NewDHCP4Config(path)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return r, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *activeConnection) GetPropertyDefault6() (bool, error) {
|
func (a *activeConnection) GetPropertyDefault6() (bool, error) {
|
||||||
|
@ -214,12 +206,8 @@ func (a *activeConnection) GetPropertyVPN() (bool, error) {
|
||||||
|
|
||||||
func (a *activeConnection) GetPropertyMaster() (Device, error) {
|
func (a *activeConnection) GetPropertyMaster() (Device, error) {
|
||||||
path, err := a.getObjectProperty(ActiveConnectionPropertyMaster)
|
path, err := a.getObjectProperty(ActiveConnectionPropertyMaster)
|
||||||
if err != nil {
|
if err != nil || path == "/" {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
r, err := DeviceFactory(path)
|
return DeviceFactory(path)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return r, nil
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue