(post_data, analyst)
return status
Update the TAXII Service config in the DB.

    :return dictionary
Update the TAXII Service config in the DB.
Update the TAXII Service config in the DB .
def update_taxii_service_config(post_data, analyst):
    """
    Update the TAXII Service config in the DB.

    :return dictionary
    """
    status = {'success': False}
    service = CRITsService.objects(name='taxii_service',
                                   status__ne="unavailable").first()
    if not service:
        msg = 'Service "%s" is unavailable. Please review error logs.' % name
        status['config_error'] = msg
        status['form'] = ''
        status['service'] = ''
        return status

    # Get the class that implements this service.
    from . import TAXIIClient
    taxii_class = TAXIIClient()

    config = service.config.to_dict()
    cfg_form, html = taxii_class.generate_config_form(config)
    # This isn't a form object. It's the HTML.
    status['form'] = html
    status['service'] = service

    if post_data:
        #Populate the form with values from the POST request
        form = cfg_form([], post_data)
        if form.is_valid():
            try:
                taxii_class.parse_service_config(form.cleaned_data)
            except ServiceConfigError as e:
                service.status = 'misconfigured'
                service.save()
                status['config_error'] = str(e)
                return status

            form.cleaned_data['taxii_servers'] = config['taxii_servers']
            result = update_config('taxii_service',
                                   form.cleaned_data, analyst)

            if not result['success']:
                return status

            service.status = 'available'
            service.save()
        else:
            status['config_error'] = form.errors
            return status

    status['success'] = True
    return status
def update_taxii_service_config ( post_data , analyst ) : status = { 'success' : False } service = CRITsService . objects ( name = 'taxii_service' , status__ne = "unavailable" ) . first ( ) if not service : msg = 'Service "%s" is unavailable. Please review error logs.' % name status [ 'config_error' ] = msg status [ 'form' ] = '' status [ 'service' ] = '' return status # Get the class that implements this service. from . import TAXIIClient taxii_class = TAXIIClient ( ) config = service . config . to_dict ( ) cfg_form , html = taxii_class . generate_config_form ( config ) # This isn't a form object. It's the HTML. status [ 'form' ] = html status [ 'service' ] = service if post_data : #Populate the form with values from the POST request form = cfg_form ( [ ] , post_data ) if form . is_valid ( ) : try : taxii_class . parse_service_config ( form . cleaned_data ) except ServiceConfigError as e : service . status = 'misconfigured' service . save ( ) status [ 'config_error' ] = str ( e ) return status form . cleaned_data [ 'taxii_servers' ] = config [ 'taxii_servers' ] result = update_config ( 'taxii_service' , form . cleaned_data , analyst ) if not result [ 'success' ] : return status service . status = 'available' service . save ( ) else : status [ 'config_error' ] = form . errors return status status [ 'success' ] = True return status