Next steps - Platform - BlueCat Gateway - 18.2.1

Gateway Administration Guide

prodname
BlueCat Gateway
version_custom
18.2.1
  1. If the module_reload variable is set to false (default) in <dns_integrity_gateway>/config.py, restart the DNS Integrity Gateway.
  2. Set access permissions for your workflow either from the Workflow Permissions page in the DNS Integrity Gateway user interface or from <dns_integrity_gateway>/permissions.json. Once permissions are set, the new workflow will appear in the Available Actions menu.




  3. Modify the _page.py file with the code for your new workflow. If you now look at the example_workflow_page.py from that directory you will see something similar to:
    # The workflow name must be the first part of any endpoints defined in this file.
    # If you break this rule, you will trip up on other people's endpoint names and
    # chaos will ensue.
    @route(app, '/example_workflow/example_workflow_endpoint')
    @util.workflow_permission_required('example_workflow_page')
    @util.exception_catcher
    def example_workflow_example_workflow_page():
        form = generic_form_template()
        # Remove this line if your workflow does not need to select a configuration
        form.configuration.choices = get_configurations()
        return render_template(
            'example_workflow_page.html',
            form=form,
            text=util.get_text(module_path(), config.language),
            options=g.user.get_options()
        )
    @route(app, '/example_workflow/form', methods=['GET', 'POST'])
    @util.workflow_permission_required('example_workflow_page')
    @util.exception_catcher
    def example_workflow_example_workflow_page_form():
        form = generic_form_template()
        # Remove this line if your workflow does not need to select a configuration
        form.configuration.choices = get_configurations()
        if form.validate_on_submit():
            print(form.configuration.data)
            print(form.email.data)
            print(form.password.data)
            print(form.mac_address.data)
            print(form.ip_address.data)
            print(form.url.data)
            print(form.file.data)
            print(form.boolean_checked.data)
            print(form.boolean_unchecked.data)
            print(form.select_one.data)
            print(form.date_time.data)
            print(form.submit.data)
    
            # Put form processing code here
            g.user.logger.info('SUCCESS')
            flash('success', 'succeed')
            return redirect(url_for('example_workflowexample_workflowexample_workflow_page'))
        else:
            g.user.logger.info('Form data was not valid.')
            return render_template(
                'example_workflow_page.html',
                form=form,
                text=util.get_text(module_path(), config.language),
                options=g.user.get_options()
            )

    The main item to note is the use of the @route() decorator. This is a replacement for Flask's more usual app.route() decorator and must be used in its place. Its role is to enforce separation of namespaces between different workflows. Without the @route() decorator, it would not be possible for multiple people to develop workflows in parallel without tripping up on each other's function and endpoint names.

    From here, you can add your own code.