Skip to content

Commit 66cf491

Browse files
author
Glenn Snyder
committed
fixing query
1 parent af73432 commit 66cf491

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/assign_role_to_user_group.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@
2424

2525
args = parser.parse_args()
2626

27-
user_groups = hub.get_user_groups(parameters={'q':args.group_name})
27+
user_groups = hub.get_user_groups(parameters={'q':'name:{}'.format(args.group_name)})
2828

2929
if user_groups['totalCount'] == 1:
3030
user_group = user_groups['items'][0]
31+
else:
32+
user_group = None
3133

3234
if user_group:
3335
if args.role == 'All':
@@ -42,3 +44,5 @@
4244
print("Failed to assign role {} to group {} due to status code 412. Has the role already been assigned?".format(role_to_assign, args.group_name))
4345
else:
4446
print("Failed to assign role {} to group {}. status code: {}".format(role_to_assign, args.group_name, response.status_code))
47+
else:
48+
print("Didn't find user group {}".format(args.group_name))

0 commit comments

Comments
 (0)