// remove will remove the supplied unit from state. It will panic if it // observes inconsistent internal state. func (d *Deployer) remove(unit *apideployer.Unit) error { unitName := unit.Name() if d.deployed.Contains(unitName) { panic("must not remove a deployed unit") } else if unit.Life() == params.Alive { panic("must not remove an Alive unit") } logger.Infof("removing unit %q", unitName) return unit.Remove() }