flanksource / mission-control

Other
10 stars 2 forks source link

Playbook: config parameter type returns a string instead of object #1266

Open junaid-ebrahim opened 4 weeks ago

junaid-ebrahim commented 4 weeks ago

When trying to access a parameter of a config type based on a SQL scrapeconfig, the parameter is returned as a string instead of an object, this means that it has to be converted into an object via a json call , see example below, the last line should not need the "json" conversion.

apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
  name: grant-mssql-user-db-access
spec:
  description: Grant an MSSQL user read or readwrite access to a database
  parameters:
    - name: database
      label: Database
      type: config
      properties:
        filter:
          - types:
              - MSSQL::Database
  actions:
    - name: 'debug show params'
      if: "always()"
      exec:
        script: >
          echo "{{ (json ((.params.database).config )).id }}"