Skip to content

Commit 1490fe1

Browse files
committed
Update s3user error messages for policy application
1 parent d168a79 commit 1490fe1

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
minor_changes:
2+
- purefb_s3user - Updated failure messages for applying policies to an object user account.
3+
- purefb_s3user - Changed ``key_state`` state to be ``keystate`` as ``key_state`` is reserved.

plugins/modules/purefb_s3user.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
- Create or delete object store account user
3030
- Remove a specified access key for a user
3131
default: present
32-
choices: [ absent, present, remove_key, key_state ]
32+
choices: [ absent, present, remove_key, keystate ]
3333
type: str
3434
name:
3535
description:
@@ -107,7 +107,7 @@
107107
account: bar
108108
access_key: true
109109
policy:
110-
- pure:policy/safemode-configure
110+
- pure:policy/object-write
111111
fb_url: 10.10.10.2
112112
api_token: T-55a68eb5-c785-4720-a2ca-8b03903bf641
113113
@@ -364,8 +364,10 @@ def create_s3user(module, blade):
364364
)
365365
if res.status_code != 200:
366366
module.warn(
367-
"Failed to add policy {0} to account user {1}. Skipping...".format(
368-
policy_list[policy], username
367+
"Failed to add policy {0} to account user {1}. Error: {2}. Skipping...".format(
368+
policy_list[policy],
369+
username,
370+
res.errors[0].message,
369371
)
370372
)
371373
if "pure:policy/full-access" not in policy_list:
@@ -456,7 +458,7 @@ def main():
456458
policy=dict(type="list", elements="str"),
457459
state=dict(
458460
default="present",
459-
choices=["present", "absent", "remove_key", "key_state"],
461+
choices=["present", "absent", "remove_key", "keystate"],
460462
),
461463
)
462464
)
@@ -504,7 +506,7 @@ def main():
504506
create_s3user(module, blade)
505507
elif state == "remove_key" and s3user:
506508
remove_key(module, blade)
507-
elif state == "key_state" and s3user:
509+
elif state == "keystate" and s3user:
508510
change_key(module, blade)
509511
else:
510512
module.exit_json(changed=False)

0 commit comments

Comments
 (0)