Bugfix: describe_event_bus()['Policy'] should be JSON string, not object
boto3.client('events')['Policy'] must be a string as per:
http://boto3.readthedocs.io/en/latest/reference/services/events.html#CloudWatchEvents.Client.describe_event_bus
Adding json.dumps() around the policy value ensures we do not return an unexpected dict
This change corrects an error when attempting to decode the policy:
json.load(boto3.client('events').describe_event_bus()['Policy'])
This commit is contained in:
parent
cb364eedc6
commit
1e01356f99
1 changed files with 4 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
from moto.core.exceptions import JsonRESTError
|
from moto.core.exceptions import JsonRESTError
|
||||||
from moto.core import BaseBackend, BaseModel
|
from moto.core import BaseBackend, BaseModel
|
||||||
|
|
@ -238,8 +239,10 @@ class EventsBackend(BaseBackend):
|
||||||
'Action': 'events:{0}'.format(data['action']),
|
'Action': 'events:{0}'.format(data['action']),
|
||||||
'Resource': arn
|
'Resource': arn
|
||||||
})
|
})
|
||||||
|
policy = {'Version': '2012-10-17', 'Statement': statements}
|
||||||
|
policy_json = json.dumps(policy)
|
||||||
return {
|
return {
|
||||||
'Policy': {'Version': '2012-10-17', 'Statement': statements},
|
'Policy': policy_json,
|
||||||
'Name': 'default',
|
'Name': 'default',
|
||||||
'Arn': arn
|
'Arn': arn
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue