File: //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/ovn_central.cpython-310.pyc
o
i��d� � @ sj d dl mZmZmZmZ d dlZd dlZd dlZG dd� de�ZG dd� dee�Z G dd� deee�Z
dS ) � )�Plugin�RedHatPlugin�DebianPlugin�UbuntuPluginNc @ s@ e Zd ZdZdZdZdZdd� Zg fdd�Zd d
� Z dd� Z
d
S )�
OVNCentralz
OVN Northd�ovn_central)�network�virt)zovn-dbs-bundle.*�ovn_cluster_north_db_serverc C s� t j�||�}| jrG| jd| | jd�}|d dks d|d vr*| �d| j � |S t�|�}|d �d�D ]}|� |�rFt j�||� S q6|S )Nzls %s)� container�statusr �
�outputz?Could not retrieve ovn_controller socket path from container %s)
�os�path�join�_container_name�exec_cmd�
_log_error�re�compile�split�match)�selfr �
regex_name�_sfile�res�pattern�filename� r �@/usr/lib/python3/dist-packages/sos/report/plugins/ovn_central.py�
_find_sock s ��
�
�zOVNCentral._find_sockc
sh | j r<d| }| j|d d| j d�}|d dkr!| �d| j � d S z t�|d �}W nh ty; | �d| � Y d S w z:t| �|�d ��(}zt�|�}W n tye | �d| � Y W d � W d S w W d � n1 spw Y W n t y� } z| �d
||f � W Y d }~d S d }~ww z� fdd�t
�|d
�D �W S ty� | �d| � Y d S w )Nzcat %sT)�timeout�
foregroundr r r z3Could not retrieve DB schema file from container %sr zCannot parse JSON file %s�rz$Could not open DB schema file %s: %sc s g | ]}|� vr|�qS r r )�.0�table��skipr r �
<listcomp>J s �z5OVNCentral.get_tables_from_schema.<locals>.<listcomp>�tablesz DB schema %s has no 'tables' key)
r r r �json�loads� Exception�open� path_join�load�IOError�dict�keys�AttributeError)r r r( �cmdr �db�f�exr r'