File: //lib/python3/dist-packages/sos/report/plugins/__pycache__/sunbeam.cpython-312.pyc
�
([Qh� � �H � d dl Z d dlZd dlZd dlmZmZmZ G d� dee� Zy)� N)�Plugin�UbuntuPlugin� PluginOptc �b � e Zd ZdZdZdZdZdZ edde d� � ed
de
d� � gZd
� Zd� Z
d� Zy)�SunbeamzSunbeam Openstack Controller�sunbeam)�cloud)� openstackz/var/snap/openstack/common�sunbeam-user�ubuntuz&The user used for sunbeam installation)�default�val_type�desc�juju-allow-loginFzAllow sos to login to jujuc � � | j d� | j | j � d�| j � d�| j � d�| j � d�| j � d�dg� | j d� } t j
|� }|�r�| j g d�d|�
� | j d|�� }|d dk( r9t j |d � }|D ] }| j d|d � �d|�
� � | j d|�� }|d dk( rEt j |d � }|d D ]% }| j d|d � �d|d � d�gd|�
� �' |j � d�} | j | � d�| � d�| � d�| � d�| � d�g� | j d � r| j d!|� d"�� | j d#|�� }
| j d$|d%�&� }d'}|
d dk( s|d dk( rH |
d j � d }
|d j � d }d(|
v sd(|v r| j |� d}|s| j d)� y y y # t $ r | j d |� d
�� Y y w xY w# t $ r Y �Ew xY w)*Nzsnap.openstack.*z
/hooks.logz/state/daemon.yaml�#/state/truststore/sunbeam.maas.yamlz/state/database/info.yamlz/state/database/cluster.yamlz'/var/snap/openstack/current/config.yamlr zUser "z�" does not exist, will not collect juju information. Use `-k sunbeam.sunbeam-user` option to define the user to use to collect data for sunbeam)zsunbeam cluster listz"sunbeam cluster list --format yamlzsunbeam manifest listzsunbeam deployment listT)�snap_cmd�runasz#sunbeam manifest list --format yaml�r �statusr �outputzsunbeam manifest show �
manifestidz%sunbeam deployment list --format yaml�deploymentszsunbeam deployment show �namez --format yamlz/snap/openstack/commonz/*.logz
/etc/**/*.logz/etc/**/terraform.tfvars.jsonz/logs/*.logz/reports/*.yamlr zsu - z -c "sunbeam utils juju-login"zjuju whoamizjuju status� )r �timeoutF�
Controllerz�juju is not logged in, will not collect juju information. Use `-k sunbeam.juju-allow-login=True` to login or use `juju login` as the sunbeam user to login)�add_service_status�
add_copy_spec�
common_dir�
get_option�pwd�getpwnam�KeyError� _log_warn�add_cmd_output�collect_cmd_output�yaml� safe_load�pw_dir�exec_cmd�
splitlines�_get_juju_cmd_details�
IndexError)�self�sunbeam_user�user_pwd�manifest_raw� manifests�manifest�deployment_rawr �
deployment�sb_snap_homedir�juju_whoami�juju_status� logged_in�j_whoami�j_statuss �</usr/lib/python3/dist-packages/sos/report/plugins/sunbeam.py�setupz
Sunbeam.setup"