~james-page/ubuntu/wily/juju-core/mir-fixes

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/state/cleanup.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-03-28 08:58:42 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20140328085842-cyzrgc120bdfxwj0
Tags: 1.17.7-0ubuntu1
* New upstream point release, including fixes for:
  - no debug log with all providers on Ubuntu 14.04 (LP: #1294776).
* d/control: Add cpu-checker dependency to juju-local (LP: #1297077).

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
        if err := st.cleanupContainers(machine); err != nil {
155
155
                return err
156
156
        }
 
157
        if err := st.cleanupNetworks(machineGlobalKey(machineId)); err != nil {
 
158
                return err
 
159
        }
157
160
        for _, unitName := range machine.doc.Principals {
158
161
                if err := st.obliterateUnit(unitName); err != nil {
159
162
                        return err
206
209
        return nil
207
210
}
208
211
 
 
212
// cleanupNetworks removes associated networks for a machine or
 
213
// service, given by its global key.
 
214
func (st *State) cleanupNetworks(globalKey string) error {
 
215
        op := removeNetworksOp(st, globalKey)
 
216
        if err := st.runTransaction([]txn.Op{op}); err != nil {
 
217
                logger.Warningf("cannot remove networks document for %q: %v", globalKey, err)
 
218
        }
 
219
        return nil
 
220
}
 
221
 
209
222
// obliterateUnit removes a unit from state completely. It is not safe or
210
223
// sane to obliterate any unit in isolation; its only reasonable use is in
211
224
// the context of machine obliteration, in which we can be sure that unclean