Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tarfile.GNU_FORMAT in pack_ova.py when create OVA #374

Merged
merged 2 commits into from
May 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@ def pad_to_block_size(file):
def write_ovf(entity, ova_file, ovf):
print("writing ovf: %s" % ovf)
tar_info = create_tar_info(entity + ".ovf", len(ovf))
ahadas marked this conversation as resolved.
Show resolved Hide resolved
ova_file.write(tar_info.tobuf())
buf = (tar_info.tobuf() if python2 else
tar_info.tobuf(format=tarfile.GNU_FORMAT))
ova_file.write(buf)
ova_file.write(ovf if python2 else ovf.encode())
pad_to_block_size(ova_file)


def write_file(name, ova_file, data):
print("writing file: %s" % name)
tar_info = create_tar_info(name, len(data))
ova_file.write(tar_info.tobuf())
buf = (tar_info.tobuf() if python2 else
tar_info.tobuf(format=tarfile.GNU_FORMAT))
ova_file.write(buf)
ova_file.write(data.encode())
pad_to_block_size(ova_file)

Expand Down Expand Up @@ -120,7 +124,9 @@ def write_disk_headers(ova_file, disks_info):
disk_name = os.path.basename(disk_path)
tar_info = create_tar_info(disk_name, disk_size)
# write tar info
ova_file.write(tar_info.tobuf())
buf = (tar_info.tobuf() if python2 else
tar_info.tobuf(format=tarfile.GNU_FORMAT))
ova_file.write(buf)
path_to_offset[disk_path] = str(ova_file.tell())
ova_file.seek(disk_size, 1)

Expand Down