{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/15237","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/15237/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/15237/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/15237/events","html_url":"https://github.com/ansible/ansible/issues/15237","id":145159350,"number":15237,"title":"'slice' filter doesn't work correctly for with the same number of items as the slice size","user":{"login":"Yannik","id":801996,"avatar_url":"https://avatars.githubusercontent.com/u/801996?v=3","gravatar_id":"","url":"https://api.github.com/users/Yannik","html_url":"https://github.com/Yannik","followers_url":"https://api.github.com/users/Yannik/followers","following_url":"https://api.github.com/users/Yannik/following{/other_user}","gists_url":"https://api.github.com/users/Yannik/gists{/gist_id}","starred_url":"https://api.github.com/users/Yannik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yannik/subscriptions","organizations_url":"https://api.github.com/users/Yannik/orgs","repos_url":"https://api.github.com/users/Yannik/repos","events_url":"https://api.github.com/users/Yannik/events{/privacy}","received_events_url":"https://api.github.com/users/Yannik/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-01T11:49:54Z","updated_at":"2016-04-01T13:23:50Z","closed_at":"2016-04-01T13:23:50Z","body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.0.1.0\r\n  config file = /etc/ansible/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### OS / ENVIRONMENT\r\nFedora 23\r\n\r\n##### SUMMARY\r\nThe `slice` filter does not work correctly when the number of items passed to it is the same number as the slice size.\r\n\r\n##### STEPS TO REPRODUCE\r\n```\r\n- hosts: all\r\n  vars:\r\n    - var: ['a', 'b']\r\n    - var2: ['a', 'b', 'c', 'd']\r\n  tasks:\r\n    - name: Incorrect result for list with the same number of items as slize size\r\n      debug: msg={{var|slice(2)|list}}\r\n    - name: Correct result for larger list\r\n      debug: msg={{var2|slice(2)|list}}\r\n```\r\n\r\nRun this using `ansible-playbook -i 'localhost,' -c local test.yml`\r\n\r\n##### EXPECTED RESULTS\r\n`var|splice(2)|list` should return `[[\"a\", \"b\"]]`.\r\n\r\n##### ACTUAL RESULTS\r\n`var|splice(2)|list` returns `[[\"a\"], [\"b\"]]`.\r\n\r\n```\r\nTASK [Incorrect result for list with the same number of items as slize size] ***\r\nok: [localhost] => {\r\n    \"msg\": [\r\n        [\r\n            \"a\"\r\n        ], \r\n        [\r\n            \"b\"\r\n        ]\r\n    ]\r\n}\r\n\r\nTASK [Correct result for larger list] ******************************************\r\nok: [localhost] => {\r\n    \"msg\": [\r\n        [\r\n            \"a\", \r\n            \"b\"\r\n        ], \r\n        [\r\n            \"c\", \r\n            \"d\"\r\n        ]\r\n    ]\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/204395228","html_url":"https://github.com/ansible/ansible/issues/15237#issuecomment-204395228","issue_url":"https://api.github.com/repos/ansible/ansible/issues/15237","id":204395228,"user":{"login":"bcoca","id":836171,"avatar_url":"https://avatars.githubusercontent.com/u/836171?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoca","html_url":"https://github.com/bcoca","followers_url":"https://api.github.com/users/bcoca/followers","following_url":"https://api.github.com/users/bcoca/following{/other_user}","gists_url":"https://api.github.com/users/bcoca/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoca/subscriptions","organizations_url":"https://api.github.com/users/bcoca/orgs","repos_url":"https://api.github.com/users/bcoca/repos","events_url":"https://api.github.com/users/bcoca/events{/privacy}","received_events_url":"https://api.github.com/users/bcoca/received_events","type":"User","site_admin":false},"created_at":"2016-04-01T13:23:50Z","updated_at":"2016-04-01T13:23:50Z","body":"slice is a jinja2 filter, the code is not part of this repo."}}