Skip to content

Commit

Permalink
Debug approve
Browse files Browse the repository at this point in the history
  • Loading branch information
Knucklessg1 committed May 19, 2024
1 parent ebc1639 commit af0af79
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions servicenow_api/servicenow_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,7 @@ def approve_change_request(self, **kwargs) -> Response:
if change_request.change_request_sys_id is None or change_request.state is None:
raise MissingParameterError
try:
print(f"DATA: {change_request.data}")
response = self._session.patch(
url=f"{self.url}/sn_chg_rest"
f"/change/{change_request.change_request_sys_id}/approvals",
Expand Down
26 changes: 13 additions & 13 deletions servicenow_api/servicenow_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1919,7 +1919,7 @@ def is_successful(self):


class CMDB(BaseModel):
model_config = ConfigDict(extra="forbid")
model_config = ConfigDict(extra="allow")
__hash__ = object.__hash__
base_type: str = Field(default="CMDB")
icon_url: Optional[str] = Field(default=None, description="Class icon URL.")
Expand Down Expand Up @@ -1967,7 +1967,7 @@ class ServiceRelation(BaseModel):


class Service(BaseModel):
model_config = ConfigDict(extra="forbid")
model_config = ConfigDict(extra="allow")
__hash__ = object.__hash__
base_type: str = Field(default="Service")
name: str = Field(default=None, description="Name of the application service.")
Expand Down Expand Up @@ -2041,14 +2041,14 @@ class Response(BaseModel):
List,
BatchInstallResult,
CICD,
CMDB,
List[ConfigurationItem],
ConfigurationItem,
List[ImportSetResult],
ImportSetResult,
Schedule,
List[State],
State,
CMDB,
List[Task],
Task,
List[ChangeRequest],
Expand Down Expand Up @@ -2081,12 +2081,12 @@ def determine_application_service_type(cls, v):
try:
return [model(**item) for item in v]
except Exception as e:
print(
f"Error validating one of the models in the list: {e}"
)
# print(
# f"Error validating one of the models in the list: {e}"
# )
continue
except Exception as e:
print(f"Validation Failed for {model} - {v}\nError: {e}")
#print(f"Validation Failed for {model} - {v}\nError: {e}")
pass
return v

Expand All @@ -2106,12 +2106,12 @@ def determine_cmdb_type(cls, v):
try:
return [model(**item) for item in v]
except Exception as e:
print(
f"Error validating one of the models in the list: {e}"
)
# print(
# f"Error validating one of the models in the list: {e}"
# )
continue
except Exception as e:
print(f"Validation Failed for {model} - {v}\nError: {e}")
#print(f"Validation Failed for {model} - {v}\nError: {e}")
pass
return v

Expand All @@ -2120,14 +2120,14 @@ def determine_result_type(cls, v):
models = [
BatchInstallResult,
CICD,
CMDB,
List[ConfigurationItem],
ConfigurationItem,
List[ImportSetResult],
ImportSetResult,
Schedule,
List[State],
State,
CMDB,
List[Task],
Task,
List[ChangeRequest],
Expand All @@ -2147,6 +2147,6 @@ def determine_result_type(cls, v):
except Exception:
continue
except Exception as e:
print(f"Validation Failed for {model} - {v}\nError: {e}")
#print(f"Validation Failed for {model} - {v}\nError: {e}")
pass
return v

0 comments on commit af0af79

Please sign in to comment.