Пример #1
0
def needs_update(module, data):
    res = False

    if module.params['mode'] and module.params['mode'] != data['mode']:
        data['mode'] = module.params['mode']
        res = True
    if module.params['status'] and module.params['status'] != data['status']:
        data['status'] = module.params['status']
        res = True
    if module.params['IPandMask'] and module.params['IPandMask'] != data['ip']:
        data['ip'] = module.params['IPandMask']
        res = True
    if module.params['IPv6andMask'] and module.params['IPv6andMask'] != data['ipv6']:
        data['ipv6'] = module.params['IPv6andMask']
        res = True
    if module.params['mtu'] and module.params['mtu'] != data['mtu']:
        data['mtu'] = module.params['mtu']
        res = True
    if module.params['intf_type'] and module.params['intf_type'] != data['type']:
        data['type'] = module.params['intf_type']
        res = True
    if list_need_update(module.params['allowaccess'], data['allowaccess']):
        data['allowaccess'] = list_to_str(module.params['allowaccess'])
        res = True
    if list_need_update(module.params['redundant_member'], data['redundant-member']):
        data['redundant-member'] = list_to_str(module.params['redundant_member'])
        res = True

    return res, data
Пример #2
0
def needs_update(module, data):
    res = False

    if module.params['iptype'] and module.params['iptype'] != data['pool_type']:
        data['pool_type'] = module.params['iptype']
        res = True
    if module.params['healthcheck'] and module.params['healthcheck'] != data[
            'health_check']:
        data['health_check'] = module.params['healthcheck']
        res = True
    if module.params['health_check_relationship'] and module.params[
            'health_check_relationship'] != data['health_check_relationship']:
        data['health_check_relationship'] = module.params[
            'health_check_relationship']
        res = True
    if list_need_update(module.params['health_check_list'],
                        data['health_check_list']):
        data['health_check_list'] = list_to_str(
            module.params['health_check_list'])
        res = True
    if module.params['rs_profile'] and module.params['rs_profile'] != data[
            'rs_profile']:
        data['rs_profile'] = module.params['rs_profile']
        res = True
    return res, data
def needs_update(module, data):
    res = False

    if module.params['iptype'] and module.params['iptype'] != data['pool_type']:
        data['pool_type'] = module.params['iptype']
        res = True
    if module.params['healthcheck'] and module.params['healthcheck'] != data[
            'health_check']:
        data['health_check'] = module.params['healthcheck']
        res = True
    if module.params['health_check_relationship'] and module.params[
            'health_check_relationship'] != data['health_check_relationship']:
        data['health_check_relationship'] = module.params[
            'health_check_relationship']
        res = True
    logger.debug(module.params['health_check_list'])
    if list_need_update(module.params['health_check_list'],
                        data['health_check_list']):
        logger.debug("needs update")
        data['health_check_list'] = list_to_str(
            module.params['health_check_list']).decode('utf-8')
        logger.debug(data['health_check_list'])
        res = True
    if module.params['rs_profile'] and module.params['rs_profile'] != data[
            'rs_profile']:
        data['rs_profile'] = module.params['rs_profile']
        res = True
    return res, data
def needs_update(module, data):
    res = False

    if module.params['status'] and module.params['status'] != data['status']:
        data['status'] = module.params['status']
        res = True
    if module.params['rs'] and module.params['rs'] != data['real_server_id']:
        data['real_server_id'] = module.params['rs']
        res = True
    if module.params['port'] and module.params['port'] != data['port']:
        data['port'] = module.params['port']
        res = True
    if module.params['recover'] and module.params['recover'] != data['recover']:
        data['recover'] = module.params['recover']
        res = True
    if module.params['rs_profile_inherit'] and module.params[
            'rs_profile_inherit'] != data['rs_profile_inherit']:
        data['rs_profile_inherit'] = module.params['rs_profile_inherit']
        res = True
    if module.params['weight'] and module.params['weight'] != data['weight']:
        data['weight'] = module.params['weight']
        res = True
    if module.params['warmup'] and module.params['warmup'] != data['warmup']:
        data['warmup'] = module.params['warmup']
        res = True
    if module.params[
            'warmrate'] and module.params['warmrate'] != data['warmrate']:
        data['warmrate'] = module.params['warmrate']
        res = True
    if module.params[
            'connlimit'] and module.params['connlimit'] != data['connlimit']:
        data['connlimit'] = module.params['connlimit']
        res = True
    if module.params['connection_ratelimit'] and module.params[
            'connection_ratelimit'] != data['connection-rate-limit']:
        data['connection-rate-limit'] = module.params['connection_ratelimit']
        res = True
    if module.params['cookie'] and module.params['cookie'] != data['cookie']:
        data['cookie'] = module.params['cookie']
        res = True
    if module.params['health_check_inherit'] and module.params[
            'health_check_inherit'] != data['health_check_inherit']:
        data['health_check_inherit'] = module.params['health_check_inherit']
        res = True
    if module.params['health_check'] and module.params['health_check'] != data[
            'm_health_check']:
        data['m_health_check'] = module.params['health_check']
        res = True
    if list_need_update(module.params['health_check_list'],
                        data['m_health_check_list']):
        data['m_health_check_list'] = list_to_str(
            module.params['health_check_list'])
        res = True
    if module.params['health_check_relationship'] and module.params[
            'health_check_relationship'] != data['m_health_check_relationship']:
        data['m_health_check_relationship'] = module.params[
            'health_check_relationship']
        res = True
    if module.params['mysql_group_id'] and module.params[
            'mysql_group_id'] != data['mysql_group_id']:
        data['mysql_group_id'] = module.params['mysql_group_id']
        res = True
    if module.params['mysql_read_only'] and module.params[
            'mysql_read_only'] != data['mysql_read_only']:
        data['mysql_read_only'] = module.params['mysql_read_only']
        res = True
    if module.params['backup'] and module.params['backup'] != data['backup']:
        data['backup'] = module.params['backup']
        res = True
    if module.params['rs_profile'] and module.params['rs_profile'] != data[
            'rs_profile']:
        data['rs_profile'] = module.params['rs_profile']
        res = True

    return res, data
