%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib/python2.7/site-packages/clselector/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pyc

�
i�B^c@`s�ddlmZddlmZddlmZddlZddlZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
dd	lmZd
ZdZdZd
Zd�Zd�Zeed�ZdS(i(tabsolute_import(tprint_function(tdivisionN(tdocopt(t
DocoptExit(tSchematAndtUsetOrtSchemaErrori(tCloudlinuxSelectorLibtnodejstpythontrubytphpcC`s	|rAt|d|d|d|dg�rAtdd��n|tkrrt|dg�rrtdd��n|tkr�t|dg�r�tdd	��n|ttfkr.t|d|d|d
|d|d|d|d|d
|d|d|d|d|dg
�r.tdd��n|tkrZ|drZtddt��n|r�t|d|d|dg�r�tdd��n|tkr�t|dg�r�tdd��n|ttfkr|dr|rt�rtdd��ndS(s�
    Do some additional checks to restrict commands not available for current
    user or interpreter or whatever and do this only after args parsing
    sinstall-versionsuninstall-versionsenable-versionsdisable-versions2This command should be run from administrator onlyschange-version-multiples)This command is supported only for NodeJSsuninstall-moduless)This command is supported only for Pythontcreatesread-configssave-configtstarttrestarttstoptdestroysinstall-moduless
