示例#1
0
    def test_call_notify_timeout(self, mock_notify):
        mock_notify.side_effect = dns.exception.Timeout()
        self.zone = objects.Zone(name='example.org.')
        self.actor = zone.SendNotify(
            self.executor,
            self.zone,
            self.target,
        )

        self.assertRaises(dns.exception.Timeout, self.actor)
示例#2
0
    def test_call_dont_notify(self, mock_notify):
        CONF.set_override('notify', False, 'service:worker')

        self.zone = objects.Zone(name='example.org.')
        self.actor = zone.SendNotify(
            self.executor,
            self.zone,
            self.target,
        )

        self.assertTrue(self.actor())

        mock_notify.assert_not_called()
示例#3
0
    def test_call_notify(self, mock_notify):
        self.zone = objects.Zone(name='example.org.')
        self.actor = zone.SendNotify(
            self.executor,
            self.zone,
            self.target,
        )

        self.assertTrue(self.actor())

        mock_notify.assert_called_once_with(self.zone.name,
                                            '127.0.0.1',
                                            port=53)
示例#4
0
    def _do_zone_action(self, context, zone):
        pool = self.get_pool(zone.pool_id)
        all_tasks = []
        all_tasks.append(
            zonetasks.ZoneAction(self.executor, context, pool, zone,
                                 zone.action))

        # Send a NOTIFY to each also-notifies
        for also_notify in pool.also_notifies:
            notify_target = AlsoNotifyTask()
            notify_target.options = {
                'host': also_notify.host,
                'port': also_notify.port
            }
            all_tasks.append(
                zonetasks.SendNotify(self.executor, zone, notify_target))
        return self.executor.run(all_tasks)