glennmatthews / cot

Common OVF Tool
MIT License
90 stars 23 forks source link

2.0.1 - in-place editing of TAR files fails #66

Closed glennmatthews closed 7 years ago

glennmatthews commented 7 years ago
cot --force add-file cot.tgz csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova

WARNING : Automatically agreeing to 'Overwrite existing file csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova?'
Traceback (most recent call last):
   File "cot", line 66, in <module>
     COT.ui.cli.main()
   File "COT/ui/cli.py", line 717, in main
     CLI().run(sys.argv[1:])
   File "COT/ui/cli.py", line 324, in run
     return self.main(args)
   File "COT/ui/cli.py", line 602, in main
     args.instance.finished()
   File "COT/commands/command.py", line 389, in finished
     self.vm.write()
   File "COT/vm_description/ovf/ovf.py", line 734, in write
     self.tar(ovf_file, self.output_file)
   File "COT/vm_description/ovf/ovf.py", line 2677, in tar
     file_ref.add_to_archive(tarf)
   File "COT/file_reference.py", line 248, in add_to_archive
     self.open('r')
   File "COT/file_reference.py", line 219, in open
     self.obj = self.tarf.extractfile(self.filename)
   File "python3/current/lib/python3.4/tarfile.py", line 2044, in extractfile
     tarinfo = self.getmember(member)
   File "python3/current/lib/python3.4/tarfile.py", line 1729, in getmember
     raise KeyError("filename %r not found" % name)
KeyError: "filename 'csr1000v_harddisk.vmdk' not found"
glennmatthews commented 7 years ago

with debugs:

