mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
Display correctly if service is PageKite is enabled
This commit is contained in:
parent
96a272b3b0
commit
aad69deb6e
@ -52,6 +52,9 @@ def parse_arguments():
|
||||
subparsers.add_parser('start-and-enable', help='Enable PageKite service')
|
||||
subparsers.add_parser('stop-and-disable', help='Disable PageKite service')
|
||||
subparsers.add_parser('restart', help='Restart PageKite service')
|
||||
subparsers.add_parser('is-disabled',
|
||||
help=('Wether PageKite is disabled in the file '
|
||||
'/etc/pagekite.d/10_accounts.rc'))
|
||||
|
||||
# Frontend
|
||||
subparsers.add_parser('get-frontend', help='Get pagekite frontend')
|
||||
@ -86,6 +89,13 @@ def subcommand_restart(_):
|
||||
print('restarted')
|
||||
|
||||
|
||||
def subcommand_is_disabled(_):
|
||||
if aug.match(PATHS['abort_not_configured']):
|
||||
print('true')
|
||||
else:
|
||||
print('false')
|
||||
|
||||
|
||||
def subcommand_start_and_enable(_):
|
||||
aug.remove(PATHS['abort_not_configured'])
|
||||
aug.save()
|
||||
|
||||
@ -91,8 +91,12 @@ def get_pagekite_config():
|
||||
status = {}
|
||||
|
||||
# PageKite service enabled/disabled
|
||||
# This assumes that if pagekite is running it's also enabled as a service
|
||||
status['enabled'] = action_utils.service_is_running('pagekite')
|
||||
# To enable PageKite two things are necessary:
|
||||
# 1) pagekite not being disabled in /etc/pagekite.d/10_account.rc
|
||||
# 2) the pagekite service running
|
||||
is_disabled = run(['is-disabled']).strip()=='true'
|
||||
service_running = action_utils.service_is_running('pagekite')
|
||||
status['enabled'] = service_running and not is_disabled
|
||||
|
||||
# PageKite kite details
|
||||
status.update(get_kite_details())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user