Implement get-services-status in cli.py & Refactor
get-webpanel-services-status to use cli_api.get_services_status()
This commit is contained in:
22
core/cli.py
22
core/cli.py
@ -455,11 +455,25 @@ def get_web_panel_api_token():
|
||||
@cli.command('get-webpanel-services-status')
|
||||
def get_web_panel_services_status():
|
||||
try:
|
||||
if services_status := cli_api.get_webpanel_services_status():
|
||||
for service, status in services_status.items():
|
||||
click.echo(f"{service}.service: {'Active' if status else 'Inactive'}")
|
||||
if services_status := cli_api.get_services_status():
|
||||
webpanel_status = services_status.get('webpanel', False)
|
||||
caddy_status = services_status.get('caddy', False)
|
||||
print(f"webpanel.service: {'Active' if webpanel_status else 'Inactive'}")
|
||||
print(f"caddy.service: {'Active' if caddy_status else 'Inactive'}")
|
||||
else:
|
||||
click.echo('Error: WebPanel services status not available.')
|
||||
click.echo('Error: Services status not available.')
|
||||
except Exception as e:
|
||||
click.echo(f'{e}', err=True)
|
||||
|
||||
|
||||
@cli.command('get-services-status')
|
||||
def get_services_status():
|
||||
try:
|
||||
if services_status := cli_api.get_services_status():
|
||||
for service, status in services_status.items():
|
||||
click.echo(f"{service}: {'Active' if status else 'Inactive'}")
|
||||
else:
|
||||
click.echo('Error: Services status not available.')
|
||||
except Exception as e:
|
||||
click.echo(f'{e}', err=True)
|
||||
# endregion
|
||||
|
||||
Reference in New Issue
Block a user