Skip to content

Commit 37d2db4

Browse files
committed
iso module should PUT to server with Content-Length HTTP header
Not strictly needed - ISO upload works also without Content-Length. But it seems reasonable. Signed-off-by: Justin Cinkelj <justin.cinkelj@xlab.si>
1 parent ed9b615 commit 37d2db4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

plugins/modules/iso.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def ensure_present(module, rest_client):
125125
TaskTag.wait_task(rest_client, task_tag_create)
126126

127127
# Uploading ISO image.
128+
file_size = os.stat(module.params["source"]).st_size
128129
with open(module.params["source"], "rb") as source_file:
129130
rest_client.put_record(
130131
endpoint="/rest/v1/ISO/%s/data" % iso_uuid,
@@ -135,6 +136,7 @@ def ensure_present(module, rest_client):
135136
headers={
136137
"Content-Type": "application/octet-stream",
137138
"Accept": "application/json",
139+
"Content-Length": file_size,
138140
},
139141
)
140142

0 commit comments

Comments
 (0)