B
ed @ sP d Z ddlZddlZddlmZ ddddZdddd Zdd
ddd
ZdS )zl
This module contains an argparse command line parser
for cloudlinux-ssa-manager and cloudlinux-autotracing
N)is_cl_solo_editionzargparse.ArgumentParser)returnc C s: t jddd} | jdddd}|jdd t jd
}tdds|jdd
dd |jdddd |jdddd |jdddd |jdddd |jdddd |jdd d!d |jd"d#d$d |jd%d&d'd |jd(d)t jd
|jd*d+t jd
|jd,d-t jd
|jd.d/t jd
|jd0d1t jd
|jd2d3t jd
| S )4zh
Command line parser for SSA manager utility using built-in argparse module
:return: parser
zcloudlinux-ssa-managerzUtility to manage SSA)progdescriptionCommandscommandT)titledestrequiredz
set-configzSet SSA configuration)helpZargument_default)Zskip_jwt_checkz--domains-numberZDOMAINS_NUMBERz!Size of TOP list for slow domains)Zmetavarr z--request-numberZREQUEST_NUMBERz[The threshold value of slow requests number in the period of time to mark URL as a slow onez--timeZTIMEz:Period of time in hours required to analyze these requestsz
--correlationZCORRELATIONz%Flag to enable or disable correlationz--correlation-coefficientZCORRELATION_COEFFICIENTz.The threshold value of correlation coefficientz
--urls-numberZURLS_NUMBERzSize of TOP list for slow urlsz--requests-durationZREQUESTS_DURATIONz2The threshold value of request duration in secondsz
--ignore-listZIGNORE_LISTzGList of URLs or domains that should not be included in the daily reportz--summary-notification-enabledZSUMMARY_NOTIFICATIONz.Turn on|off sending the daily report by e-mailz
get-configzGet SSA configurationzget-ssa-statuszGet current status of SSAz
enable-ssaz
Enable SSAzdisable-ssazDisable SSAz
get-reportzGet the latest reportzget-statzGet the SSA statistics)argparseArgumentParseradd_subparsers
add_parserZSUPPRESSr add_argument)parser
subparsersZset_config_parser r M/opt/alt/python37/lib/python3.7/site-packages/ssa/cli_utils/cmdline_parser.pycmd_parser_manager sN
r c C s t jddd} | jdddd}|jdd d
}|jddd
dd |jddddd |jddd
}|jddd
dd |jddddd |jddd
}|jddd
dd |jddddd | S )z`
Command line parser for Autotracing using built-in argparse module
:return: parser
zcloudlinux-autotracingzUtility to manage Auto Tracing)r r r r T)r r r
ZenablezEnable Auto Tracing feature)r z--allZ
store_trueFzenable for all users)actiondefaultr user?Nzenable for a particular user)Znargsr r ZdisablezDisable Auto Tracing featurezdisable for all userszdisable for a particular userZstatusz"Get status of Auto Tracing featurez--list-disabledzlist disabled userszstatus of a particular user)r r
r r r )r r Ze_parserZd_parserZs_parserr r r cmd_parser_autotracing_utilB s.
r zargparse.Namespace)r r c
C sL y| }|S tk
rF } ztjddt|id W dd}~X Y nX dS )z}
Parse arguments with given parser
:param parser: an instance of ArgumentParser
:return: arguments Namespace
zInvalid utility invocationerr)ZextraN)Z
parse_args
SystemExitloggingerrorstr)r argser r r parse_cmd_argumentsd s r"