示例#1
0
    def run(self):
        msg = ''
        is_success = True
        try:
            if self.group_name != CONF.host_group:
                raise UpdaterErr(
                    u'Host %s group not match: local %s, param: %s' %
                    (CONF.host_ip, CONF.host_group, self.group_name))
            if self.update_type == 'named.conf':
                self.update_named()
            elif self.update_type == 'acl':
                self.update_acl()
            elif self.update_type == 'zone':
                self.init_zone()
            else:
                raise UpdaterErr('No worker for this type of update: %s' %
                                 self.update_type)

        except Exception as e:
            send_alarm_email(u'更新文件失败\n主机: %s\n, 类型: %s, 原因: %s' %
                             (_get_local_hostname(), self.update_type, e))
            log.exception(e)
            msg = str(e)
            is_success = False

        deploy_id = self.kwargs.get('deploy_id', None)
        if deploy_id:
            DnsdbApi.update_deploy_info(deploy_id, is_success, msg)
示例#2
0
    def run(self):
        msg = ''
        is_success = True
        try:
            if self.group_name != CONF.host_group:
                raise UpdaterErr(u'Host %s group not match: local %s, param: %s' %
                                 (CONF.host_ip, CONF.host_group, self.group_name))
            if self.update_type == 'named.conf':
                self.update_named()
            elif self.update_type == 'acl':
                self.update_acl()
            elif self.update_type == 'zone':
                self.init_zone()
            else:
                raise UpdaterErr('No worker for this type of update: %s' % self.update_type)

        except Exception as e:
            send_alarm_email(u'更新文件失败\n主机: %s\n, 类型: %s, 原因: %s' % (_get_local_hostname(), self.update_type, e))
            log.exception(e)
            msg = str(e)
            is_success = False

        deploy_id = self.kwargs.get('deploy_id', None)
        if deploy_id:
            DnsdbApi.update_deploy_info(deploy_id, is_success, msg)
示例#3
0
    def run(self):
        msg = ''
        is_success = True
        try:
            if self.update_type == 'named.conf':
                self.update_named()
            elif self.update_type == 'acl':
                self.update_acl()

        except Exception as e:
            send_alarm_email(u'更新文件失败\n主机: %s\n原因: %s' %
                             (_get_local_hostname(), e))
            log.exception(e)
            msg = str(e)
            is_success = False

        deploy_id = self.kwargs.get('deploy_id', None)
        if deploy_id:
            DnsdbApi.update_deploy_info(deploy_id, is_success, msg)