Extract 'HasMode' as method on ipamConfig
This commit is contained in:
1 parent
57efe0145b
commit
0ca125ff2c
1 file changed
+5
-1
+5
-1
@@ -53,7 +53,7 @@ type dnsConfig struct {
|
|||||||
func (c *ipamConfig) Enabled() bool {
|
func (c *ipamConfig) Enabled() bool {
|
||||||
var (
|
var (
|
||||||
hasPeerCount = c.PeerCount > 0
|
hasPeerCount = c.PeerCount > 0
|
||||||
hasMode = len(c.Mode) > 0
|
hasMode = c.HasMode()
|
||||||
hasRange = c.IPRangeCIDR != ""
|
hasRange = c.IPRangeCIDR != ""
|
||||||
hasSubnet = c.IPSubnetCIDR != ""
|
hasSubnet = c.IPSubnetCIDR != ""
|
||||||
)
|
)
|
||||||
@@ -75,6 +75,10 @@ func (c *ipamConfig) Enabled() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c ipamConfig) HasMode() bool {
|
||||||
|
return len(c.Mode) > 0
|
||||||
|
}
|
||||||
|
|
||||||
func (c *ipamConfig) parseMode() error {
|
func (c *ipamConfig) parseMode() error {
|
||||||
modeAndParam := strings.SplitN(c.Mode, "=", 2)
|
modeAndParam := strings.SplitN(c.Mode, "=", 2)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user