Fixed linting errors.
This commit is contained in:
parent
ed2682582f
commit
37bdc12f4d
@ -88,7 +88,7 @@ VALID_RESOURCE_PATH_STARTING_VALUES = {
|
|||||||
|
|
||||||
class IAMPolicyDocumentValidator:
|
class IAMPolicyDocumentValidator:
|
||||||
|
|
||||||
def __init__(self, policy_document: str):
|
def __init__(self, policy_document):
|
||||||
self._policy_document: str = policy_document
|
self._policy_document: str = policy_document
|
||||||
self._policy_json: dict = {}
|
self._policy_json: dict = {}
|
||||||
self._statements = []
|
self._statements = []
|
||||||
@ -308,7 +308,7 @@ class IAMPolicyDocumentValidator:
|
|||||||
for resource in sorted(statement[key], reverse=True):
|
for resource in sorted(statement[key], reverse=True):
|
||||||
self._validate_resource_format(resource)
|
self._validate_resource_format(resource)
|
||||||
if self._resource_error == "":
|
if self._resource_error == "":
|
||||||
IAMPolicyDocumentValidator._legacy_parse_resource_like(statement, key)
|
IAMPolicyDocumentValidator._legacy_parse_resource_like(statement, key)
|
||||||
|
|
||||||
def _validate_resource_format(self, resource):
|
def _validate_resource_format(self, resource):
|
||||||
if resource != "*":
|
if resource != "*":
|
||||||
@ -327,12 +327,12 @@ class IAMPolicyDocumentValidator:
|
|||||||
arn3 = remaining_resource_parts[2] if len(remaining_resource_parts) > 2 else "*"
|
arn3 = remaining_resource_parts[2] if len(remaining_resource_parts) > 2 else "*"
|
||||||
arn4 = ":".join(remaining_resource_parts[3:]) if len(remaining_resource_parts) > 3 else "*"
|
arn4 = ":".join(remaining_resource_parts[3:]) if len(remaining_resource_parts) > 3 else "*"
|
||||||
self._resource_error = 'Partition "{partition}" is not valid for resource "arn:{partition}:{arn1}:{arn2}:{arn3}:{arn4}".'.format(
|
self._resource_error = 'Partition "{partition}" is not valid for resource "arn:{partition}:{arn1}:{arn2}:{arn3}:{arn4}".'.format(
|
||||||
partition=resource_partitions[0],
|
partition=resource_partitions[0],
|
||||||
arn1=arn1,
|
arn1=arn1,
|
||||||
arn2=arn2,
|
arn2=arn2,
|
||||||
arn3=arn3,
|
arn3=arn3,
|
||||||
arn4=arn4
|
arn4=arn4
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
if resource_partitions[1] != ":":
|
if resource_partitions[1] != ":":
|
||||||
|
Loading…
Reference in New Issue
Block a user