░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
lon105.truehost.cloud
LOCATION:
/opt/cloudlinux/venv/lib/python3.11/site-packages/clflags
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: cli.py
#!/opt/cloudlinux/venv/bin/python3 -bb # # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENSE.TXT """ Set of useful command line options to quickly get information about available flags, their status and path """ import argparse import json import shutil import sys from clflags.gather import ( list_flags_info ) from clflags.config import ( DEFAULT_FLAGS_STORAGE_PATH, DEFAULT_META_STORAGE_PATH, DEFAULT_OPT_OUT_STORAGE_PATH, DEFAULT_REMOTE_OFF_STORAGE_PATH, ) from prettytable import PrettyTable def list_flags(args): """ Lists information about all available flags on server. Supports both human-readable and json formats. E.g. +--------------------------------------------------------------------+ | Name | Description | Path | Enabled | +------------+----------------------+----------------------+---------+ | first-test | My first and super | /var/cloudlinux/flag | False | | | cool flag that I can | s/enabled- | | | | use everywhere | flags.d/first- | | | | | test.flag | | | super-test | My second and super | /var/cloudlinux/flag | False | | | cool flag that I can | s/enabled- | | | | use everywhere. Used | flags.d/super- | | | | in AccelerateWP and | test.flag | | | | Immunify teams. | | | +------------+----------------------+----------------------+---------+ """ flags = list_flags_info() results = [] for flag in flags: results.append({ 'name': flag.name, 'description': flag.description, 'path': flag.path, 'enabled': flag.enabled, }) if args.json: print(json.dumps(results, indent=2)) return else: if not results: print('No flags available on this server') return t = PrettyTable( [i.capitalize() for i in results[0]], align='l', # Falls back to a fixed width when there is no terminal to measure: # piped, run from cron, or over ssh without a tty. max_table_width=shutil.get_terminal_size(fallback=(120, 24)).columns - 10, max_width=60 ) t.add_rows([ list(value.values()) for value in results ]) print(t) def system_info(args): """ Useful information about system itself: - data paths for flags and metadata """ results = { 'Flags default path': DEFAULT_FLAGS_STORAGE_PATH, 'Flags metadata path': DEFAULT_META_STORAGE_PATH, 'Opt-out path': DEFAULT_OPT_OUT_STORAGE_PATH, 'Remote-off path': DEFAULT_REMOTE_OFF_STORAGE_PATH, } t = PrettyTable( ['Name', 'Value'], align='l', title='Generic system information', max_width=80) t.add_rows(list(results.items())) print(t) if __name__ == '__main__': parser = argparse.ArgumentParser() subparsers = parser.add_subparsers( title='Actions with flags', description='Available manipulations that you can do with flags.', dest='action') info_subparser = subparsers.add_parser( 'info', help='Prints useful information about the system.') list_subparser = subparsers.add_parser( 'list', help='List all available flags on this server, ' 'their paths and current reported status.') list_subparser.add_argument( '--json', action='store_true', default=False, help='Return response in json format') args = parser.parse_args() if args.action == 'info': system_info(args) elif args.action == 'list': list_flags(args) else: parser.print_help() sys.exit(1)
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📁 __pycache__/
DIR
—
2026-10-14 22:54
📄 __init__.py
PY
372 B
2026-09-29 09:51
EDIT
📄 cli.py
PY
4 KB
2026-09-29 09:51
EDIT
📄 config.py
PY
1.7 KB
2026-09-29 09:51
EDIT
📄 gather.py
PY
6.2 KB
2026-09-29 09:51
EDIT
📄 Readme.md
MD
52 B
2026-09-29 09:51
EDIT