~hazmat/pyjuju/proposed-support

« back to all changes in this revision

Viewing changes to juju/agents/unit.py

  • Committer: kapil.thangavelu at canonical
  • Date: 2012-05-22 22:08:15 UTC
  • mfrom: (484.1.53 trunk)
  • Revision ID: kapil.thangavelu@canonical.com-20120522220815-acyt8m89i9ybe0w1
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 
56
56
        self.api_factory = UnitSettingsFactory(
57
57
            self.executor.get_hook_context,
 
58
            self.executor.get_invoker,
58
59
            logging.getLogger("unit.hook.api"))
59
60
        self.api_socket = None
60
61
        self.workflow = None
193
194
        with (yield self.workflow.lock()):
194
195
            state = yield self.workflow.get_state()
195
196
            if state != "started":
 
197
                if upgrade_flag["force"]:
 
198
                    yield self.lifecycle.upgrade_charm(
 
199
                        fire_hooks=False, force=True)
 
200
                    log.info("Forced upgrade complete")
 
201
                    return
196
202
                log.warning(
197
203
                    "Cannot upgrade: unit is in non-started state %s. Reissue "
198
204
                    "upgrade command to try again.", state)
212
218
            current_state = yield self.workflow.get_state()
213
219
            log.debug("Configuration Changed")
214
220
 
215
 
            if  current_state != "started":
 
221
            if current_state != "started":
216
222
                log.debug(
217
223
                    "Configuration updated on service in a non-started state")
218
224
                returnValue(None)