{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/21114","labels_url":"https://api.github.com/repos/saltstack/salt/issues/21114/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/21114/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/21114/events","html_url":"https://github.com/saltstack/salt/issues/21114","id":59226093,"number":21114,"title":"states.keystone fails to create user-roles for more than 1 tenant/user (or remove them)","user":{"login":"devweasel","id":2463395,"avatar_url":"https://avatars.githubusercontent.com/u/2463395?v=3","gravatar_id":"","url":"https://api.github.com/users/devweasel","html_url":"https://github.com/devweasel","followers_url":"https://api.github.com/users/devweasel/followers","following_url":"https://api.github.com/users/devweasel/following{/other_user}","gists_url":"https://api.github.com/users/devweasel/gists{/gist_id}","starred_url":"https://api.github.com/users/devweasel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devweasel/subscriptions","organizations_url":"https://api.github.com/users/devweasel/orgs","repos_url":"https://api.github.com/users/devweasel/repos","events_url":"https://api.github.com/users/devweasel/events{/privacy}","received_events_url":"https://api.github.com/users/devweasel/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Medium%20Severity","name":"Medium Severity","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/13","html_url":"https://github.com/saltstack/salt/milestones/Approved","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/13/labels","id":9265,"number":13,"title":"Approved","description":"All issues that are ready to be worked on, both bugs and features.","creator":{"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},"open_issues":1998,"closed_issues":1609,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2015-03-04T16:05:55Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-02-27T11:46:05Z","updated_at":"2015-03-04T16:53:57Z","closed_at":null,"body":"This is probably related to/a duplicate of the already closed issue #8912. Sorry for duplicating this, but apparently my initial comment on the closed issue got overlooked...\r\n\r\nThe above mentioned issue is still present in the current *develop* branch. To emphasize this using the example given by smithjm:\r\n\r\n    - roles:\r\n      - service_tenant:\r\n        - admin_role\r\n        - user_role\r\n      - admin_tenant:\r\n        - admin_role\r\n\r\nThe roles are correctly set for *service_tenant*, but the *admin_tenant* gets completely ignored.\r\n\r\nI suspect that there is something wrong with the tenant loop in the code (without having much programming knowledge that is, so i might be completely and utterly wrong too...). Line 176 states:\r\n\r\n    for tenant_role in roles[0]:\r\n\r\nThe **[0]** looks to me like it's somehow disabling the loop altogether and only processing the first list element...\r\n\r\n\r\n\r\nFurthermore, the state doesn't seem to support the removal of roles. If i modify the state (after applying the original one) to read:\r\n\r\n    - roles:\r\n      - service_tenant:\r\n        - admin_role\r\n      - admin_tenant:\r\n        - admin_role\r\n\r\nThe role *user_role* doesn't get removed in service_tenant (while the admin_tenant still gets completely ignored)...\r\n"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/77196507","html_url":"https://github.com/saltstack/salt/issues/21114#issuecomment-77196507","issue_url":"https://api.github.com/repos/saltstack/salt/issues/21114","id":77196507,"user":{"login":"devweasel","id":2463395,"avatar_url":"https://avatars.githubusercontent.com/u/2463395?v=3","gravatar_id":"","url":"https://api.github.com/users/devweasel","html_url":"https://github.com/devweasel","followers_url":"https://api.github.com/users/devweasel/followers","following_url":"https://api.github.com/users/devweasel/following{/other_user}","gists_url":"https://api.github.com/users/devweasel/gists{/gist_id}","starred_url":"https://api.github.com/users/devweasel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devweasel/subscriptions","organizations_url":"https://api.github.com/users/devweasel/orgs","repos_url":"https://api.github.com/users/devweasel/repos","events_url":"https://api.github.com/users/devweasel/events{/privacy}","received_events_url":"https://api.github.com/users/devweasel/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T16:53:57Z","updated_at":"2015-03-04T16:53:57Z","body":"Here you are @rallytime; Sorry this took so long, understanding the basics of Git and your \"Contributing\" documentation (and what the heck a \"pull request\" was) took a bit longer than expected ;-)\r\n"}}