2014-09-21 19:28:04 -07:00
|
|
|
package system
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/coreos/coreos-cloudinit/config"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Fleet is a top-level structure which embeds its underlying configuration,
|
|
|
|
// config.Fleet, and provides the system-specific Unit().
|
|
|
|
type Fleet struct {
|
|
|
|
config.Fleet
|
|
|
|
}
|
|
|
|
|
|
|
|
// Units generates a Unit file drop-in for fleet, if any fleet options were
|
|
|
|
// configured in cloud-config
|
2014-09-21 19:22:13 -07:00
|
|
|
func (fe Fleet) Units() ([]Unit, error) {
|
2014-09-21 19:28:04 -07:00
|
|
|
content := dropinContents(fe.Fleet)
|
|
|
|
if content == "" {
|
|
|
|
return nil, nil
|
|
|
|
}
|
2014-09-21 19:22:38 -07:00
|
|
|
return []Unit{{config.Unit{
|
2014-09-21 19:28:04 -07:00
|
|
|
Name: "fleet.service",
|
|
|
|
Runtime: true,
|
|
|
|
DropIn: true,
|
|
|
|
Content: content,
|
2014-09-21 19:22:38 -07:00
|
|
|
}}}, nil
|
2014-09-21 19:28:04 -07:00
|
|
|
}
|