DEBUG   : 10:59:47.651 : cli             :  311 :                   set_verbosity() : Verbosity level is now DEBUG
INFO    : 10:59:47.651 : vm_description  :  162 :                         factory() : Loading 'csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova' as OVF
VERBOSE : 10:59:47.652 : vm_description  :  188 :                        __init__() : Creating temporary working directory for this VM
DEBUG   : 10:59:47.652 : vm_description  :  190 :                        __init__() : Working directory: /tmp/cothsu80a9z
VERBOSE : 10:59:47.652 : ovf             : 2533 :                           untar() : Untarring csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova to working directory /tmp/cothsu80a9z
DEBUG   : 10:59:47.654 : ovf             : 2558 :                           untar() : Examining path of csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ovf prior to untar
DEBUG   : 10:59:47.655 : ovf             : 2558 :                           untar() : Examining path of csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.mf prior to untar
DEBUG   : 10:59:47.655 : ovf             : 2558 :                           untar() : Examining path of csr1000v_harddisk.vmdk prior to untar
DEBUG   : 10:59:47.655 : ovf             : 2558 :                           untar() : Examining path of bdeo.sh prior to untar
DEBUG   : 10:59:47.655 : ovf             : 2558 :                           untar() : Examining path of README-OVF.txt prior to untar
DEBUG   : 10:59:47.655 : ovf             : 2558 :                           untar() : Examining path of README-BDEO.txt prior to untar
DEBUG   : 10:59:47.655 : ovf             : 2588 :                           untar() : Extracted OVF descriptor from csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova to working dir /tmp/cothsu80a9z
DEBUG   : 10:59:47.657 : ovf             :  311 :                     ovf_version() : Root namespace is http://schemas.dmtf.org/ovf/envelope/1
INFO    : 10:59:47.657 : ovf             :  316 :                     ovf_version() : OVF version is 1.x
VERBOSE : 10:59:47.658 : ovf             :  456 :                 config_profiles() : Current configuration profiles are: ['1CPU-4GB', '2CPU-4GB', '4CPU-4GB', '4CPU-8GB']
DEBUG   : 10:59:47.677 : hardware        :   97 :                        __init__() : OVF contains 16 hardware Item elements describing 13 unique devices
INFO    : 10:59:47.677 : ovf             :  365 :                        platform() : OVF product class com.cisco.csr1000v --> platform Cisco CSR1000V
INFO    : 10:59:47.681 : vm_description  :  168 :                         factory() : Successfully loaded OVF from csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
DEBUG   : 10:59:47.687 : ovf             :  701 :           predicted_output_size() : Estimated output size is 170 KiB
VERBOSE : 10:59:47.687 : command         :  178 :                check_disk_space() : Checking requested disk space (170 KiB) against available space in /tmp/cothsu80a9z
DEBUG   : 10:59:47.687 : utilities       :   56 :         available_bytes_at_path() : There appears to be 7.999 GiB available at /tmp/cothsu80a9z
DEBUG   : 10:59:47.693 : ovf             :  701 :           predicted_output_size() : Estimated output size is 170 KiB
VERBOSE : 10:59:47.693 : command         :  178 :                check_disk_space() : Checking requested disk space (340 KiB) against available space in /tmp/glmatthe
DEBUG   : 10:59:47.694 : utilities       :   56 :         available_bytes_at_path() : There appears to be 7.999 GiB available at /tmp/glmatthe
WARNING : 10:59:47.694 : cli             :  337 :                         confirm() : Automatically agreeing to 'Overwrite existing file /tmp/glmatthe/csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova?'
DEBUG   : 10:59:47.694 : ovf             : 1919 :            search_from_filename() : Looking for existing disk info based on filename cot.tgz
DEBUG   : 10:59:47.694 : ovf             : 2238 :                        add_file() : Adding File to OVF
DEBUG   : 10:59:47.700 : ovf             :  701 :           predicted_output_size() : Estimated output size is 290 KiB
VERBOSE : 10:59:47.700 : command         :  178 :                check_disk_space() : Checking requested disk space (580 KiB) against available space in /tmp/glmatthe
DEBUG   : 10:59:47.700 : utilities       :   56 :         available_bytes_at_path() : There appears to be 7.999 GiB available at /tmp/glmatthe
INFO    : 10:59:47.700 : ovf             :  709 :                           write() : Updating and validating internal data before writing out to disk
DEBUG   : 10:59:47.701 : hardware        :  131 :                      update_xml() : Cleared 16 existing items from VirtualHWSection
DEBUG   : 10:59:47.701 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 1
DEBUG   : 10:59:47.705 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 2
DEBUG   : 10:59:47.707 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 3
DEBUG   : 10:59:47.708 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 4
DEBUG   : 10:59:47.708 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 5
DEBUG   : 10:59:47.709 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 6
DEBUG   : 10:59:47.710 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 7
DEBUG   : 10:59:47.711 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 8
DEBUG   : 10:59:47.712 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 9
DEBUG   : 10:59:47.713 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 10
DEBUG   : 10:59:47.714 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 11
DEBUG   : 10:59:47.715 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 12
DEBUG   : 10:59:47.716 : hardware        :  135 :                      update_xml() : Writing Item(s) with InstanceID 13
VERBOSE : 10:59:47.717 : hardware        :  144 :                      update_xml() : Updated XML VirtualHardwareSection, now contains 16 Items representing 13 devices
INFO    : 10:59:47.733 : ovf             :  727 :                           write() : Writing out to file /tmp/glmatthe/csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
VERBOSE : 10:59:47.734 : xml_file        :   87 :                       write_xml() : Writing XML to /tmp/cothsu80a9z/csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ovf
VERBOSE : 10:59:47.737 : ovf             : 2607 :               generate_manifest() : Generating manifest for /tmp/cothsu80a9z/csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ovf
DEBUG   : 10:59:47.740 : ovf             : 2629 :               generate_manifest() : Manifest generated successfully
VERBOSE : 10:59:47.741 : ovf             : 2639 :                             tar() : Creating tar file /tmp/glmatthe/csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
DEBUG   : 10:59:47.741 : ovf             : 2660 :                             tar() : Adding OVF descriptor /tmp/cothsu80a9z/csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ovf to /tmp/glmatthe/csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
DEBUG   : 10:59:47.742 : ovf             : 2665 :                             tar() : Adding manifest to /tmp/glmatthe/csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
DEBUG   : 10:59:47.743 : ovf             : 2676 :                             tar() : Adding associated file csr1000v_harddisk.vmdk to /tmp/glmatthe/csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
VERBOSE : 10:59:47.743 : vm_description  :  219 :                         destroy() : Removing working directory
DEBUG   : 10:59:47.743 : utilities       :   86 :                  directory_size() : Total disk space consumed by /tmp/cothsu80a9z is 20.94 KiB
DEBUG   : 10:59:47.744 : vm_description  :  224 :                         destroy() : Size of working directory '/tmp/cothsu80a9z', prior to removal, is 20.94 KiB
Traceback (most recent call last):
  File "cot", line 66, in <module>
    COT.ui.cli.main()
  File "COT/ui/cli.py", line 717, in main
    CLI().run(sys.argv[1:])
  File "COT/ui/cli.py", line 324, in run
    return self.main(args)
  File "COT/ui/cli.py", line 602, in main
    args.instance.finished()
  File "COT/commands/command.py", line 389, in finished
    self.vm.write()
  File "COT/vm_description/ovf/ovf.py", line 734, in write
    self.tar(ovf_file, self.output_file)
  File "COT/vm_description/ovf/ovf.py", line 2677, in tar
    file_ref.add_to_archive(tarf)
  File "COT/file_reference.py", line 248, in add_to_archive
    self.open('r')
  File "COT/file_reference.py", line 219, in open
    self.obj = self.tarf.extractfile(self.filename)
  File "python3/current/lib/python3.4/tarfile.py", line 2044, in extractfile
    tarinfo = self.getmember(member)
  File "python3/current/lib/python3.4/tarfile.py", line 1729, in getmember
    raise KeyError("filename %r not found" % name)
