Skip to content

Commit

Permalink
post-install script changed from shell to python script
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiboris committed Aug 24, 2016
1 parent fb2b2b6 commit 103f3d7
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 46 deletions.
25 changes: 0 additions & 25 deletions ipa-x509-auth-setup.sh

This file was deleted.

54 changes: 54 additions & 0 deletions post-install.py
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())
21 changes: 0 additions & 21 deletions post-install.sh

This file was deleted.

0 comments on commit 103f3d7

Please sign in to comment.