Skip to content

Commit

Permalink
Remove read-only fields of private hooks (#12)
Browse files Browse the repository at this point in the history
* Remove read-only fields of private hooks

* Fix creating objects
  • Loading branch information
rehoumir authored Sep 5, 2024
1 parent 4640fd8 commit e736b55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 7 additions & 0 deletions project_rossum_deploy/commands/migrate/upload_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ async def create_hook_based_on_template(hook: dict, client: ElisAPIClient):
created_hook = await client._http_client.request_json(
"POST", url="hooks/create", json=create_payload
)

# In case the hook became private, remove conflicting fields
if (hook_config := created_hook.get("config", {})).get("private", False):
fields_to_remove = ["code", "third_part_library_pack", "runtime"]
for field in fields_to_remove:
hook_config.pop("code", field)

return await client._http_client.update(
resource=Resource.Hook, id_=created_hook["id"], data=hook
)
Expand Down
7 changes: 0 additions & 7 deletions project_rossum_deploy/commands/upload/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ async def create_object(
object["id"] = None
resource = determine_object_type_from_path(path)

local_remote_timestamp_synced = await check_modified_timestamp(
client, resource, id, object
)
if not force and not local_remote_timestamp_synced:
display_error(create_mismatch_warning(resource, id))
return

result = await client._http_client.create(resource, object)

# Just to update the timestamp
Expand Down

0 comments on commit e736b55

Please sign in to comment.