Skip to content

Commit

Permalink
Debugging 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Barmaley13 committed Dec 17, 2015
1 parent 67e2f1c commit 1d62dfd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion vmware_backup/__init__.py
Expand Up @@ -25,6 +25,6 @@

### CONSTANTS ###
## Meta Data##
__version__ = '1.02.09'
__version__ = '1.02.10'
__author__ = 'Kirill V. Belyayev'
__license__ = 'GPL'
47 changes: 27 additions & 20 deletions vmware_backup/virtual_machine.py
Expand Up @@ -219,28 +219,35 @@ def backup_needed(self):
""" Determine if backup needed or not """
vmx_match = False
vmx_file = os.path.join(self.path, self.name + '.vmx')
for dir_path, dir_names, file_names in os.walk(self.settings['tape_path']):
for dir_name in dir_names:
if self.name in dir_name:
# Compare *.vmx files (size and access date)
vmx_files = glob.glob(os.path.join(dir_path, dir_name, self.name + '.vmx'))
for _vmx_file in vmx_files:
# Compare files
vmx_match = filecmp.cmp(_vmx_file, vmx_file, True)

if vmx_match:
self._print("Virtual Machine '" + self.name + "' have been backed up already!")
self._print('Backup Path: ' + str(_vmx_file))
break

else:
continue
break
if os.path.isfile(vmx_file):
for dir_path, dir_names, file_names in os.walk(self.settings['tape_path']):
for dir_name in dir_names:
if self.name in dir_name:
vm_path = os.path.join(dir_path, dir_name)
# Compare *.vmx files (size and access date)
vmx_files = glob.glob(os.path.join(vm_path, self.name + '.vmx'))
for _vmx_file in vmx_files:
# Compare files
vmx_match = filecmp.cmp(_vmx_file, vmx_file, True)

if vmx_match:
self._print("Virtual Machine '" + self.name + "' have been backed up already!")
self._print('Backup Path: ' + str(vm_path))
break

else:
continue
break
else:
continue
break
else:
continue
break
self._print("Virtual Machine '" + self.name + "' have not been backed up yet!")

else:
self._print("Virtual Machine '" + self.name + "' have not been backed up yet!")
vmx_match = True
self._print("Virtual Machine '" + self.name + "' does not have '" + self.name + ".vmx' file!"
" Skipping backup!")

return not vmx_match

Expand Down

0 comments on commit 1d62dfd

Please sign in to comment.