Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding support to use the group numeric id as group_name #28

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions plugins/module_utils/guacamole.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ def guacamole_get_connections_group_id(base_url, validate_certs, datasource, gro
to its numeric identifier because the API expects a group numeric id, not a group name
"""

# if the group name is an integer we assume it's the group numeric id hardcoded by the user
# quick&dirty hack for https://github.com/scicore-unibas-ch/ansible-modules-guacamole/issues/27
if isinstance(group, int):
return group

url_list_connections_groups = URL_LIST_CONNECTIONS_GROUPS.format(
url=base_url, datasource=datasource, token=auth_token)

Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/guacamole_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@

group_name:
description:
- Group name (parentIdentifier) where to create the connection
- Group name (parentIdentifier) where to create the connection. Name is preferred but you can use an integer to hardcode the group numeric id.
default: 'ROOT'
aliases: ['parentIdentifier']
aliases: ['parentIdentifier', 'group_numeric_id']
type: str

protocol:
Expand Down Expand Up @@ -492,7 +492,7 @@ def main():
auth_password=dict(type='str', required=True,
no_log=True),
validate_certs=dict(type='bool', default=True),
group_name=dict(type='str', aliases=['parentIdentifier'], default='ROOT'),
group_name=dict(type='str', aliases=['parentIdentifier', 'group_numeric_id'], default='ROOT'),
connection_name=dict(type='str', aliases=['name'], required=True),
protocol=dict(type='str', choices=['rdp', 'vnc', 'ssh', 'telnet']),
hostname=dict(type='str'),
Expand Down