mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Correctly write SELinux config file (#31251)
* Add new lines to end of config file lines * Properly write out selinux config file Change module behavior to not always report a change but warn if a reboot is needed and return reboot_required. Improve the output messages. Add strip parameter to get_file_lines utility to help with parsing the selinux config file. * Add return documentation * Add integration tests for selinux module * Use consistent capitalization for SELinux * Use atomic_move in selinux module * Don't copy the config file initially There's no need to make a copy just for reading. * Put message after set_config_policy in case the change fails * Add aliases to selinux tests
This commit is contained in:
parent
aa4b3f14c5
commit
00df1fda10
5 changed files with 274 additions and 28 deletions
|
@ -36,9 +36,9 @@ def get_file_content(path, default=None, strip=True):
|
|||
return data
|
||||
|
||||
|
||||
def get_file_lines(path):
|
||||
def get_file_lines(path, strip=True):
|
||||
'''get list of lines from file'''
|
||||
data = get_file_content(path)
|
||||
data = get_file_content(path, strip=strip)
|
||||
if data:
|
||||
ret = data.splitlines()
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue