-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
post-install script changed from shell to python script
- Loading branch information
Showing
3 changed files
with
54 additions
and
46 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/python3 | ||
from shutil import copyfile | ||
from subprocess import call | ||
from os import sys | ||
import SSSDConfig | ||
|
||
sssd_conf = '/etc/sssd/sssd.conf' | ||
lookup_conf = '/etc/httpd/conf.modules.d/55-lookup_identity.conf' | ||
commands = ( | ||
['systemctl', 'restart', 'sssd'], | ||
['setsebool', '-P', 'httpd_dbus_sssd', 'on'], | ||
['sed', '-i', '/^#.*/s/^#//', lookup_conf], | ||
['systemctl', 'restart', 'httpd'] | ||
) | ||
|
||
|
||
def run(*cmd_params): | ||
|
||
ret = 0 | ||
try: | ||
cmd = cmd_params[0] | ||
print(cmd) | ||
ret = call(cmd_params) | ||
except Exception as e: | ||
print("Execution of " + cmd + " failed: " + str(e), file=sys.stderr) | ||
ret = -1 | ||
return ret | ||
|
||
|
||
def configure_sssd(): | ||
|
||
copyfile(conf, orig.conf+'.orig') | ||
|
||
config_handle = SSSDConfig.SSSDConfig() | ||
config_handle.import_config(sssd_conf) | ||
try: | ||
config_handle.new_service('ifp') | ||
except SSSDConfig.ServiceAlreadyExists: | ||
pass | ||
config_handle.activate_service('ifp') | ||
config_handle.write(sssd_conf) | ||
|
||
|
||
def main(): | ||
configure_sssd() | ||
for command in commands: | ||
ret = run(*command) | ||
if ret != 0: | ||
return ret | ||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
exit(main()) |
This file was deleted.
Oops, something went wrong.