KeyError: "filename 'csr1000v_harddisk.vmdk' not found"
glennmatthews commented 7 years ago

Compare to v1.9.1 debugs:

    INFO: COT.ovf.ovf            Writing out to file csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
 VERBOSE: COT.ovf.ovf            Generating manifest for /tmp/cotxns1k3_q/csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ovf
 VERBOSE: COT.ovf.ovf            Creating tar file csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
 VERBOSE: COT.ovf.ovf            Extracting files from csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova before overwriting it.
    INFO: COT.file_reference     Extracting README-BDEO.txt from csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova to /tmp/cotxns1k3_q
    INFO: COT.file_reference     Extracting README-OVF.txt from csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova to /tmp/cotxns1k3_q
    INFO: COT.file_reference     Extracting csr1000v_harddisk.vmdk from csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova to /tmp/cotxns1k3_q
    INFO: COT.file_reference     Extracting bdeo.sh from csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova to /tmp/cotxns1k3_q
 VERBOSE: COT.ovf.ovf            Adding /tmp/cotxns1k3_q/csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ovf to csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
 VERBOSE: COT.ovf.ovf            Adding manifest to csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
    INFO: COT.file_reference     Adding /tmp/cotxns1k3_q/csr1000v_harddisk.vmdk to TAR file as csr1000v_harddisk.vmdk
 VERBOSE: COT.ovf.ovf            Added csr1000v_harddisk.vmdk to csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
    INFO: COT.file_reference     Adding /tmp/cotxns1k3_q/bdeo.sh to TAR file as bdeo.sh
 VERBOSE: COT.ovf.ovf            Added bdeo.sh to csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
    INFO: COT.file_reference     Adding /tmp/cotxns1k3_q/README-OVF.txt to TAR file as README-OVF.txt
 VERBOSE: COT.ovf.ovf            Added README-OVF.txt to csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
    INFO: COT.file_reference     Adding /tmp/cotxns1k3_q/README-BDEO.txt to TAR file as README-BDEO.txt
 VERBOSE: COT.ovf.ovf            Added README-BDEO.txt to csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova
    INFO: COT.file_reference     Adding cot.tgz to TAR file as cot.tgz
 VERBOSE: COT.ovf.ovf            Added cot.tgz to csr1000v-universalk9.2017-03-20_10.44_rmelton-vga.ova