예제 #1
0
파일: collector.py 프로젝트: cldeluna/salt
    def _save_payload(self, files, directories, links):
        '''
        Save payload (unmanaged files)

        :param files:
        :param directories:
        :param links:
        :return:
        '''

        idx = 0
        for p_type, p_list in (
            ('f', files),
            ('d', directories),
            (
                'l',
                links,
            ),
        ):
            for p_obj in p_list:
                stats = os.stat(p_obj)

                payload = PayloadFile()
                payload.id = idx
                payload.path = p_obj
                payload.p_type = p_type
                payload.mode = stats.st_mode
                payload.uid = stats.st_uid
                payload.gid = stats.st_gid
                payload.p_size = stats.st_size
                payload.atime = stats.st_atime
                payload.mtime = stats.st_mtime
                payload.ctime = stats.st_ctime

                idx += 1
                self.db.store(payload)
예제 #2
0
파일: collector.py 프로젝트: bryson/salt
    def _save_payload(self, files, directories, links):
        """
        Save payload (unmanaged files)

        :param files:
        :param directories:
        :param links:
        :return:
        """

        idx = 0
        for p_type, p_list in (("f", files), ("d", directories), ("l", links)):
            for p_obj in p_list:
                stats = os.stat(p_obj)

                payload = PayloadFile()
                payload.id = idx
                payload.path = p_obj
                payload.p_type = p_type
                payload.mode = stats.st_mode
                payload.uid = stats.st_uid
                payload.gid = stats.st_gid
                payload.p_size = stats.st_size
                payload.atime = stats.st_atime
                payload.mtime = stats.st_mtime
                payload.ctime = stats.st_ctime

                idx += 1
                self.db.store(payload)