Skip to content

Commit

Permalink
feat(flex-linux-setup): admin-ui command line utility (#1976)
Browse files Browse the repository at this point in the history
Signed-off-by: Mustafa Baser <[email protected]>
  • Loading branch information
devrimyatar authored Jan 27, 2025
1 parent c8336ed commit 6df74ea
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
33 changes: 33 additions & 0 deletions flex-linux-setup/flex_linux_setup/admin-ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /usr/bin/env python3

import sys
import argparse
import subprocess

parser = argparse.ArgumentParser(description="Gluu/Flex Admin-UI command line utility")
parser.add_argument('-restart', help="Restarts services for Janssen config-api and apache web server", action='store_true')
argsp = parser.parse_args()

if len(sys.argv) < 2:
print("No argument was provided.")
sys.exit()

httpd_name = None
for sname in ('httpd', 'apache2'):
cmd = f'systemctl show --no-pager {sname} | grep LoadState=loaded'
cmd_output = subprocess.getoutput(cmd).strip()
if cmd_output:
httpd_name = sname
break
if not httpd_name:
print("\033[93mUnable to determine httpd server name\033[0m")
sys.exit()

if argsp.restart:
print("Restarting Admin-UI components")
for service in ('jans-config-api', httpd_name):
cmd = f'sudo systemctl restart {service}'
print(f"Executing {cmd}")
out = subprocess.getoutput(cmd).strip()
if out:
print(f"Command output: {out}")
6 changes: 6 additions & 0 deletions flex-linux-setup/flex_linux_setup/flex_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,12 @@ def get_client_parser():

self.rewrite_cli_ini()

print(f"Copying admin-ui command line utility to {Config.jansOptBinFolder}")
config_api_installer.copyFile(
os.path.join(self.flex_setup_dir, 'admin-ui'),
Config.jansOptBinFolder
)
config_api_installer.run([base.paths.cmd_chmod, '+x', os.path.join(Config.jansOptBinFolder, 'admin-ui')])

def install_config_api_plugin(self):

Expand Down

0 comments on commit 6df74ea

Please sign in to comment.