mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Fix linter issues
This commit is contained in:
parent
0ea007de6f
commit
cf88c27353
@ -172,7 +172,7 @@ def _parse_chattr_man(man):
|
|||||||
'''
|
'''
|
||||||
Parse the contents of a chattr man page to find the E2fsprogs version
|
Parse the contents of a chattr man page to find the E2fsprogs version
|
||||||
'''
|
'''
|
||||||
match = re.search('E2fsprogs version [0-9\.]+', man)
|
match = re.search(r'E2fsprogs version [0-9\.]+', man)
|
||||||
if match:
|
if match:
|
||||||
version = match.group().strip('E2fsprogs version ')
|
version = match.group().strip('E2fsprogs version ')
|
||||||
else:
|
else:
|
||||||
@ -608,7 +608,7 @@ def lsattr(path):
|
|||||||
needed_version = salt.utils.versions.LooseVersion('1.41.12')
|
needed_version = salt.utils.versions.LooseVersion('1.41.12')
|
||||||
chattr_version = salt.utils.versions.LooseVersion(_chattr_version())
|
chattr_version = salt.utils.versions.LooseVersion(_chattr_version())
|
||||||
# The version of chattr on Centos 6 does not support extended
|
# The version of chattr on Centos 6 does not support extended
|
||||||
# attributes.
|
# attributes.
|
||||||
if chattr_version > needed_version:
|
if chattr_version > needed_version:
|
||||||
results[vals[1]] = re.findall(r"[aAcCdDeijPsStTu]", vals[0])
|
results[vals[1]] = re.findall(r"[aAcCdDeijPsStTu]", vals[0])
|
||||||
else:
|
else:
|
||||||
|
@ -2061,12 +2061,18 @@ class ChattrVersionTests(TestCase):
|
|||||||
' CHATTR(1)'
|
' CHATTR(1)'
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_chattr_version(self):
|
def test__parse_chattr_version(self):
|
||||||
|
'''
|
||||||
|
Validate we can parse the E2fsprogs version from the chattr man page
|
||||||
|
'''
|
||||||
man_out = dedent(self.CHATTR_MAN)
|
man_out = dedent(self.CHATTR_MAN)
|
||||||
parsed_version = filemod._parse_chattr_man(man_out)
|
parsed_version = filemod._parse_chattr_man(man_out)
|
||||||
assert parsed_version == '1.43.4', parsed_version
|
assert parsed_version == '1.43.4', parsed_version
|
||||||
|
|
||||||
def test_chattr_version(self):
|
def test__chattr_version(self):
|
||||||
|
'''
|
||||||
|
The _chattr_version method works
|
||||||
|
'''
|
||||||
with patch('subprocess.check_output', return_value=self.CHATTR_MAN):
|
with patch('subprocess.check_output', return_value=self.CHATTR_MAN):
|
||||||
parsed_version = filemod._chattr_version()
|
parsed_version = filemod._chattr_version()
|
||||||
assert parsed_version == '1.43.4', parsed_version
|
assert parsed_version == '1.43.4', parsed_version
|
||||||
|
Loading…
Reference in New Issue
Block a user