refactor(unit): Separate UnitDestination from PlaceUnit

This commit is contained in:
Brian Waldon
2014-04-14 10:10:10 -07:00
parent 5981e12ac0
commit 476761cf62
3 changed files with 43 additions and 26 deletions

View File

@@ -133,9 +133,9 @@ func Apply(cfg CloudConfig, env *Environment) error {
for _, unit := range cfg.Coreos.Units {
if unit.Content != "" {
log.Printf("Writing unit %s to filesystem", unit.Name)
dst, err := system.PlaceUnit(&unit, env.Root())
if err != nil {
dst := system.UnitDestination(&unit, env.Root())
log.Printf("Writing unit %s to filesystem at path %s", unit.Name, dst)
if err := system.PlaceUnit(&unit, dst); err != nil {
return err
}
log.Printf("Placed unit %s at %s", unit.Name, dst)