{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/tower-cli/issues/598","repository_url":"https://api.github.com/repos/ansible/tower-cli","labels_url":"https://api.github.com/repos/ansible/tower-cli/issues/598/labels{/name}","comments_url":"https://api.github.com/repos/ansible/tower-cli/issues/598/comments","events_url":"https://api.github.com/repos/ansible/tower-cli/issues/598/events","html_url":"https://github.com/ansible/tower-cli/issues/598","id":352128427,"node_id":"MDU6SXNzdWUzNTIxMjg0Mjc=","number":598,"title":"Importing exported inventory with one host in two inventories and groups throws association error","user":{"login":"PaulRitzkat","id":2079167,"node_id":"MDQ6VXNlcjIwNzkxNjc=","avatar_url":"https://avatars1.githubusercontent.com/u/2079167?v=4","gravatar_id":"","url":"https://api.github.com/users/PaulRitzkat","html_url":"https://github.com/PaulRitzkat","followers_url":"https://api.github.com/users/PaulRitzkat/followers","following_url":"https://api.github.com/users/PaulRitzkat/following{/other_user}","gists_url":"https://api.github.com/users/PaulRitzkat/gists{/gist_id}","starred_url":"https://api.github.com/users/PaulRitzkat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PaulRitzkat/subscriptions","organizations_url":"https://api.github.com/users/PaulRitzkat/orgs","repos_url":"https://api.github.com/users/PaulRitzkat/repos","events_url":"https://api.github.com/users/PaulRitzkat/events{/privacy}","received_events_url":"https://api.github.com/users/PaulRitzkat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-20T13:11:02Z","updated_at":"2018-08-20T13:11:02Z","closed_at":null,"author_association":"NONE","body":"### Versions\r\ntower-cli --version: Tower CLI 3.3.0\r\nawx version 1.0.7\r\n\r\n### Error\r\n    Unable to find host name host2.local to associate to the group group2 : Expected one result, got 2. Possibly caused by not providing required fields. Please tighten your criteria.\r\n\r\nhost2.local is in two inventories (testinv1 and testinv2) and in one group in each inventory (group1 in testinv1 and group2 in testinv2). host3.local is in both inventories but only in one group in testinv2. No hosts in testinv2 gets added to the group in testinv2.\r\n\r\n**tower-cli export:**\r\n```json\r\n[\r\n  {\r\n    \"organization\": \"Default\", \r\n    \"asset_relation\": {\r\n      \"inventory_source\": [], \r\n      \"host\": [\r\n        {\r\n          \"variables\": \"ansible_connection: local\", \r\n          \"name\": \"localhost\"\r\n        }\r\n      ], \r\n      \"group\": [], \r\n      \"roles\": [\r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Ad Hoc\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Admin\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Read\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Use\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Update\", \r\n          \"user\": []\r\n        }\r\n      ]\r\n    }, \r\n    \"asset_type\": \"inventory\", \r\n    \"name\": \"Demo Inventory\"\r\n  }, \r\n  {\r\n    \"description\": \"testinv1\", \r\n    \"variables\": \"---\", \r\n    \"asset_type\": \"inventory\", \r\n    \"organization\": \"Default\", \r\n    \"asset_relation\": {\r\n      \"inventory_source\": [], \r\n      \"host\": [\r\n        {\r\n          \"name\": \"host1.local\"\r\n        }, \r\n        {\r\n          \"name\": \"host2.local\"\r\n        }, \r\n        {\r\n          \"name\": \"host3.local\"\r\n        }\r\n      ], \r\n      \"group\": [\r\n        {\r\n          \"sub_groups\": [], \r\n          \"hosts\": [\r\n            \"host1.local\", \r\n            \"host2.local\"\r\n          ], \r\n          \"name\": \"group1\"\r\n        }\r\n      ], \r\n      \"roles\": [\r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Ad Hoc\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Admin\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Read\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Use\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Update\", \r\n          \"user\": []\r\n        }\r\n      ]\r\n    }, \r\n    \"name\": \"testinv1\"\r\n  }, \r\n  {\r\n    \"description\": \"testinv2\", \r\n    \"variables\": \"---\", \r\n    \"asset_type\": \"inventory\", \r\n    \"organization\": \"Default\", \r\n    \"asset_relation\": {\r\n      \"inventory_source\": [], \r\n      \"host\": [\r\n        {\r\n          \"name\": \"host2.local\"\r\n        }, \r\n        {\r\n          \"name\": \"host3.local\"\r\n        }, \r\n        {\r\n          \"name\": \"host4.local\"\r\n        }\r\n      ], \r\n      \"group\": [\r\n        {\r\n          \"sub_groups\": [], \r\n          \"hosts\": [\r\n            \"host2.local\"\r\n          ], \r\n          \"name\": \"group2\"\r\n        }, \r\n        {\r\n          \"sub_groups\": [], \r\n          \"hosts\": [\r\n            \"host3.local\"\r\n          ], \r\n          \"name\": \"group3\"\r\n        }\r\n      ], \r\n      \"roles\": [\r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Ad Hoc\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Admin\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Read\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Use\", \r\n          \"user\": []\r\n        }, \r\n        {\r\n          \"team\": [], \r\n          \"name\": \"Update\", \r\n          \"user\": []\r\n        }\r\n      ]\r\n    }, \r\n    \"name\": \"testinv2\"\r\n  }\r\n]\r\n```"}}
{"actor":{"display_login":"PaulRitzkat"}}