[mistral] lists and dict via CLI or dashboard not possible?

Engelmann Florian florian.engelmann at everyware.ch
Fri Feb 10 08:05:40 UTC 2023


Hello,

after checking the code of the mistral-dashboard (I am not a coder) it looks like (at least to me) the dashboard is not able to handle complex input like a dict or a list. It handles everything as a string.

So the dashboard was never working with those input fields?

All the best,
Florian

________________________________________
From: Engelmann Florian <florian.engelmann at everyware.ch>
Sent: Thursday, February 9, 2023 5:09:02 PM
To: openstack-discuss at lists.openstack.org
Subject: [mistral] lists and dict via CLI or dashboard not possible?

Hello,

I spent 2 hours of testing the "example" workflow "create_instance" that was created by mistral-db-manage populate.

Mistral 15.0.0 (including commit: 475c5cf34588fb88f2531883c957097ada5a5fb9 Fix sorting error when type is different)

I tested with the CLI (python-mistralclient 4.5.0 as well as 3.7.0) and with the horizon mistral-dashboard (including this fix:

mistraldashboard/workflows/forms.py

@@ -56,7 +56,7 @@ class ExecuteForm(forms.SelfHandlingForm):

    def handle(self, request, data):
        try:
-            data['workflow_id'] = data.pop('workflow_name')
+           data['wf_identifier'] = data.pop('workflow_name')
            data['workflow_input'] = {}
            for param in self.workflow_parameters:
                value = data.pop(param)


Now it looks like mistral and the mistral-dashboard are working.

But: How to enter a list or a dict to any input field?

The definition of "create_instance" looks like:

---
version: '2.0'

create_instance:
  type: direct

  description: |
    Creates VM and waits till VM OS is up and running.

  input:
    - name
    - image_id
    - flavor_id
    - ssh_username: null
    - ssh_password: null

    # Name of previously created keypair to inject into the instance.
    # Either ssh credentials or keypair must be provided.
    - key_name: null

    # Security_groups: A list of security group names
    - security_groups: null

    # An ordered list of nics to be added to this server, with information about connected networks, fixed IPs, port etc.
    # Example: nics: [{"net-id": "27aa8c1c-d6b8-4474-b7f7-6cdcf63ac856"}]
    - nics: null

  task-defaults:
    on-error:
      - delete_vm

  output:
    ip: <% $.vm_ip %>
    id: <% $.vm_id %>
    name: <% $.name %>
    status: <% $.status %>

  tasks:
    create_vm:
      description: Initial request to create a VM.
      action: nova.servers_create name=<% $.name %> image=<% $.image_id %> flavor=<% $.flavor_id %>
      input:
        key_name: <% $.key_name %>
        security_groups: <% $.security_groups %>
        nics: <% $.nics %>
      publish:
        vm_id: <% task(create_vm).result.id %>
      on-success:
        - search_for_ip
...




But eg, "nics" (mandatory) expects a dict:

https://docs.openstack.org/python-novaclient/rocky/reference/api/novaclient.v2.servers.html

nics – An ordered list of nics (dicts) to be added to this server, with information about connected networks, fixed IPs, port etc. Beginning in microversion 2.37 this field is required and also supports a single string value of ‘auto’ or ‘none’. The ‘auto’ value means the Compute service will automatically allocate a network for the project if one is not available. This is the same behavior as not passing anything for nics before microversion 2.37. The ‘none’ value tells the Compute service to not allocate any networking for the server.

and "security_groups" a list:

security_groups – A list of security group names

I tried all possible notations... and gave up after 2 hours.


Is it possible to use that workflow from the CLI and the mistral-dashboard?
How? Could anybody please provide some examples for "nics" and "security_groups"?

All the best,
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5935 bytes
Desc: not available
URL: <https://lists.openstack.org/pipermail/openstack-discuss/attachments/20230210/083385e5/attachment-0001.bin>


More information about the openstack-discuss mailing list