Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def delete(self):
"""
Force delete root directory and its contents
"""
Path.wipe(self.root_dir)
def __del__(self):
log.info('Cleaning up %s instance', type(self).__name__)
if self.media_dir:
Path.wipe(self.media_dir)
if self.pxe_dir:
Path.wipe(self.pxe_dir)
if self.squashed_contents:
Path.wipe(self.squashed_contents)
def __del__(self):
if self.media_dir or self.live_container_dir:
log.info(
'Cleaning up {0} instance'.format(type(self).__name__)
)
if self.media_dir:
Path.wipe(self.media_dir)
if self.live_container_dir:
Path.wipe(self.live_container_dir)
def __del__(self):
log.info('Cleaning up %s instance', type(self).__name__)
if self.media_dir:
Path.wipe(self.media_dir)
if self.pxe_dir:
Path.wipe(self.pxe_dir)
if self.squashed_contents:
Path.wipe(self.squashed_contents)
def setup_media_loader_directory(lookup_path, media_path, boot_theme):
loader_data = lookup_path + '/image/loader/'
media_boot_path = os.sep.join(
[media_path, Defaults.get_iso_boot_path(), 'loader']
)
Path.wipe(loader_data)
Path.create(loader_data)
grub_image_file_names = [
Defaults.get_isolinux_bios_grub_loader(),
'boot_hybrid.img'
]
loader_files = []
for grub_image_file_name in grub_image_file_names:
grub_file = Defaults.get_grub_path(
lookup_path, 'i386-pc/{0}'.format(grub_image_file_name),
raise_on_error=False
)
if grub_file and os.path.exists(grub_file):
loader_files.append(grub_file)
for syslinux_file_name in Defaults.get_syslinux_modules():
for syslinux_dir in Defaults.get_syslinux_search_paths():
def delete_all_repos(self):
"""
Delete all zypper repositories
"""
Path.wipe(self.shared_zypper_dir['reposd-dir'])
Path.create(self.shared_zypper_dir['reposd-dir'])
def _cleanup(self):
"""
Delete all temporary directories
"""
for metadata_dir in self.repository_metadata_dirs:
Path.wipe(metadata_dir)
if self.repository_solvable_dir:
Path.wipe(self.repository_solvable_dir)
self._init_temporary_dir_names()
"""
Delete dnf repository cache
The cache data for each repository is stored in a directory
and additional files all starting with the repository name.
The method glob deletes all files and directories matching
the repository name followed by any characters to cleanup
the cache information
:param str name: repository name
"""
dnf_cache_glob_pattern = ''.join(
[self.shared_dnf_dir['cache-dir'], os.sep, name, '*']
)
for dnf_cache_file in glob.iglob(dnf_cache_glob_pattern):
Path.wipe(dnf_cache_file)
def delete_all_repos(self):
"""
Delete all apt-get repositories
"""
Path.wipe(self.shared_apt_get_dir['sources-dir'])
Path.create(self.shared_apt_get_dir['sources-dir'])
def __del__(self):
if self.oci_root_dir:
Path.wipe(self.oci_root_dir)
if self.oci_dir:
Path.wipe(self.oci_dir)