{"action":"created","issue":{"url":"https://api.github.com/repos/drybjed/ansible-ipaddr-filter/issues/2","repository_url":"https://api.github.com/repos/drybjed/ansible-ipaddr-filter","labels_url":"https://api.github.com/repos/drybjed/ansible-ipaddr-filter/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/drybjed/ansible-ipaddr-filter/issues/2/comments","events_url":"https://api.github.com/repos/drybjed/ansible-ipaddr-filter/issues/2/events","html_url":"https://github.com/drybjed/ansible-ipaddr-filter/issues/2","id":173068087,"number":2,"title":"Address or IP query returns None for networks","user":{"login":"atnoslen","id":3331625,"avatar_url":"https://avatars.githubusercontent.com/u/3331625?v=3","gravatar_id":"","url":"https://api.github.com/users/atnoslen","html_url":"https://github.com/atnoslen","followers_url":"https://api.github.com/users/atnoslen/followers","following_url":"https://api.github.com/users/atnoslen/following{/other_user}","gists_url":"https://api.github.com/users/atnoslen/gists{/gist_id}","starred_url":"https://api.github.com/users/atnoslen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atnoslen/subscriptions","organizations_url":"https://api.github.com/users/atnoslen/orgs","repos_url":"https://api.github.com/users/atnoslen/repos","events_url":"https://api.github.com/users/atnoslen/events{/privacy}","received_events_url":"https://api.github.com/users/atnoslen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-08-24T21:58:52Z","updated_at":"2016-08-25T19:25:12Z","closed_at":null,"body":"Take a list of networks and hosts,\r\n\r\n```\r\nnetworks: [ \r\n  '10.1.0.0/24',\r\n  '10.2.3.4/32'\r\n]\r\n\r\n{{ networks[0] | ipaddr('address') }} --> None\r\n{{ networks[1] | ipaddr('address') }} --> '10.2.3.4'\r\n```\r\n\r\nDue to this in ipaddr.py\r\n\r\n```\r\n    elif query in [ 'address', 'ip' ]:\r\n        if v.size == 1:\r\n            return str(v.ip)\r\n        if v.size > 1:\r\n            if v.ip != v.network:\r\n                return str(v.ip)\r\n```\r\n\r\nAs a result, with a mixed list of networks and hosts, you can't iterate over the list and get the address supplied.\r\n\r\nThis becomes imperative for multi-os support of access lists where a line may be a network or a host.  I see no reason to not return the IP already supplied, regardless if it was a network or not."},"comment":{"url":"https://api.github.com/repos/drybjed/ansible-ipaddr-filter/issues/comments/242507952","html_url":"https://github.com/drybjed/ansible-ipaddr-filter/issues/2#issuecomment-242507952","issue_url":"https://api.github.com/repos/drybjed/ansible-ipaddr-filter/issues/2","id":242507952,"user":{"login":"atnoslen","id":3331625,"avatar_url":"https://avatars.githubusercontent.com/u/3331625?v=3","gravatar_id":"","url":"https://api.github.com/users/atnoslen","html_url":"https://github.com/atnoslen","followers_url":"https://api.github.com/users/atnoslen/followers","following_url":"https://api.github.com/users/atnoslen/following{/other_user}","gists_url":"https://api.github.com/users/atnoslen/gists{/gist_id}","starred_url":"https://api.github.com/users/atnoslen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atnoslen/subscriptions","organizations_url":"https://api.github.com/users/atnoslen/orgs","repos_url":"https://api.github.com/users/atnoslen/repos","events_url":"https://api.github.com/users/atnoslen/events{/privacy}","received_events_url":"https://api.github.com/users/atnoslen/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T19:25:12Z","updated_at":"2016-08-25T19:25:12Z","body":"I would also suggest that the Python library `ipaddr` is an interface for, [netaddr](http://pythonhosted.org/netaddr/api.html), makes a similar distinctions.  \r\n\r\nBy the API, `class netaddr.IPAddress` is just an address without a bitmask.  `class netaddr.IPNetwork`, is what you are using, but includes both an address and a subnet/bit mask.  Notice that `ip` in the API for `netaddr.IPNetwork` is \"The IP address of this IPNetwork object\" and makes note of \"This is may or may not be the same as the network IP address which varies according to the value of the CIDR subnet prefix.\".  So when `ipaddr` is a wrapper/interface for `netaddr` I am expecting that same functionality for the same named parameter."}}
{"actor":{"display_login":"atnoslen"}}