}CedZddlmZddlmZddlmZddlZddlmZddlm Z m Z ddl m Z d Z dd Zd Zed kr2ddlZe\ZZer eeerejedSdSdS)z5 CloudLinux control panel API command line interface )print_function)absolute_import)divisionN)cpapi)prepare_data_jsonprepare_attention_json)cpapiexceptionsc6tjd}|ddddd|d }|d }|d d |d}|dd|d}|ddd|dddd|dd}|dt dd|S)Nz>%(prog)s - CloudLinux control panel API command line interface) descriptionz-jz--json store_trueFzOutput in json format)actiondefaulthelpcommand)destdocrootdomainzReturn document root for domain)r userdomainsz>NS   M cFdfd|DS)N c:g|]}|Sjoin).0tuple_seps r( zflat_plain..0s%:::6chhv&&:::r*r0)datar4s `r( flat_plainr7/s* 99::::T::: ; ;;r*ct}|}d}d} |jdkr@tj|j\}}|jrt||d}n|dz|z}n|jdkrLtj|j}|jrd|D}t|}nt|}n|jdkrFtj |j |j }|jrt|}n`t|}nP|jdkrEtj |j} |jrt| }nd | }nT#t j$rB} |jrt%t'| }nd }d t'| z}Yd} ~ nd} ~ wwxYw||fS) Nrr)ruserr+rc0g|]}|d|ddS)r)rrr/)r2domain_docroots r(r5zmain..BsEDDD*$2!#4$21$577DDDr*rrr-r;zERROR: )r) parse_argsrrrrjsonrrr7r cplogin_lstwith_system_usersr'rr1r CPAPIExceptionrr!) r" namespaceoutput_ exit_coderr9domain_docroot_pairsr6 db_mappinguserse_s r(mainrI3s ^^F!!##IGI#*   ) ) =)9::LFD~ .+vt,L,LMM 3,-  - / /#(#4Y5J#K#K ~ ;DD.BDDD,D11$%9::  "9 9 94Y5J5>5PRRJ~ 1+J77$Z00  "2 2 2()?@@E~ ++E22))E**  )*** > *,SWW55GGI#b'')G * I sEE,,F=;8F88F=__main__)r+)__doc__ __future__rrrrclcommonrclcommon.cloutputrrclcommon.cpapir r)r7rI__name__sysrCrDprintexitr/r*r(rTs,&%%%%%&&&&&&GGGGGGGG******2<<<<)))X zJJJGY g  r*