ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.97k stars 3.41k forks source link

Updating EC2 Inventory Source in yaml doesn't work #14353

Open Amrish-Sharma opened 1 year ago

Amrish-Sharma commented 1 year ago

Please confirm the following

Bug Summary

Hello Friends,

When I am trying to edit the EC2 Source(Dynamic Inventory) in yaml mode, It doesn't switch from json. It remains in JSON format

JSON format enabled: image

with YAML format enabled image

Thanks for your time and efforts to keep this project alive!

Do let me know in case any further information is required from my end

AWX version

21.1

Select the relevant components

Installation method

kubernetes

Modifications

no

Ansible version

No response

Operating system

No response

Web browser

Chrome

Steps to reproduce

Expected results

Actual results

Additional information

No response

djyasin commented 1 year ago

Hello, we were unable to duplicate this issue in the current version of AWX. Please try upgrading to the latest version and let us know if that resolves your issue.

fosterseth commented 1 year ago

example of what I tested (on latest AWX)

image image

@Amrish-Sharma do you have a more specific example to test?

keithjgrant commented 1 year ago

If there is a syntax error in the JSON field, it won't be able to convert to YAML. Can you confirm the JSON is valid? And are there any errors in the console?

If the toggle is switching to the YAML button when the JSON has a syntax error, this behavior is a bug. Are you able to share the exact JSON value you have?

Amrish-Sharma commented 1 year ago

Hey @keithjgrant

Please find below the json content, there are no issues in json syntax


{
  "keyed_groups": [
    {
      "prefix": "arch",
      "key": "architecture"
    },
    {
      "prefix": "tag",
      "key": "tags"
    },
    {
      "prefix": "instance_type",
      "key": "instance_type"
    },
    {
      "prefix": "aws_region",
      "key": "placement.region"
    },
    {
      "prefix": "aws_az",
      "key": "placement.availability_zone"
    },
    {
      "prefix": "key",
      "key": "key_name"
    }
  ],
  "hostnames": [
    "tag:Name"
  ],
  "compose": {
    "ec2_tag_cluster_hosts": "tags.cluster_hosts.split(\",\")",
    "ansible_host": "private_ip_address"
  },
  "filters": {
    "instance-state-name": "running",
    "tag-key": "Role"
  }
}
fosterseth commented 1 year ago

image image

I copy and pasted your json, and it appears to flip to yaml just fine in the UI