관리-도구
편집 파일: ovn_central.cpython-39.opt-1.pyc
a -�_g�% � @ sj d dl Z d dlZd dlZd dlmZmZmZmZ G dd� de�ZG dd� dee�Z G dd� deee�Z dS ) � N)�Plugin�RedHatPlugin�DebianPlugin�UbuntuPluginc @ s\ e Zd ZdZdZdZdZdZdZdZ dZ dZdZdZ dd� Zg fdd �Zd d� Zdd � ZdS )� OVNCentralz OVN NorthdZovn_central)�networkZvirt)zovn-dbs-bundle.*Zovn_cluster_north_db_server� c C s� | � ||�}| jr�| jd|� �| jd�}|d dks@d|d vrT| �d| j� �� n8t�|�}|d �d�D ]}|�|�rl| � ||� S ql|S )Nzls )� container�statusr � �outputz=Could not retrieve ovn_controller socket path from container )� path_join�container_name�exec_cmd� _log_error�re�compile�split�match)�self�pathZ regex_nameZ_sfile�res�pattern�filename� r �B/usr/lib/python3.9/site-packages/sos/report/plugins/ovn_central.py� _find_sock% s �� zOVNCentral._find_sockc s� | j r�d|� �}| j|dd| j d�}|d dkrF| �d| j � �� dS zt�|d �}W n$ ty| | �d |� �� Y dS 0 n�z~| �|�}t|d dd��R}zt�|�}W n2 ty� | �d |� �� Y W d � W dS 0 W d � n1 s�0 Y W n> t �y< } z$| �d |� d|� �� W Y d}~dS d}~0 0 z� fdd�t �|d �D �W S t�y� | �d|� d�� Y n0 dS )z Get tables from schema zcat NT)�timeout� foregroundr r r z1Could not retrieve DB schema file from container r zCannot parse JSON file �rzUTF-8)�encodingzCould not open DB schema file z: c s g | ]}|� vr|�qS r r ��.0�table��skipr r � <listcomp>S s �z5OVNCentral.get_tables_from_schema.<locals>.<listcomp>�tablesz DB schema z has no 'tables' key) r r r �json�loads� Exceptionr �open�load�IOError�dict�keys�AttributeError) r r r% �cmdr Z db_schema�fname�file�exr r$ r �get_tables_from_schema6 sF �� 8�� z!OVNCentral.get_tables_from_schemac s |r� fdd�|D �S dS )z Collect OVN database output c s g | ]}� � d |� ��qS )z list r r! ��ovn_cmdr r r&