run-scripts4This command is supported only for NodeJS and Pythonsmake-defaults-configs%This command is supported only for %ss--selector-statuss--default-versions--supported-versionss!Specified option(s) only for roots
--entry-pointsThis options(s) only for PythontgetsSelector is disabledN(tanyR	tNonetNODEJStPYTHONtPHPt_run_from_admin(tinterpretertargstas_from_roottselector_status((sQ/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pyt_ensure_command_allowedsP

.cC`sNy5tjtjjdttj����jdkSWntk
rItSXdS(s�
    Check who is owner of the parent process.
    if owner is root - return True
    if parent process can't be found - return True
    :return:
    s/proc/iN(	toststattpathtjointstrtgetppidtst_uidtOSErrortTrue(((sQ/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pyRWs5
c`sd}dj|�}yt||��Wn5tk
r_d}|sU|d|7}nt|fSX�jd���fd�}tdNttd��ttt	|��dd	�}d
�}d}	t
i9td6td
6td6td6td6td6td6td6td6td6td6td6td6td6td6td6td6td6td6td6tdNt�d 6td!6td"6td#6tdNt
ttt�d6td$6td%6td&6td'6tdNttt	|��d|	d(�d(6|d)6|d*6tdNttd+��dd,�d-6|d.6tdNttt	|��d|	d/�d/6tdNttt	|��d|	d0�d06tdNt�d16tdNt�d26tdNt�d36tdNt�d46tdNt�d56tdNt�d66tdNt�d76tdNttd8��dd9�d:6tdNt�d;6tdNt�d<6tdNt�d=6tdNt�d>6tdNt�d?6tdNt�d@6tdNt�dA6tdNt�dB6tdNt�dC6tdNt�dD6tdNttdE��ddF�dG6tdH6tdNt�dI6�}
���fdJ�}y|
j���Wn tk
r}tt|�fSX�d"r:�dr:tdKfS�dNksU�t
fkrht
�d<t}
n`�tfkr�dL}t|fS�ttfkr�t�d�}t|j�j��dM}
ny!t���|
�|��Wn tk
r}tt|�fSXt�fS(Os
    Parse arguments for cloudlinux-selector command
    :param argv: sys.argv
    :param _is_json_need: sys.argv contains --json key
    :param as_from_root: True if we assume that root has called this util
    :return cortege: (error_flag, s_message)
    scloudlinux-selectorsSUtility to get/set Cloudlinux selector options

Usage:
   {0} [get] [--json] [--interpreter <str>] [(--get-supported-versions | --get-default-version | --get-selector-status)] [(--user <str> | --domain <str>)]
   {0} set [--json] [--interpreter <str>] (--selector-status <enabled,disabled> | --default-version <str> | --supported-versions <str> | --current-version <str>) [--user <str>]
   {0} set [--json] [--interpreter <str>] --version <str> (--extensions <str> | --options <str>) [--user <str>]
   {0} set [--json] [--interpreter <str>]  [(--user <str> | --domain <str>)] --app-root <str> [--app-mode <str>] [--new-app-root <str>] [--new-domain <str>] [--new-app-uri <str>] [--new-version <str>] [--startup-file <str>] [--env-vars <str>] [--skip-web-check] [--entry-point <str>] [--config-files <str>] [--passenger-log-file <str>]
   {0} create [--json] [--interpreter <str>] [(--user <str> | --domain <str>)] --app-root <str> --app-uri <str> [--version <str>] [--app-mode <str>] [--startup-file <str>] [--entry-point <str>] [--env-vars <str>] [--passenger-log-file <str>]
   {0} set [--json] [--interpreter <str>]  --reset-extensions --version <str> [--user <str>]
   {0} (enable-version | disable-version) [--json] [--interpreter <str>] --version <str>
   {0} install-modules [--json] [--interpreter <str>] [(--user <str> | --domain <str>)] --app-root <str> [(--requirements-file <str> | --modules <str>)] [--skip-web-check]
   {0} uninstall-modules [--json] [--interpreter <str>] [(--user <str> | --domain <str>)] --app-root <str> --modules <str>
   {0} install-version [--json] [--interpreter <str>] --version <str>
   {0} uninstall-version [--json] [--interpreter <str>] --version <str>
   {0} read-config [--json] [--interpreter <str>]  [(--user <str> | --domain <str>)] --app-root <str> --config-file <str>
   {0} save-config [--json] [--interpreter <str>]  [(--user <str> | --domain <str>)] --app-root <str> --config-file <str> --content <str>
   {0} (start | restart | stop | destroy) [--json] [--interpreter <str>]  [(--user <str> | --domain <str>)] --app-root <str>
   {0} run-script [--json] [--interpreter <str>] [(--user <str> | --domain <str>)] --app-root <str> --script-name <str>
   {0} run-script [--json] [--interpreter <str>] [(--user <str> | --domain <str>)] --app-root <str> --script-name <str> -- <script_args>...
   {0} change-version-multiple --json --interpreter <str> --from-version <str> --new-version <str>
   {0} make-defaults-config [--json] [--interpreter <str>]
   {0} import-applications [--json] --interpreter <str>
   {0} migrate [--json] --interpreter <str> --user <str> --app-root <str>
   {0} (-h | --help)

Options:
    --json                               Return data in JSON format.
    --interpreter <str>                  One of php/nodejs/python, default is php
    --get-supported-versions             Return info about supported versions
    --get-default-version                Return info about default version only
    --get-selector-status                Return info about selector status
    --reset-extensions                   Replace user extensions with version default extensions
    --supported-versions <str>           Set supported versions of interpreter
    --default-version <str>              Set default version of interpreter
    --current-version <str>              Set alternative as user default
    --selector-status <enabled|disabled> Set selector status enabled or disabled
    --version <str>                      Version of interpreter
    --extensions <str>                   JSON dict with extensions and their status
    --options <str>                      JSON dict with options and their values
    --user <str>                         Username to operate on
    --app-root <str>                     Root of an application to be created
    --domain <str>                       Domain to work in
    --app-uri <str>                      URI path to get the application being created
    --config-file <str>                  path to config file to be read or saved
    --config-files <str>                 names of config files (such as requirements.txt or etc) (only for python interpreter)
    --content <str>                      Base64-encoded config file contents to be saved
    --app-mode <str>                     Application mode
    --startup-file <str>                 Startup application file
    --env-vars <str>                     Environment variable as json string
    --new-app-root <str>                 Set new application directory
    --new-app-uri <str>                  Set new application uri
    --new-domain <str>                   Set new domain for application
    --new-version <str>                  Set new nodejs version for application
    --from-version <str>                 Old NodeJS version for group change version operations
    --script-name <str>                  Command for an npm script to be run
    --skip-web-check                     Skip check web application after change it's properties
    --entry-point <str>                  Use the specified entrypoint for application (only for python interpeter)
    --requirements-file <str>            Use the specified file for install required modules
    --modules <str>                      Install comma-separated list of modules
    --passenger-log-file <str>            Set passenger log full filename
    -h, --help                           Show this help message and exit
sERROR: Invalid parameter passeds

s
--interpreterc`sz|jd�}�tkr/tt|d��S�tkrp|}t|�dkrl|jdd�d}n|St|�S(sAFor the NodeJS, ignore all the version parts except the major onet.iii(tsplitRR$tintRtlentrsplittfloat(txtpartstver(R(sQ/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pyt_convert_version�scS`s
|dkS(Ntnative((R/((sQ/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pyt<lambda>�tterrors4Version must be Interpreter version number or nativecS`s#tj|�}t|j��|S(N(tjsontloadstlisttkeys(ts_jsontj_dict((sQ/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pyt_json_string_to_dict�ss%%s option should contain a valid JSONRtsetsimport-applicationstmigrateRsread-configsenable-versionsdisable-versionssave-configsinstall-modulessuninstall-modulesRRRRsinstall-versionsuninstall-versions
run-scriptschange-version-multiplesmake-defaults-configs
<script_args>s--s--jsons--helps--get-supported-versionss--get-default-versions--get-selector-statuss--reset-extensionss--supported-versionss--default-versions--current-versioncS`s
|dkS(Ntenabledtdisabled(R@RA((R/((sQ/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pyR4�R5s+Selector status must be enabled or disableds--selector-statuss	--versions--extensionss	--optionss--users
--app-roots--domains	--app-uris
--config-files	--contents
--app-modecS`s
|dkS(Nspackage.json((R/((sQ/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pyR4�R5s)Cannot set "package.json" as startup files--startup-files
--env-varss--config-filess--new-app-roots
--new-app-uris--new-domains
--new-versions--from-versions
--script-names
--entry-points--requirements-filecS`s
t|�S(N(tbool(R/((sQ/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pyR4
R5s4modules should be a comma-separated list of packagess	--moduless--skip-web-checks--passenger-log-filec`s(�ttfkrdS�r�t|d|d|d|d|d|d|d|d	|d
|df
�r�|dp|d
r�tdd��n�dtkr��dr��dr�tdd��n�dr��dtkr�tdd��n�dr$�dtkr$tdd��ndS(s�
        Check args for existing of mandatory arguments
        :param _args: parsed arguments from command line
        :return: True if checking passed, False - not passed
        NRsread-configssave-configsinstall-modulessuninstall-modulesRRRRs
run-scripts--users--domainsFDomain or user argument is mandatory while calling selector under roots
--interpreters
--entry-points--startup-filesM--entry-point option is requires --startup-file option for interpreter pythons
--app-modes9--app-mode option is requires only for interpreter nodejss<--entry-point option is requires only for interpreter python(RRRR	R(t_args(RRR(sQ/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pyt_check_users_part_clis*	%s4use --json option, other modes currently unsupporteds?ruby interpreter currently unsupported. Use selectorctl insteadiN(tformatRRtFalseRRRRR$RRRBR9RRtRUBYRtvalidateR	R
tget_selector_statustvaluesRR((targvt
_is_json_needRt	prog_namet	docstringts_error_stringR2t_version_validatorR=ts_json_errortsRDteRtmsgtlib((RRRsQ/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pytparse_cloudlinux_selector_optsds�
>
*		




	
(t
__future__RRRR7R RRtschemaRRRRR	tselectorlibR
RRRGRRRRFR(RV(((sQ/opt/alt/python27/lib/python2.7/site-packages/clselector/cl_selector_arg_parse.pyt<module>s (	<	


Zerion Mini Shell 1.0