{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/37300","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/37300/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/37300/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/37300/events","html_url":"https://github.com/saltstack/salt/issues/37300","id":185899287,"number":37300,"title":"Type checking in templates?","user":{"login":"jbremer","id":1148773,"avatar_url":"https://avatars.githubusercontent.com/u/1148773?v=3","gravatar_id":"","url":"https://api.github.com/users/jbremer","html_url":"https://github.com/jbremer","followers_url":"https://api.github.com/users/jbremer/followers","following_url":"https://api.github.com/users/jbremer/following{/other_user}","gists_url":"https://api.github.com/users/jbremer/gists{/gist_id}","starred_url":"https://api.github.com/users/jbremer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbremer/subscriptions","organizations_url":"https://api.github.com/users/jbremer/orgs","repos_url":"https://api.github.com/users/jbremer/repos","events_url":"https://api.github.com/users/jbremer/events{/privacy}","received_events_url":"https://api.github.com/users/jbremer/received_events","type":"User","site_admin":false},"labels":[{"id":77737132,"url":"https://api.github.com/repos/saltstack/salt/labels/Pending%20Discussion","name":"Pending Discussion","color":"c7def8","default":false},{"id":48088732,"url":"https://api.github.com/repos/saltstack/salt/labels/Question","name":"Question","color":"942192","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-28T11:21:35Z","updated_at":"2016-10-28T16:04:58Z","closed_at":null,"body":"### Description of Issue/Question\r\n\r\nIt would make sense to me to provide better type checking in certain state attributes.\r\n\r\n### Setup\r\n\r\nLet's assume the following typo in a state:\r\n\r\n```\r\nsomething:\r\n  cmd.run:\r\n    - name: >\r\n        VBoxManage setextradata global \"HostOnly/vboxnet0/IPAddress\"\r\n        {{ salt['pillar.get']('vmcloak:ipprefix'), 'hehe' }}1 && true\r\n    - user: {{ salt['pillar.get']('cuckoo:user', 'cuckoo') }}\r\n    - require:\r\n      - cmd: vboxnet0_create\r\n```\r\n\r\nHere I accidentally typed `), 'hehe'` instead of `, 'hehe')`. This actually happened to me earlier while failing to copy and paste. Now because it's evaluating a tuple as string, you end up trying to execute some messed up command. Wouldn't it make sense to only allow `jinja2` expressions for certain fields to return certain types (i.e., in this case, either a string or an integer)?\r\n\r\nYes, I'm aware that in this template the Jinja2 expression is embedded in the value, but still this should be somehow possible while evaluating the expression.\r\n\r\n### Versions Report\r\n\r\nSalt `2016.3.3`."},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/256960566","html_url":"https://github.com/saltstack/salt/issues/37300#issuecomment-256960566","issue_url":"https://api.github.com/repos/saltstack/salt/issues/37300","id":256960566,"user":{"login":"thatch45","id":507599,"avatar_url":"https://avatars.githubusercontent.com/u/507599?v=3","gravatar_id":"","url":"https://api.github.com/users/thatch45","html_url":"https://github.com/thatch45","followers_url":"https://api.github.com/users/thatch45/followers","following_url":"https://api.github.com/users/thatch45/following{/other_user}","gists_url":"https://api.github.com/users/thatch45/gists{/gist_id}","starred_url":"https://api.github.com/users/thatch45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatch45/subscriptions","organizations_url":"https://api.github.com/users/thatch45/orgs","repos_url":"https://api.github.com/users/thatch45/repos","events_url":"https://api.github.com/users/thatch45/events{/privacy}","received_events_url":"https://api.github.com/users/thatch45/received_events","type":"User","site_admin":false},"created_at":"2016-10-28T16:04:58Z","updated_at":"2016-10-28T16:04:58Z","body":"I agree, typing in the template would be nice. Do you know of a template language that can handle typing? We could easily add a renderer for an additional template language. We have also been considering"}}
{"actor":{"display_login":"thatch45"}}