Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/boto/pyami/__pycache__/ |
Upload File : |
o ckF[�! � @ s� d dl Z d dlZd dlZd dlZd dlmZmZmZmZm Z dZ e gZe j� ed�d�Ze�e� de jv r?ee jd �gZnde jv rYg Ze jd �e j�D ] Ze�ee�� qOG dd � d e�ZdS ) � N)� expanduser�ConfigParser� NoOptionError�NoSectionError�StringIOz /etc/boto.cfg�~z.boto�BOTO_CONFIG� BOTO_PATHc @ s� e Zd Zd2dd�Zdd� Zdd� Zd d � Zdd� Zd d� Zdd� Z dd� Z dd� Zd3dd�Zd3dd�Z d4dd�Zd3dd�Zd3dd�Zd4d d!�Zd5d#d$�Zd6d&d'�Zd(d)� Zd*d+� Zd3d,d-�Zd.d/� Zd0d1� ZdS )7�ConfigNTc C s� t ddd��| _|rE|r| �|� n |r| �|� n| �t� dtjv rGttjd �}z| � |� W d S t yD t�d| � Y d S w d S d S )Nz /mnt/pyami�0)�working_dir�debug�AWS_CREDENTIAL_FILEz'Unable to load AWS_CREDENTIAL_FILE (%s)) r �_parser�load_from_path�readfp�read�BotoConfigLocations�os�environr �load_credential_file�IOError�warnings�warn)�self�path�fp�do_load� full_path� r �3/usr/lib/python3/dist-packages/boto/pyami/config.py�__init__6 s$ � ��zConfig.__init__c C s |d | _ d S )Nr )r )r �stater r r �__setstate__G s zConfig.__setstate__c C s t | j|�S �N)�getattrr )r �namer r r �__getattr__P s zConfig.__getattr__c O s | j j|i |��S r$ )r � has_option)r �args�kwargsr r r r( S s zConfig.has_optionc C sV t � }|�d� t|d��� D ]}|�|�dd��dd�� q|�d� | �|� dS ) z:Load a credential file as is setup like the Java utilitiesz[Credentials] �r�AWSAccessKeyId�aws_access_key_id�AWSSecretKey�aws_secret_access_keyr N)r �write�open� readlines�replace�seekr )r r �c_data�liner r r r V s zConfig.load_credential_filec C sb t |�}|�� D ]!}t�d|�}|r)|�d�}tj�|�\}}| �tj� ||�� q| � |� d S )Nz^#import[\s ]*([^\s^ ]*)[\s ]*$� )r1 r2 �re�match�groupr r �splitr �joinr )r r �filer6 r9 � extended_file�dirr r r r _ s �zConfig.load_from_pathc C st t � }|�|� |�|�s|�|� |�|||� t|d�}|�|� |�� | �|�s1| �|� | �|||� dS )z� Write the specified Section.Option to the config file specified by path. Replace any previous value. If the path doesn't exist, create it. Also add the option the the in-memory config. �wN)r r �has_section�add_section�setr1 r0 �close)r r �section�option�value�configr r r r �save_optioni s zConfig.save_optionc C � | � t|||� d S r$ )rI �UserConfigPath�r rE rF rG r r r �save_user_option{ � zConfig.save_user_optionc C rJ r$ )rI �BotoConfigPathrL r r r �save_system_option~ rN zConfig.save_system_optionc C �0 z | � d|�}W |S ttfy |}Y |S w )N�Instance��getr r �r r&