예제 #1
0
파일: image.py 프로젝트: ck1981/scalarizr
 def _clean(self, image_rootdir):
     # TODO: revise method, rewrite if needed
     LOG.info('Performing image cleanup')
     LOG.debug('Truncating log files')
     logs_path = os.path.join(image_rootdir, 'var/log')
     if os.path.exists(logs_path):
         for basename in os.listdir(logs_path):
             filename = os.path.join(logs_path, basename)
             if os.path.isfile(filename):
                 try:
                     coreutils.truncate(filename)
                 except OSError, e:
                     LOG.error("Cannot truncate file '%s'. %s", filename, e)
         shutil.rmtree(os.path.join(logs_path, 'scalarizr/scripting'))
예제 #2
0
파일: image.py 프로젝트: chenleji/scalarizr
 def _clean(self, image_rootdir):
     # TODO: revise method, rewrite if needed
     LOG.info('Performing image cleanup')
     LOG.debug('Truncating log files')
     logs_path = os.path.join(image_rootdir, 'var/log')
     if os.path.exists(logs_path):
         for basename in os.listdir(logs_path):
             filename = os.path.join(logs_path, basename)
             if os.path.isfile(filename):
                 try:
                     coreutils.truncate(filename)
                 except OSError, e:
                     LOG.error("Cannot truncate file '%s'. %s", filename, e)
         shutil.rmtree(os.path.join(logs_path, 'scalarizr/scripting'))
예제 #3
0
    def cleanup_image(self, rootdir):
        LOG.info('Performing image cleanup')
        # Truncate logs
        LOG.debug('Cleanuping image')

        LOG.debug('Truncating log files')
        logs_path = os.path.join(rootdir, 'var/log')
        if os.path.exists(logs_path):
            for basename in os.listdir(logs_path):
                filename = os.path.join(logs_path, basename)
                if os.path.isfile(filename):
                    try:
                        coreutils.truncate(filename)
                    except OSError, e:
                        self._logger.error("Cannot truncate file '%s'. %s", filename, e)
            shutil.rmtree(os.path.join(logs_path, 'scalarizr/scripting'))
예제 #4
0
    def cleanup_image(self, rootdir):
        LOG.info('Perforing image cleanup')
        # Truncate logs
        LOG.debug('Cleanuping image')

        LOG.debug('Truncating log files')
        logs_path = os.path.join(rootdir, 'var/log')
        if os.path.exists(logs_path):
            for basename in os.listdir(logs_path):
                filename = os.path.join(logs_path, basename)
                if os.path.isfile(filename):
                    try:
                        coreutils.truncate(filename)
                    except OSError, e:
                        self._logger.error("Cannot truncate file '%s'. %s",
                                           filename, e)
            shutil.rmtree(os.path.join(logs_path, 'scalarizr/scripting'))