HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/juju.cpython-310.pyc
o

([Qh" �@sBddlZddlZddlZddlmZmZmZGdd�dee�ZdS)�N)�Plugin�UbuntuPlugin�	PluginOptc	@sxeZdZdZdZdZdZdZedde	dd	�ed
de
dd	�ed
de
dd	�edde
dd	�gZdZdd�Z
dd�Zdd�ZdS)�Jujua3The Juju plugin is aimed at collecting Juju-related logs,
    configurations, and controller/model state(s).

    Logs and agent configuration information (/var/log/juju and /var/lib/juju)
    is collected by default since these are useful for troubleshooting.

    The Juju state collection is disabled by default and can be enabled with
    the 'juju-state' option. Collecting Juju state is safe in theory, but it
    does act on the live controller(s)/model(s) and is therefore optional.

    The default Juju state collection collects all controllers and models that
    the 'juju-user' (default=ubuntu) has access to.

    Specific controllers or models can be collected using the 'controllers'
    and 'models' options.

    Important: the string list is whitespace delimited, not colon delimited
    (sos plugin standard). This is due to the underlying Juju CLI accepting
    specific models in the format 'controller:model' and whitespaces are not
    allowed in either controller and model names.

    Example: models="controller_a:model_x controller_b:model_y"
    zJuju orchestration tool�juju)�virt�sysmgmt)�
/var/log/juju�
juju-stateFz Include Juju state in the report)�default�val_type�desc�	juju-user�ubuntuzJuju client user.�controllers�z[Collect Juju state for specified controllers. Uses a             whitespace delimited list.�modelszVCollect Juju state for specified models. Uses a whitespace             delimited list.c
CsH|�d�D]}|�|�|�|�qdddddddd	d
d�	}|�d�r6|��D]\}}|j|�|�|d
�q'|�d�|jddgdd�|�	d�r[|�gd��|�
d�|�
d�n|�d�|�	d�sgdS|�	d�}zt�|�Wnt
y�|�d|�d��YdSw|�	d�r�|�	d�r�|�d�dS|jd|d �}|d!d"kr�t|�	d��d#��}|r�|d$hkr�|}ntt�|d%�d���}ni}|�	d�r�|�	d��d#�D]}	d&|	�d'�}
|j|
|d �q�dS|D]7}|jd(|�d'�|d �}|d!d"k�r!t�|d%�d}
|
D]}	|	d)}d&|�d*|�d'�}
|j|
|d ��q	q�dS)+Nzjuju*�	depenginezdebug/pprof/goroutine?debug=1zdebug/pprof/heap?debug=1�metrics�pubsub�presence�	statepoolz&debug/pprof/juju/state/tracker?debug=1zunits?action=status)	�juju_engine_report�juju_goroutines�juju_heap_profile�juju_metrics�juju_pubsub_report�juju_presence_report�juju_statepool_report�juju_statetracker_report�juju_unit_status�/var/lib/juju/agents)�suggest_filenamez!/var/lib/juju/agents/*/agent.confz/var/log/juju*z/var/lib/juju*T)�	recursive�all_logs)r	z
/var/lib/jujuz/var/lib/juju/**/.*z/var/lib/juju/kvmz/var/lib/juju/toolsz/var/log/juju/*.logr
rzUser "z4" does not exist, will not collect Juju information.rrzWOptions: controllers, models are mutually exclusive. Will not collect Juju information.zjuju controllers --format=json)�runas�statusr� r�outputzjuju status -m z --format=jsonzjuju models --all -c z
short-name�:)�get_service_names�add_journal�add_service_status�path_exists�items�add_cmd_output�_juju_agent�
add_copy_spec�add_dir_listing�
get_option�add_forbidden_path�pwd�getpwnam�KeyError�	_log_warn�collect_cmd_output�set�split�json�loads�keys�exec_cmd)�self�service�juju_agent_cmds�cmd�	agent_cmd�	juju_user�controllers_json�desired_controllersr�model�command�
controller�models_jsonr�
short_name�rM�9/usr/lib/python3/dist-packages/sos/report/plugins/juju.py�setupRs�
�

�
��





�������
�
����z
Juju.setupcCsB|jdkr|�d�D]
}t�d|�r||_nq
d|j�d|��S)Nrr!z$machine-*|controller-*|application-*zjuju-introspect --agent=r')�
agent_name�listdir�re�search)r@rI�dir_namerMrMrNr0�s
�zJuju._juju_agentcCsHd}gd�}dd�|��d�}d}|�|||�|�|�|�d�dS)Nz/var/lib/juju/agents/*)�sharedsecret�apipassword�oldpassword�
statepasswordz(^\s*(�|z
)\s*:\s*)(.*)z\1*********zjuju controllers)�join�do_path_regex_sub�do_file_private_sub�do_cmd_private_sub)r@�agents_path�protect_keys�
keys_regex�	sub_regexrMrMrN�postproc�s
z
Juju.postprocN)�__name__�
__module__�__qualname__�__doc__�
short_desc�plugin_name�profiles�filesr�bool�str�option_listrPrOr0rbrMrMrMrNrsF�����u	r)r5r<rR�sos.report.pluginsrrrrrMrMrMrN�<module>s