config/unit: move Type() and Group() out of config

This commit is contained in:
Alex Crawford
2014-11-25 17:41:26 -08:00
parent 75ed8dacf9
commit 624df676d0
5 changed files with 122 additions and 55 deletions

View File

@@ -261,9 +261,6 @@ Address=10.209.171.177/19
if u.Name != "50-eth0.network" {
t.Errorf("Unit has incorrect name %s", u.Name)
}
if u.Type() != "network" {
t.Errorf("Unit has incorrect type '%s'", u.Type())
}
}
if cfg.Coreos.OEM.ID != "rackspace" {

View File

@@ -16,11 +16,6 @@
package config
import (
"path/filepath"
"strings"
)
type Unit struct {
Name string `yaml:"name"`
Mask bool `yaml:"mask"`
@@ -34,17 +29,3 @@ type Unit struct {
// until the correct behaviour for multiple drop-in units is determined.
DropIn bool `yaml:"-"`
}
func (u *Unit) Type() string {
ext := filepath.Ext(u.Name)
return strings.TrimLeft(ext, ".")
}
func (u *Unit) Group() string {
switch u.Type() {
case "network", "netdev", "link":
return "network"
default:
return "system"
}
}