%PDF- %PDF-
Direktori : /lib/python3/dist-packages/sos/collector/clusters/__pycache__/ |
Current File : //lib/python3/dist-packages/sos/collector/clusters/__pycache__/ocp.cpython-312.pyc |
� i��d@? � �F � d dl Z d dlmZ d dlmZ d dlmZ G d� de� Zy)� N)�quote)�Cluster)� is_executablec � � � e Zd ZdZdZdZdZdZdZdZ dZ g d�Zed � � Z d � Zd� Z� fd�Zd � Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z� xZS )�ocpa� This profile is for use with OpenShift Container Platform (v4) clusters instead of the kubernetes profile. This profile will favor using the `oc` transport type, which means it will leverage a locally installed `oc` binary. This is also how node enumeration is done. To instead use SSH to connect to the nodes, use the '--transport=control_persist' option. Thus, a functional `oc` binary for the user executing sos collect is required. Functional meaning that the user can run `oc` commands with clusterAdmin privileges. If this requires the use of a secondary configuration file, specify that path with the 'kubeconfig' cluster option. This config file will also be used on a single master node to perform API collections if the `with-api` option is enabled (default disabled). If no `kubeconfig` option is given, but `with-api` is enabled, the cluster profile will attempt to use a well-known default kubeconfig file if it is available on the host. Alternatively, provide a clusterAdmin access token either via the 'token' cluster option or, preferably, the SOSOCPTOKEN environment variable. By default, this profile will enumerate only master nodes within the cluster, and this may be changed by overriding the 'role' cluster option. To collect from all nodes in the cluster regardless of role, use the form -c ocp.role=''. Filtering nodes by a label applied to that node is also possible via the label cluster option, though be aware that this is _combined_ with the role option mentioned above. To avoid redundant collections of OCP API information (e.g. 'oc get' commands), this profile will attempt to enable the API collections on only a single master node. If the none of the master nodes have a functional 'oc' binary available, *and* the --no-local option is used, that means that no API data will be collected. zOpenShift Container Platform v4)zopenshift-hyperkubezopenshift-clientsFNzsos-collect-tmp� ))�labelr z3Colon delimited list of labels to select nodes with)�role�masterz*Colon delimited list of roles to filter on)� kubeconfigr zPath to the kubeconfig file)�tokenr z1Service account token to use for oc authorization)�with-apiFz'Collect OCP API data from a master nodec �� � | j �sPd| _ | j j j � r�| j j d| j j j �� }|d dk( rdt j j | j j j |d j � j d� � | _ n(| j d� | j d |d z � | j d � r'| xj d| j d � z z c_ | j d| j z � | j S ) N�oczwhich oc)�chroot�statusr �output�/zHUnable to to determine PATH for 'oc' command, node enumeration may fail.zLocating 'oc' failed: %sr z --config %szoc base command set to %s)�_oc_cmd�primary�host�in_container�run_command�sysroot�os�path�join�strip�lstrip�log_warn� log_debug� get_option)�self�_oc_paths �</usr/lib/python3/dist-packages/sos/collector/clusters/ocp.py�oc_cmdz ocp.oc_cmdK s � ��|�|��D�L��|�|� � �-�-�/��<�<�3�3��t�|�|�'8�'8�'@�'@� 4� �� �H�%��*�#%�7�7�<�<����)�)�1�1� ��*�0�0�2�9�9�#�>�$�D�L� �M�M�5�� �N�N�#=�%-�h�%7�$8� 9����|�,���������1N� N�N���N�N�6����E�F��|�|�� c �$ � | j �d|��S )zcFormat the oc command to optionall include the kubeconfig file if one is specified � )r&