Exemplo n.º 1
0
 def check_cleanconf_dir(result_dir, cleanconf):
     # Check if configuration file exists in /root/preupgrade/cleanconf directory
     clean_conf_name = os.path.join(result_dir, cleanconf)
     if os.path.exists(clean_conf_name):
         message = "The '%s' configuration file already exists in the '%s' directory"
         logger.info(message % (clean_conf_name, os.path.dirname(clean_conf_name)))
         # Check if configuration file exists in dirtyconf
         # If so delete them.
         return True
     return False
Exemplo n.º 2
0
 def check_dirtyconf_dir(dirtyconf, filename):
     # Check if configuration file exists in /root/preupgrade/dirtyconf directory
     # If not return real path of configuration file. Not a symlink.
     full_path = filename
     # Copy filename to dirtyconf directory
     # Check if file is a symlink or real path.
     if os.path.islink(full_path):
         full_path = os.path.realpath(full_path)
     # Check if configuration file exists in dirtyconf directory
     if os.path.exists(dirtyconf):
         logger.info("The '%s' file already exists in the dirtyconf directory", dirtyconf)
         return False
     # Check whether dirtyconf directory with dirname(filename) exists
     if not os.path.exists(os.path.dirname(dirtyconf)):
         os.makedirs(os.path.dirname(dirtyconf))
     return full_path