Exemple #1
0
def update_host_md5(named_conf_md5):
    try:
        DnsdbApi.update_host_md5(CONF.host_ip, named_conf_md5)
    except Exception as e:
        send_alarm_email(u'主机%s更新named.conf文件成功,更新数据库失败\n原因%s' % (_get_local_hostname(), e))
        log.exception(e)
    return
Exemple #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)
Exemple #3
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)
Exemple #4
0
def update_host_md5(named_conf_md5):
    try:
        DnsdbApi.update_host_md5(CONF.host_ip, named_conf_md5)
    except Exception as e:
        send_alarm_email(u'主机%s更新named.conf文件成功,更新数据库失败\n原因%s' % (_get_local_hostname(), e))
        log.exception(e)
    return
Exemple #5
0
 def handler(self):
     log.info('%s worker start' % self.queue_name)
     try:
         zones = DnsdbApi.get_update_zones(self.queue_name)
         if zones:
             self.zone_handler(zones)
     except Exception as e:
         log.exception(e)
         send_alarm_email(u"[CRITICAL] Failed to handle zone update of %s, because: %s" %
                          (self.queue_name, e.message))
Exemple #6
0
def update_conf(update_type, group_name, params):
    if group_name != CONF.host_group:
        return send_alarm_email(
            u'Host %s group not match: local %s, param: %s' %
            (CONF.host_ip, CONF.host_group, group_name))
    print update_type, params
    start_update_thread(update_type, group_name=group_name, **params)
    return
Exemple #7
0
def update_named(group_name, group_conf_md5):
    if group_name != CONF.host_group:
        return send_alarm_email(
            u'Host %s group not match: local %s, param: %s' %
            (CONF.host_ip, CONF.host_group, group_name))
    start_update_thread('named.conf',
                        group_conf_md5=group_conf_md5,
                        group_name=group_name)
    return
Exemple #8
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)
Exemple #9
0
def update_named(group_name, group_conf_md5):
    if group_name != CONF.host_group:
        return send_alarm_email(
            u'Host %s group not match: local %s, param: %s' % (CONF.host_ip, CONF.host_group, group_name))
    start_update_thread('named.conf', group_conf_md5=group_conf_md5, group_name=group_name)
    return