~larryprice/libertine/snap-for-1.6

« back to all changes in this revision

Viewing changes to python/libertine/lifecycle/ContainerLifecycleService.py

  • Committer: Tarmac
  • Author(s): Larry Price
  • Date: 2017-01-12 20:02:42 UTC
  • mfrom: (302.35.5 lxd-wait-stop)
  • Revision ID: tarmac-20170112200242-247r03mvb2ei1zft
Manually wait for lxd container to stop when specified after calling the service. Fixes: https://bugs.launchpad.net/bugs/1655980.

Approved by Christopher Townsend, Libertine CI Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    def start(self, container):
47
47
        raise NotImplementedError("Subclasses must implement start(container)")
48
48
 
49
 
    def stop(self, container):
 
49
    def stop(self, container, options={}):
50
50
        raise NotImplementedError("Subclasses must implement stop(container)")
51
51
 
52
52
    @dbus.service.method(LIBERTINE_CONTAINER_LIFECYCLE_INTERFACE,
94
94
        return result.to_dict()
95
95
 
96
96
    @dbus.service.method(LIBERTINE_CONTAINER_LIFECYCLE_INTERFACE,
97
 
                         in_signature='s',
 
97
                         in_signature='sa{ss}',
98
98
                         out_signature='a{ss}')
99
 
    def operation_stop(self, container):
100
 
        utils.get_logger().debug("operation_stop({})".format(container))
 
99
    def operation_stop(self, container, options={}):
 
100
        utils.get_logger().debug("operation_stop({}, {})".format(container, options))
101
101
        self._operations[container] -= 1
102
102
        result = LifecycleResult()
103
103
 
104
104
        if self._operations[container] == 0:
105
 
            result = self.stop(container)
 
105
            result = self.stop(container, options)
106
106
            del self._operations[container]
107
107
 
108
108
        return result.to_dict()