Sindbad~EG File Manager
3
�f� � @ sZ d dl Z d dlmZmZmZmZ G dd� de�ZG dd� deee�ZG dd� dee�ZdS ) � N)�Plugin�RedHatPlugin�DebianPlugin�UbuntuPluginc @ sN e Zd ZdZdZdZdZed Zddd d
ddd
ddddgZdd� Z dd� Z
dS )�OpenStackOctaviazOpenstack OctaviaZopenstack_octavia� openstack�openstack_controllerz/var/lib/config-dataz/puppet-generated/octaviaZamphoraZavailabilityzoneZavailabilityzoneprofileZflavorZ
flavorprofileZ
healthmonitorZl7policyZlistenerZpool�providerZquotac
C s� | j dddd| jd | jd | jd | jd g� | jd d
i� | jd� | j| jd � | j| jd � | jd�r�| j d
g� n| j dg� dd� d%D �}dd� d&D �}t|�o�t|� r�| jd�p�| jd� r�| j j
d� n�| jddd� xx| jD ]n}| jd| |d� d| }| j
|�}|d dkr�x8|d j� D ](}|j� d }| jd!||f |d� �q8W q�W d"}| j
|�}|d dk�r�x4|d j� D ]$}|j� d }| jd#| d$d� �q�W d S )'Nz*/etc/sysconfig/network-scripts/ifcfg-o-hm0z"/etc/logrotate.d/openstack-octaviaz/etc/octavia/*z/var/lib/octaviaz/octavia/etc/octaviaz/etc/octaviaz/etc/rsyslog.dz/etc/my.cnf.d/tripleo.cnfz.*/etc/octavia/octavia.confZoctavia_confz/etc/octavia/certs�all_logsz/var/log/octavia/*z/var/log/octavia/*.logc S s g | ]}|t jk�qS � )�os�environ)�.0�pr r �'/usr/lib/python3.6/openstack_octavia.py�
<listcomp>E s z*OpenStackOctavia.setup.<locals>.<listcomp>�OS_USERNAME�OS_PASSWORDc S s g | ]}|t jk�qS r )r r
)r r r r r r H s �OS_TENANT_NAME�OS_PROJECT_NAMEzpython2-octaviaclientzpython3-octaviaclientz�Not all environment variables set or octavia client package not installed.Source the environment file for the user intended to connect to the OpenStack environment and install octavia client package.zopenstack loadbalancer listZloadbalancer)Zsubdirzopenstack loadbalancer %s listz-openstack loadbalancer %s list -f value -c idZstatusr �outputz!openstack loadbalancer %s show %sz5openstack loadbalancer provider list -f value -c namez2openstack loadbalancer provider capability list %sZprovider_capability)r r )r r )�
add_copy_spec�var_config_data�var_puppet_genZ
add_file_tagsZadd_forbidden_path�
get_option�all�anyZis_installedZsoslogZwarningZadd_cmd_output� resourcesZexec_cmd�
splitlines�split)�selfZvars_allZvars_any�res�cmd�retZentr r r r �setup$ sb
zOpenStackOctavia.setupc C sF dddddddg}dd j |� }| jd
|d� | j| jd
|d� d S )NZca_private_key_passphraseZ
heartbeat_keyZpasswordZ
connectionZ
transport_urlZserver_certs_key_passphraseZmemcache_secret_keyz(^\s*(%s)\s*=\s*)(.*)�|z/etc/octavia/*z\1*********)�joinZdo_path_regex_subr )r Zprotect_keysZregexpr r r �postprocr s zOpenStackOctavia.postprocN)r r )�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesr r r r$ r'