Пример #5
0
def needs_update(module, data):
    res = False

    if module.params['status'] and module.params['status'] != data['status']:
        data['status'] = module.params['status']
        res = True
    if module.params['iptype'] and module.params['iptype'] != data['addr-type']:
        data['addr-type'] = module.params['iptype']
        res = True
    if data['addr-type'] == 'ipv4' and module.params[
            'ip'] and module.params['ip'] != data['address']:
        data['address'] = module.params['ip']
        res = True
    if data['addr-type'] == 'ipv6' and module.params[
            'ip'] and module.params['ip'] != data['address6']:
        data['address6'] = module.params['ip']
        res = True
    if module.params['public_iptype'] and module.params[
            'public_iptype'] != data['public-ip-type']:
        data['public-ip-type'] = module.params['public_iptype']
        res = True
    if data['public-ip-type'] == 'ipv4' and module.params[
            'public_ip'] and module.params['public_ip'] != data['public-ip']:
        data['public-ip'] = module.params['public_ip']
        res = True
    if data['public-ip-type'] == 'ipv6' and module.params[
            'public_ip'] and module.params['public_ip'] != data['public-ip6']:
        data['public-ip6'] = module.params['public_ip']
        res = True
    if module.params[
            'interface'] and module.params['interface'] != data['interface']:
        data['interface'] = module.params['interface']
        res = True
    if module.params['status'] and module.params['status'] != data['status']:
        data['status'] = module.params['status']
        res = True
    if module.params['pool'] and module.params['pool'] != data['pool']:
        data['pool'] = module.params['pool']
        res = True
    if module.params['port'] and module.params['port'] != data['port']:
        data['port'] = module.params['port']
        res = True
    if module.params['alone'] and module.params['alone'] != data['alone']:
        data['alone'] = module.params['alone']
        res = True
    if module.params['vstype'] and module.params['vstype'] != data['type']:
        data['type'] = module.params['vstype']
        res = True
    if module.params['profile'] and module.params['profile'] != data['profile']:
        data['profile'] = module.params['profile']
        res = True
    if module.params['method'] and module.params['method'] != data['method']:
        data['method'] = module.params['method']
        res = True
    if module.params['ssl_mirror'] and module.params['ssl_mirror'] != data[
            'ssl-mirror']:
        data['ssl-mirror'] = module.params['ssl_mirror']
        res = True
    if module.params['ssl_mirror_intf'] and module.params[
            'ssl_mirror_intf'] != data['ssl-mirror-intf']:
        data['ssl-mirror-intf'] = module.params['ssl_mirror_intf']
        res = True
    if module.params['traffic_group'] and module.params[
            'traffic_group'] != data['traffic-group']:
        data['traffic-group'] = module.params['traffic_group']
        res = True
    if module.params['traffic_group'] and module.params[
            'traffic_group'] != data['traffic-log']:
        data['traffic-log'] = module.params['traffic_group']
        res = True
    if module.params['traffic_log'] and module.params['traffic_log'] != data[
            'traffic-log']:
        data['traffic-log'] = module.params['traffic_log']
        res = True
    if module.params['trans_rate_limit'] and module.params[
            'trans_rate_limit'] != data['trans-rate-limit']:
        data['trans-rate-limit'] = module.params['trans_rate_limit']
        res = True
    if module.params[
            'warmrate'] and module.params['warmrate'] != data['warmrate']:
        data['warmrate'] = module.params['warmrate']
        res = True
    if module.params['warmup'] and module.params['warmup'] != data['warmup']:
        data['warmup'] = module.params['warmup']
        res = True
    if module.params['av_profile'] and module.params['av_profile'] != data[
            'av-profile']:
        data['av-profile'] = module.params['av_profile']
        res = True
    if module.params['client_ssl_profile'] and module.params[
            'client_ssl_profile'] != data['client_ssl_profile']:
        data['client_ssl_profile'] = module.params['client_ssl_profile']
        res = True
    if module.params['clone_pool'] and module.params['clone_pool,'] != data[
            'clone-pool']:
        data['clone-pool'] = module.params['clone_pool,']
        res = True
    if module.params['clone_traffic_type'] and module.params[
            'clone_traffic_type'] != data['clone-traffic-type']:
        data['clone-traffic-type'] = module.params['clone_traffic_type']
        res = True
    if module.params['connection_limit'] and module.params[
            'connection_limit'] != data['connection-limit']:
        data['connection-limit'] = module.params['connection_limit']
        res = True
    if module.params['connection_rate_limit'] and module.params[
            'connection_rate_limit'] != data['connection-rate-limit']:
        data['connection-rate-limit'] = module.params['connection_rate_limit']
        res = True
    if module.params['content_rewriting'] and module.params[
            'content_rewriting'] != data['content-rewriting']:
        data['content-rewriting'] = module.params['content_rewriting']
        res = True
    if module.params['content_rewriting_list'] and module.params[
            'content_rewriting_list'] != data['content-rewriting-list']:
        data['content-rewriting-list'] = module.params[
            'content_rewriting_list,']
        res = True
    if module.params['content_routing'] and module.params[
            'content_routing'] != data['content-routing']:
        data['content-routing'] = module.params['content_routing']
        res = True
    if list_need_update(module.params['content_routing_list'],
                        data['content-routing-list']):
        data['content-routing-list'] = list_to_str(
            module.params['content_routing_list'])
        res = True
    if module.params['schedule_list'] and module.params[
            'schedule_list'] != data['schedule-list']:
        data['schedule-list'] = module.params['schedule_list']
        res = True
    if list_need_update(module.params['schedule_pool_list'],
                        data['schedule-pool-list']):
        data['schedule-pool-list'] = list_to_str(
            module.params['schedule_pool_list'])
        res = True
    if module.params['scripting_flag'] and module.params[
            'scripting_flag'] != data['scripting_flag']:
        data['scripting_flag'] = module.params['scripting_flag']
        res = True
    if list_need_update(module.params['scripting_list'],
                        data['scripting_list']):
        data['scripting_list'] = list_to_str(module.params['scripting_list'])
        res = True
    if list_need_update(module.params['source_pool_list'],
                        data['schedule-pool-list']):
        data['schedule-pool-list'] = list_to_str(
            module.params['source_pool_list'])
        res = True
    if module.params['waf_profile'] and module.params['waf_profile'] != data[
            'waf-profile']:
        data['waf-profile'] = module.params['waf_profile']
        res = True
    if module.params['http2https'] and module.params['http2https'] != data[
            'http2https']:
        data['http2https'] = module.params['http2https']
        res = True
    if module.params['http2https_port'] and module.params[
            'http2https_port'] != data['http2https-port']:
        data['http2https-port'] = module.params['http2https_port']
        res = True
    if module.params['l2_exception_list'] and module.params[
            'l2_exception_list'] != data['l2-exception-list']:
        data['l2-exception-list'] = module.params['l2_exception_list']
        res = True
    if module.params['packet_fwd_method'] and module.params[
            'packet_fwd_method'] != data['packet-fwd-method']:
        data['packet-fwd-method'] = module.params['packet_fwd_method']
        res = True
    if module.params[
            'pagespeed'] and module.params['pagespeed'] != data['pagespeed']:
        data['pagespeed'] = module.params['pagespeed']
        res = True
    if module.params['persistence'] and module.params['persistence'] != data[
            'persistence']:
        data['persistence'] = module.params['persistence']
        res = True
    if module.params[
            'protocol'] and module.params['protocol'] != data['protocol']:
        data['protocol'] = module.params['protocol']
        res = True
    if module.params['adfs_published_service'] and module.params[
            'adfs_published_service'] != data['adfs-published-service']:
        data['adfs-published-service'] = module.params[
            'adfs_published_service']
        res = True
    if module.params[
            'error_msg'] and module.params['error_msg'] != data['error-msg']:
        data['error-msg'] = module.params['error_msg']
        res = True
    if module.params['error_page'] and module.params['error_page,'] != data[
            'error-page']:
        data['error-page'] = module.params['error_page,']
        res = True
    if module.params[
            'comments'] and module.params['comments'] != data['comments']:
        data['comments'] = module.params['comments']
        res = True
    if module.params[
            'fortiview'] and module.params['fortiview'] != data['fortiview']:
        data['fortiview'] = module.params['fortiview']
        res = True
    if module.params['wccp'] and module.params['wccp'] != data['wccp']:
        data['wccp'] = module.params['wccp']
        res = True

    return res, data