{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/tower-cli/issues/97","labels_url":"https://api.github.com/repos/ansible/tower-cli/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/ansible/tower-cli/issues/97/comments","events_url":"https://api.github.com/repos/ansible/tower-cli/issues/97/events","html_url":"https://github.com/ansible/tower-cli/pull/97","id":119086506,"number":97,"title":"Change extra_vars default behavior for 2.3.1 release","user":{"login":"AlanCoding","id":1385596,"avatar_url":"https://avatars.githubusercontent.com/u/1385596?v=3","gravatar_id":"","url":"https://api.github.com/users/AlanCoding","html_url":"https://github.com/AlanCoding","followers_url":"https://api.github.com/users/AlanCoding/followers","following_url":"https://api.github.com/users/AlanCoding/following{/other_user}","gists_url":"https://api.github.com/users/AlanCoding/gists{/gist_id}","starred_url":"https://api.github.com/users/AlanCoding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlanCoding/subscriptions","organizations_url":"https://api.github.com/users/AlanCoding/orgs","repos_url":"https://api.github.com/users/AlanCoding/repos","events_url":"https://api.github.com/users/AlanCoding/events{/privacy}","received_events_url":"https://api.github.com/users/AlanCoding/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/tower-cli/labels/review","name":"review","color":"cbaaab"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-26T17:50:35Z","updated_at":"2015-12-02T22:09:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ansible/tower-cli/pulls/97","html_url":"https://github.com/ansible/tower-cli/pull/97","diff_url":"https://github.com/ansible/tower-cli/pull/97.diff","patch_url":"https://github.com/ansible/tower-cli/pull/97.patch"},"body":"If this is confirmed to help with the recent issue about extra_vars parsing, then we should include it in the 2.3.1 release. We will merge this PR, tag, and then release if so."},"comment":{"url":"https://api.github.com/repos/ansible/tower-cli/issues/comments/161449314","html_url":"https://github.com/ansible/tower-cli/pull/97#issuecomment-161449314","issue_url":"https://api.github.com/repos/ansible/tower-cli/issues/97","id":161449314,"user":{"login":"AlanCoding","id":1385596,"avatar_url":"https://avatars.githubusercontent.com/u/1385596?v=3","gravatar_id":"","url":"https://api.github.com/users/AlanCoding","html_url":"https://github.com/AlanCoding","followers_url":"https://api.github.com/users/AlanCoding/followers","following_url":"https://api.github.com/users/AlanCoding/following{/other_user}","gists_url":"https://api.github.com/users/AlanCoding/gists{/gist_id}","starred_url":"https://api.github.com/users/AlanCoding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlanCoding/subscriptions","organizations_url":"https://api.github.com/users/AlanCoding/orgs","repos_url":"https://api.github.com/users/AlanCoding/repos","events_url":"https://api.github.com/users/AlanCoding/events{/privacy}","received_events_url":"https://api.github.com/users/AlanCoding/received_events","type":"User","site_admin":false},"created_at":"2015-12-02T22:09:28Z","updated_at":"2015-12-02T22:09:28Z","body":"There's a lot of material here, and a lot of tests to go along with them. I will try to give some summarization and background. Firstly, the first 2 commits here changed enough code to solve the problem raised in the issue, and that's all. The 3rd commit was performing a broader audit of consistency with the UI behavior. tower-cli extra_vars were already designed for consistency with the behavior of Ansible core, so there was a balancing act of being more like one versus the other.\r\n\r\nThe UI behavior:\r\n\r\n- **Job Template creation/editing** - parses JSON or YAML in-browser according to the user selection. Confirming that the input is valid is done inside of this view, and the text is passed as-is when saved.\r\n- **Job launches without special considerations** - In the current version, `extra_vars` are absent from the payload\r\n- **Job launches with prompt for extra_vars** - The JT `extra_vars` are presented to the user, and the user is free to edit them, but it is converted to JSON when the POST request is made\r\n\r\nSo what does this mean for tower-cli? I don't think I'm going out on a limb when I say that tower-cli should throw an error if the user gives it invalid data. However, being like Ansible, it should still eat up multiple `--extra-vars` options, which can include files too (which also might have YAML and comments). You can go very deep into the corner cases through this line of logic.\r\n\r\nThe new tower-cli behavior:\r\n\r\n- **Job Template creation/modification** - Will take all the extra-vars given and try to append them in YAML form. It that can't be done, it gives up and submits it as JSON. This is somewhat similar to how the UI behaves.\r\n- **Job launches without special considerations** - Combines the multiple extra-vars flags, but dumps them into JSON.\r\n- **Job launches with prompt for extra_vars** - Converts the JT extra_vars into YAML (without curly braces) and puts that into the editor for the user to modify. If the user edits this into valid YAML with comments, then we send that. It will still error if something goes wrong.\r\n- **Flags versus files** - the key=value syntax will not be allowed for content from files."}}