Add comments to openstack_user.rb

The new comments try to clarify the purpose of the ":grant_domain"
action of the openstack_user resource.

In contrast to what the name may suggest, the action does not grant a
domain (which is not possible). Instead, it grants a role to a user who
is already in a specific domain. The domain attribute is merely used to
identify the user.
This commit is contained in:
Roger Luethi 2017-11-01 10:56:01 +01:00
parent bfafac1d99
commit 97239e41a9
1 changed files with 5 additions and 0 deletions

View File

@ -62,6 +62,7 @@ module OpenstackclientCookbook
end
end
# Grant a role in a project
action :grant_role do
user = connection.users.find { |u| u.name == user_name }
project = connection.projects.find { |p| p.name == project_name }
@ -76,6 +77,10 @@ module OpenstackclientCookbook
project.revoke_role_from_user role.id, user.id if role && project && user
end
# Grant a role in a domain
# Note: in spite of what the action name may suggest, the domain name is
# only used to identify a user who is in that domain. This action grants
# the user a role in the domain.
action :grant_domain do
user = connection.users.find { |u| u.name == user_name }
domain = connection.domains.find { |p| p.name == domain_name }