Next steps - Platform - BlueCat Gateway - 21.11.2

Gateway Administration Guide

Locale
English
Product name
BlueCat Gateway
Version
21.11.2
  1. Restart the Gateway container.
  2. Set access permissions for your workflow from the Workflow Permissions page in BlueCat Gateway. 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
    @util.ui_secure_endpoint
    def example_workflow_example_workflow_page():
        form = GenericFormTemplate()
        # Remove this line if your workflow does not need to select a configuration
        form.configuration.choices = util.get_configurations(default_val=True)
        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=['POST'])
    @util.workflow_permission_required('example_workflow_page')
    @util.exception_catcher
    @util.ui_secure_endpoint
    def example_workflow_example_workflow_page_form():
        form = GenericFormTemplate()
        # Remove this line if your workflow does not need to select a configuration
        form.configuration.choices = util.get_configurations(default_val=True)
        if not form.validate_on_submit():
            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(),
            )
    
        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.date_time.data)
        print(form.submit.data)
    
        # Put form processing logic here
        g.user.logger.info('SUCCESS')
        flash('success', 'succeed')
        return redirect(url_for('example_workflowexample_workflow_example_workflow_page'))

    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.