Extract 'HasMode' as method on ipamConfig

This commit is contained in:
Bryan Boreham committed 2017-04-10 16:42:28 +00:00
1 parent 57efe0145b
commit 0ca125ff2c
1 file changed
+5 -1
+5 -1
View File
@@ -53,7 +53,7 @@ type dnsConfig struct {
func (c *ipamConfig) Enabled() bool {
var (
hasPeerCount = c.PeerCount > 0
hasMode = len(c.Mode) > 0
hasMode = c.HasMode()
hasRange = c.IPRangeCIDR != ""
hasSubnet = c.IPSubnetCIDR != ""
)
@@ -75,6 +75,10 @@ func (c *ipamConfig) Enabled() bool {
return true
}
func (c ipamConfig) HasMode() bool {
return len(c.Mode) > 0
}
func (c *ipamConfig) parseMode() error {
modeAndParam := strings.SplitN(c.Mode, "=", 2)