@@ -61,7 +61,7 @@ def describe_environment(self, name):
6161 # Describe will fail in certain fault scenarios early in Environment creation
6262 # We helpfully provide the summary listing as a backup set of information
6363 # If the environment truly does not exist, then this will give the same response
64- self .sdk .throw_warning (CdpWarning (resp .violations ))
64+ self .sdk .throw_warning (CdpWarning (str ( resp .violations ) ))
6565 return self .summarize_environment (name )
6666 self .sdk .throw_error (resp )
6767 return resp
@@ -105,9 +105,9 @@ def create_aws_environment(self, **kwargs):
105105 )
106106 if isinstance (resp , CdpError ):
107107 if resp .error_code == 'INVALID_ARGUMENT' :
108- if 'constraintViolations' not in resp .violations :
109- resp .update (message = "Received violation warning:\n %s" % self .sdk .dumps (resp .violations ))
110- self .sdk .throw_warning (CdpWarning (resp .violations ))
108+ if 'constraintViolations' not in str ( resp .violations ) :
109+ resp .update (message = "Received violation warning:\n %s" % self .sdk .dumps (str ( resp .violations ) ))
110+ self .sdk .throw_warning (CdpWarning (str ( resp .violations ) ))
111111 self .sdk .throw_error (resp )
112112 return resp
113113
@@ -119,9 +119,9 @@ def create_azure_environment(self, **kwargs):
119119 )
120120 if isinstance (resp , CdpError ):
121121 if resp .error_code == 'INVALID_ARGUMENT' :
122- if 'constraintViolations' not in resp .violations :
123- resp .update (message = "Received violation warning:\n %s" % self .sdk .dumps (resp .violations ))
124- self .sdk .throw_warning (CdpWarning (resp .violations ))
122+ if 'constraintViolations' not in str ( resp .violations ) :
123+ resp .update (message = "Received violation warning:\n %s" % self .sdk .dumps (str ( resp .violations ) ))
124+ self .sdk .throw_warning (CdpWarning (str ( resp .violations ) ))
125125 self .sdk .throw_error (resp )
126126 return resp
127127
@@ -133,9 +133,9 @@ def create_gcp_environment(self, **kwargs):
133133 )
134134 if isinstance (resp , CdpError ):
135135 if resp .error_code == 'INVALID_ARGUMENT' :
136- if 'constraintViolations' not in resp .violations :
137- resp .update (message = "Received violation warning:\n %s" % self .sdk .dumps (resp .violations ))
138- self .sdk .throw_warning (CdpWarning (resp .violations ))
136+ if 'constraintViolations' not in str ( resp .violations ) :
137+ resp .update (message = "Received violation warning:\n %s" % self .sdk .dumps (str ( resp .violations ) ))
138+ self .sdk .throw_warning (CdpWarning (str ( resp .violations ) ))
139139 self .sdk .throw_error (resp )
140140 return resp
141141
@@ -205,7 +205,7 @@ def sync_users(self, environments=None):
205205 )
206206 if isinstance (resp , CdpError ):
207207 if resp .error_code == 'CONFLICT' :
208- operation_match = self .sdk .regex_search (self .sdk .OPERATION_REGEX , resp .violations )
208+ operation_match = self .sdk .regex_search (self .sdk .OPERATION_REGEX , str ( resp .violations ) )
209209 if operation_match is not None :
210210 existing_op_id = operation_match .group (1 )
211211 if not self .sdk .strict_errors :
@@ -264,11 +264,11 @@ def create_aws_credential(self, name, role, description, retries=3, delay=2):
264264 consistency_violations = [
265265 'Unable to verify credential' , 'sts:AssumeRole' , 'You are not authorized'
266266 ]
267- if any (x in resp .violations for x in consistency_violations ):
267+ if any (x in str ( resp .violations ) for x in consistency_violations ):
268268 retries = retries - 1
269269 self .sdk .throw_warning (
270270 CdpWarning ('Got likely AWS IAM eventual consistency error [%s], %d retries left...'
271- % (resp .violations , retries ))
271+ % (str ( resp .violations ) , retries ))
272272 )
273273 self .sdk .sleep (delay )
274274 return self .create_aws_credential (name , role , description , retries , delay )
0 commit comments