LsAttr - command lsattr <files_or_dirs>
- class insights.parsers.lsattr.LsAttr(context)[source]
Bases:
Parser
,dict
Parses the output of the
lsattr <files_or_dirs>
command. It stores the mapping of the file and its attributes to a dict, the key is the file path, the value is the attributes by removing the useless dashes. If the file or dir does not exist, it stores a list of the whole error line in the specific “non-exist” key.Sample output:
---------------- ./grub2-tools-2.02-0.86.el7.x86_64.rpm ------i--------- ./grub2-common-2.02-0.86.el7.noarch.rpm ---------------- ./grub2-tools-minimal-2.02-0.86.el7.x86_64.rpm lsattr: No such file or directory while trying to stat a/f
- Raises:
SkipComponent -- when nothing is parsed out
Examples
>>> './grub2-common-2.02-0.86.el7.noarch.rpm' in lsattr_obj True >>> lsattr_obj['./grub2-common-2.02-0.86.el7.noarch.rpm'] 'i' >>> 'a/f' in lsattr_obj False >>> lsattr_obj['non-exist'][0] 'lsattr: No such file or directory while trying to stat a/f'