Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding up multiple variables to host via api ends up with {"variables":["Not a valid string."]} #15209

Closed
5 of 11 tasks
e0xify opened this issue May 21, 2024 · 1 comment
Closed
5 of 11 tasks

Comments

@e0xify
Copy link

e0xify commented May 21, 2024

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that AWX is open source software provided for free and that I might not receive a timely response.
  • I am NOT reporting a (potential) security vulnerability. (These should be emailed to [email protected] instead.)

Bug Summary

Might be related to #14585 fixxed in https://github.com/ansible/awx/releases/tag/23.4.0

Adding multiple variables to host ends up with given error message.

$body = @{ "variables" = @( "last_seen: $lastseen", "os_version: $os" ) }

iwr -Uri $uri -UseBasicParsing -Headers $header -Body ($body|ConvertTo-Json) -Method PATCH -ContentType "application/json

AWX version

23.8.1

Select the relevant components

  • UI
  • UI (tech preview)
  • API
  • Docs
  • Collection
  • CLI
  • Other

Installation method

kubernetes

Modifications

no

Ansible version

No response

Operating system

No response

Web browser

No response

Steps to reproduce

create powershell json body like given
push to host api

Expected results

multiple variables getting added

Actual results

{"variables":["Not a valid string."]} error message

Additional information

Workaround works when pushing to api endpoint /api/v2/hosts/id/variables_data directly

@thedoubl3j
Copy link
Member

yes, the variable field is a string field. you will need to "stringify" your yaml or json.

@thedoubl3j thedoubl3j closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants