コード例 #1
0
ファイル: test_zun_service.py プロジェクト: ppatel826/zun
    def test_update_zun_service(self, mock_update, mock_write, mock_read):
        mock_read.side_effect = etcd.EtcdKeyNotFound
        service = utils.create_test_zun_service()
        new_host = 'new-host'

        mock_read.side_effect = lambda *args: FakeEtcdResult(service.as_dict())
        dbapi.update_zun_service(service.host, service.binary,
                                 {'host': new_host})
        self.assertEqual(
            new_host,
            json.loads(mock_update.call_args_list[0][0][0].value)['host'])
コード例 #2
0
    def save(self, context=None):
        """Save updates to this ZunService.

        Updates will be made column by column based on the result
        of self.what_changed().

        :param context: Security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: ZunService(context)
        """
        updates = self.obj_get_changes()
        dbapi.update_zun_service(self.host, self.binary, updates)
        self.obj_reset_changes()
コード例 #3
0
ファイル: zun_service.py プロジェクト: openstack/higgins
    def save(self, context=None):
        """Save updates to this ZunService.

        Updates will be made column by column based on the result
        of self.what_changed().

        :param context: Security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: ZunService(context)
        """
        updates = self.obj_get_changes()
        dbapi.update_zun_service(self.host, self.binary, updates)
        self.obj_reset_changes()