Skip to content

Commit

Permalink
Removed double Content-Type workaround (#41)
Browse files Browse the repository at this point in the history
* refactor: removed double content-type workaround

* fix: pull new nethsm docker image, if available
  • Loading branch information
q-nk authored Oct 12, 2023
1 parent 4e4bdfe commit 23967e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ The current list of such functions is:

- `NetHSM.set_key_certificate()` : `/keys/{KeyID}/cert`
- `NetHSM.set_certificate()` : `/config/tls/cert.pem`
- `NetHSM.update()`: `/system/update`, manual deserialization because the content-type header is sent twice, see [#245 on the NetHSM repo](https://git.nitrokey.com/nitrokey/nethsm/nethsm/-/issues/245)

### Publishing a new version

Expand Down Expand Up @@ -108,4 +107,4 @@ docker run -v "$PWD:/nethsm" -e FLIT_ROOT_INSTALL=1 -e TEST_MODE=ci -it --entryp

> Be aware this command will create files owned by root in your working directory.
This CI mode manually start and stops the necessary processes to run a NetHSM instance, due to its design it may brake when the container image is updated.
This CI mode manually start and stops the necessary processes to run a NetHSM instance, due to its design it may break when the container image is updated.
7 changes: 1 addition & 6 deletions nethsm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,12 +1311,7 @@ def restore(self, backup: BufferedReader, passphrase: str, time: datetime):

def update(self, image: BufferedReader):
try:
# Currently the deserialisation doesn't work because of a bug where the api sends the content-type header twice
# https://git.nitrokey.com/nitrokey/nethsm/nethsm/-/issues/245

response = self.get_api().system_update_post(
body=image, skip_deserialization=True
)
response = self.get_api().system_update_post(body=image)
except Exception as e:
_handle_exception(
e,
Expand Down
5 changes: 4 additions & 1 deletion tests/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ def __init__(self):
pass
sleep(1)

repository, tag = C.IMAGE.split(":")
image = client.images.pull(repository, tag=tag)

container = client.containers.run(
C.IMAGE,
image,
"",
ports={"8443": 8443},
remove=True,
Expand Down

0 comments on commit 23967e5

Please sign in to comment.