Shahar Havivi has posted comments on this change. Change subject: v2v: _read_ovf_from_tar_ova use tarfile package ......................................................................
Patch Set 1: (4 comments) https://gerrit.ovirt.org/#/c/50106/1//COMMIT_MSG Commit Message: Line 5: CommitDate: 2015-12-08 15:56:16 +0200 Line 6: Line 7: v2v: _read_ovf_from_tar_ova use tarfile package Line 8: Line 9: using build-in package instead of execCmd. > How about: Use tarfile instead of running tar process sure Line 10: Line 11: Change-Id: I5e027470f0ab283b3260fc02aafc01fe3debc95f https://gerrit.ovirt.org/#/c/50106/1/vdsm/v2v.py File vdsm/v2v.py: Line 915 Line 916 Line 917 Line 918 Line 919 > Lets add a test for this function - before you improve it. Next patch is a test to ovf, The test will include tests for the zip, tar and directory ovf Line 916: raise ClientError('OVA does not contains file with .ovf suffix') Line 917: Line 918: Line 919: def _read_ovf_from_tar_ova(ova_path): Line 920: tar = tarfile.TarFile(ova_path) > Also, better use the higher level interface tarfile.open(). Done Line 921: for member in tar.getmembers(): Line 922: if member.name.endswith('.ovf'): Line 923: ovf = tar.extractfile(member) Line 924: with closing(ovf): Line 917: Line 918: Line 919: def _read_ovf_from_tar_ova(ova_path): Line 920: tar = tarfile.TarFile(ova_path) Line 921: for member in tar.getmembers(): > Tarfile is iteratble - you can do: Done Line 922: if member.name.endswith('.ovf'): Line 923: ovf = tar.extractfile(member) Line 924: with closing(ovf): Line 925: return ovf.read() -- To view, visit https://gerrit.ovirt.org/50106 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5e027470f0ab283b3260fc02aafc01fe3debc95f Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Shahar Havivi <shav...@redhat.com> Gerrit-Reviewer: Francesco Romani <from...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Shahar Havivi <shav...@redhat.com> Gerrit-Reviewer: gerrit-hooks <automat...@ovirt.org> Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches