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:
Sam Doran 2017-10-03 23:38:58 -04:00 committed by GitHub
parent aa4b3f14c5
commit 00df1fda10
5 changed files with 274 additions and 28 deletions

View file

@ -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: