3
ܓim' @ sj d dl Z d dlZd dlZd dlmZmZmZmZ G dd deZG dd deeZ G dd deeeZ
dS ) N)PluginRedHatPluginDebianPluginUbuntuPluginc @ s\ e Zd ZdZdZdZdZdZdZdZ dZ
dZdZdZ
dd Zg fd
dZdd
Zdd ZdS )
OVNCentralz
OVN NorthdZovn_centralnetworkvirtovn-dbs-bundle.*ovn_cluster_north_db_server c C s | j ||}| jr| jd| | jd}|d dks@d|d krT| jd| j n8tj|}x,|d jdD ]}|j|rn| j ||S qnW |S )Nzls ) containerstatusr
outputz=Could not retrieve ovn_controller socket path from container ) path_joincontainer_nameexec_cmd
_log_errorrecompilesplitmatch)selfpathZ
regex_nameZ_sfilerespatternfilename r !/usr/lib/python3.6/ovn_central.py
_find_sock% s
zOVNCentral._find_sockc s` | j rd| }| j|dd| j d}|d dkrF| jd| j dS ytj|d }W n$ tk
r| | jd | dS X ny\| j|}t|d
dd:}ytj|}W n$ tk
r | jd | dS X W dQ R X W n8 t k
r } z| jd
| d| dS d}~X nX y fddt
j|d D S tk
rZ | jd| d Y nX 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 | ]}| kr|qS r r ).0table)skipr r