File: //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/ovn_central.cpython-310.pyc
o
���b� � @ sf d dl mZmZmZmZmZ d dlZd dlZG dd� de�ZG dd� dee�Z G dd� deee�Z
dS ) � )�Plugin�RedHatPlugin�DebianPlugin�UbuntuPlugin�SoSPredicateNc @ s8 e Zd ZdZdZdZdZg fdd�Zdd� Zd d
� Z dS )�
OVNCentralz
OVN Northd�ovn_central)�network�virt)zovn-dbs-bundle.*c
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�
foreground� container�statusr z3Could not retrieve DB schema file from container %s�outputzCannot parse JSON file %s�rz$Could not open DB schema file %s: %sc s g | ]}|� vr|�qS � r )�.0�table��skipr �@/usr/lib/python3/dist-packages/sos/report/plugins/ovn_central.py�
<listcomp>9 s
�z5OVNCentral.get_tables_from_schema.<locals>.<listcomp>�tablesz DB schema %s has no 'tables' key)
�_container_name�exec_cmd�
_log_error�json�loads� Exception�open� path_join�load�IOError�dict�keys�AttributeError)�self�filenamer �cmd�res�db�f�exr r r �get_tables_from_schema sX
��������
���
��z!OVNCentral.get_tables_from_schemac C s( |sd S |D ]}|� d||f � qd S )Nz
%s list %s)�append)r&