eaiovnaovbqoebvqoeavibavo 3 f @sdZdZddlZddlZddlmZddlmZddlZdZ dZ ej e e dd Z e Z yeWnek rxeZYnXGd d d ZdS) zu This module houses the i18n setup and message function. The default is to use gettext to internationalize messages. z4.7.1N)ArgumentParser) SosListOptionz/usr/share/localesoscCs tjt|S)N)gettextdgettext gettext_app)msgr /usr/lib/python3.6/__init__.py_defaultsr c@s0eZdZdZddZddZddZdd Zd S) SoSaRMain entrypoint for sos from the command line Upon intialization, this class loads the basic option parser which will include the options shared by support components/subcommands. This is also where all subcommands present in the local installation are discovered, loaded, and if a matching one is found, intialized. c Cs||_ddl}ddl}ddl}|jjdgf|jjddgf|jj gfd|_ y ddl }|j j dgf|j d<Wnhtk r}zLddl}d|jkr|jjgf|j d<n d |jkr|jjgf|j d<nWYdd}~XnXd }xX|j D]N}|j |d }|jd|d j|}|j |dj}|d |d|d7}qWd} | |} d} t| | d|_|jjddt|jjdddd|_d|j_xt|j D]j} |jj| |j | d d| d} d| | _| jddt|j | |j | dj!| d| j"| dqW|jj#|j|_$|j%dS)NrZrepcleanermask)reportZcleanhelp collectorZcollectz sos.collectorZpexpectz,  z<30 z6%(prog)s [options] Available components: z1See `sos --help` for more information)usageepilogactionextend componentzsos component to run)destmetavarrTzsos %s)aliasesprogzsos %s [options])parser)r)&cmdlineZ sos.reportZ sos.cleanerZsos.helprZ SoSReportr Z SoSCleanerrZ SoSHelper _componentsZ sos.collectorrZ SoSCollectorModuleNotFoundErrorZ sos.missingrZmissingZMissingCollectZMissingPexpectinsertjoindescrrregisterrZadd_subparsersZ subparsersZrequiredZ add_parserr_add_common_optionsZadd_parser_optionsZ set_defaults parse_argsargs_init_component) selfr)rerrZ _com_stringZcomr_comr%Z usage_stringrcompZ_com_subparserr r r __init__5s^            z SoS.__init__c Cs|jd}|jddddd|jdtdd d d d |jd dddd|jddddddd|jddddddd|jdddddd|jdddd d!td"d#|jd$d%d&d'd(d)d|jd*d+d,d-d.d/gd0d1|j}|jd2ddd3d|jd4d5d6|jd7d8d6dS)9z@Adds the options shared across components to the parser zGlobal Optionsz--batchF store_truezDo not prompt interactively)defaultrrz --config-fileZstoreZ config_filez/etc/sos/sos.confz$specify alternate configuration file)typerrr1rz--debugdebugz6enable interactive debugging using the python debugger)rrrz-qz--quietquietzonly print fatal errors)rrr1rz-sz --sysrootZsysrootNz!system rootdir path (default='/')z --tmp-dirZtmp_dirz%specify alternate temporary directoryz-tz --threadsZthreadszNumber of threads to use)rrr1r2rz-vz --verbosecount verbosityrzincrease verbosityz-zz--compression-typeZcompression_typeautoZgzipZxzzcompression technology to use)rchoicesrz --encryptz_Encrypt the archive, either prompting for a password/key or referencing an environment variablez --encrypt-keyz(Encrypt the archive using a GPG key-pair)rz--encrypt-passz$Encrypt the archive using a password)Zadd_argument_group add_argumentstrintZadd_mutually_exclusive_group)r+rZ global_grpZ encrypt_grpr r r r'|sH         zSoS._add_common_optionscCs|jj}||jjkr"td|yB|j|d}|jrNtjdk rNtd||j |j|j |_ WnHtk r}z,td||f|jj r|t jdWYdd}~XnXdS)znDetermine which component has been requested by the user, and then initialize that component. z!Unknown subcommand '%s' specifiedrz*Component must be run with root privilegeszCould not initialize '%s': %srN)r)rr!keysprintZ root_requiredosgetuid Exceptionrr _componentr3sysexit)r+r-Z_to_loadr,r r r r*s zSoS._init_componentcCs|jjdS)N)rBexecute)r+r r r rEsz SoS.executeN)__name__ __module__ __qualname____doc__r/r'r*rEr r r r r ,s G/r )rI __version__r?rCargparserZ sos.optionsrrZ gettext_dirrbindtextdomainr Z_sosr" NameError ImportErrorr r r r r s