Submit
Path:
~
/
/
lib
/
python2.7
/
site-packages
/
redhat_support_tool
/
helpers
/
File Content:
confighelper.pyo
� ��Tc @ s� d Z d d l m Z m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d Z d Z e j d d e �Z e j Z e a e a e a d e f d � � YZ d e f d � � YZ d � Z d S( s� This module manages the configuration for redhat-support-tool. Configuration options are stored in $HOME/.rhhelp and this module will both create this configuration file and handle the prompting of the user for the data which will be stored therein. To get a configuration you should begin by calling: - confighelper.get_config_helper() This will return an instance of ConfigHelper which has getter methods for the important configuration options. i����( t izipt cycleNs% Keith Robertson <kroberts@redhat.com>s Rex White <rexwhite@redhat.com>s redhat-support-toolt fallbackt EmptyValueErrorc B s e Z d � Z RS( c C s t j | | � d S( N( t Exceptiont __init__( t selft msg( ( sL /usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR 2 s ( t __name__t __module__R ( ( ( sL /usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR 1 s t ConfigHelperc B s� e Z d Z d Z d Z e Z d Z d � Z d d d � Z d d d e e d � Z d d d � Z d d e d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d e d � Z d � Z e e d � Z e e d � Z RS( s /etc/redhat-support-tool.confs https://api.access.redhat.comt WARNINGs) /var/lib/redhat-support-tool/debugkernelsc C sn t j � | _ t j � | _ t j � | _ t j j d � } | rQ | | _ n t j j d � } | r� | j d d d | � n | j � | j � | j d d � s� | j d d d d d | j d t d t � n | j d d � s| j d d d d d | j d t d t � n t j j | j d d � � sjy t j | j d d � � Wqjt k rf} qjXn d S( Nt RHST_CONFIGt http_proxyt optiont proxy_urlt valuet urlt sectiont RHHelpt global_configt persistt debugt kern_debug_dir( t ConfigParsert SafeConfigParserR t local_configt private_configt ost environt gett GLOBAL_CONFIG_FILEt sett _load_global_configt _load_local_configt has_optiont DEFAULT_URLt Truet DEFAULT_DEBUGt patht existst makedirsR ( R t env_vart e( ( sL /usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR = s2 R c C ss y | j j | | � } WnS y | j j | | � } Wqo y | j j | | � } Wqk d } qk Xqo Xn X| S( sh Returns the string value of 'option' in the indicated section. If no section is specified 'RHHelp' is assumed If the specified option does not exist in the local config file, the value for that option from the global config file is returned. If the option does not exist in either config, return None. N( R R R R t None( R R R t result( ( sL /usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR h s c C s� | r | j } n! | t k r* | j } n | j } | j | � sR | j | � n | j | | | � | r� | r~ | j � q� | j � n d S( sA Sets specified 'option' in 'section' to 'value' N( R t FalseR R t has_sectiont add_sectionR t _save_global_configt _save_local_config( R R R R R R t config( ( sL /usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR � s c C sd t } | j j | | � r$ t } n<