Skip to content

Commit

Permalink
fix: flex-linux-setup enable apache module mod_dir (ref: #291)
Browse files Browse the repository at this point in the history
  • Loading branch information
devrimyatar committed Jul 11, 2022
1 parent ae95167 commit d92b21a
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion flex-linux-setup/flex_linux_setup/flex_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import code
import configparser
import shlex
import shutil

from pathlib import Path
from urllib import request
Expand Down Expand Up @@ -214,14 +215,41 @@ def add_apache_directive(self, check_str, template):

https_jans_list = https_jans_text.splitlines()
n = 0

for i, l in enumerate(https_jans_list):
if l.strip() == '</LocationMatch>':
n = i

https_jans_list.insert(n+1, '\n' + apache_directive_text + '\n')
self.writeFile(httpd_installer.https_jans_fn, '\n'.join(https_jans_list))

# Enable mod_dir for apache

cmd_a2enmod = shutil.which('a2enmod')

if base.clone_type == 'deb':
httpd_installer.run([cmd_a2enmod, 'dir'])

elif base.os_type == 'suse':
httpd_installer.run([cmd_a2enmod, 'dir'])
cmd_a2enflag = shutil.which('a2enflag')
httpd_installer.run([cmd_a2enflag, 'SSL'])

else:
base_mod_path = Path('/etc/httpd/conf.modules.d/00-base.conf')
mod_load_content = base_mod_path.read_text().splitlines()
modified = False

for i, l in enumerate(mod_load_content[:]):
ls = l.strip()
if ls.startswith('#') and ls.endswith('mod_dir.so'):
mod_load_content[i] = ls.lstrip('#')
modified = True

if modified:
base_mod_path.write_text('\n'.join(mod_load_content))


def install_gluu_admin_ui(self):

print("Installing Gluu Admin UI Frontend")
Expand Down

0 comments on commit d92b21a

Please sign in to comment.