Sindbad~EG File Manager
3
�f�? � @ s@ d dl Z d dlmZ d dlmZ d dlmZ G dd� de�ZdS )� N)�quote)�Cluster)�
is_executablec s� e Zd ZdZdZd4ZdZdZdZdZ dZ
d5d6d7d8d9d:gZedd� �Z
dd� Zdd� Z� fdd�Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zd.d/� Zd0d1� Zd2d3� Z� ZS );�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�openshift-hyperkube�openshift-clientsFNzsos-collect-tmp� �label�3Colon delimited list of labels to select nodes with�role�master�*Colon delimited list of roles to filter on�
kubeconfig�Path to the kubeconfig file�token�1Service account token to use for oc authorization�with-api�'Collect OCP API data from a master node�api-url�.Alternate API URL of an external control-planec C s� | j s�d| _ | jjj� r|| jjd| jjjd�}|d dkr`tjj| jjj|d j � j
d��| _ n| jd� | jd |d � | j
d
�r�| j d| j
d
�� �7 _ | jd| j � | 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 --kubeconfig zoc base command set to %s)�_oc_cmd�primary�hostZin_container�run_command�sysroot�os�path�join�strip�lstrip�log_warn� log_debug�
get_option)�selfZ_oc_path� r) �/usr/lib/python3.6/ocp.py�oc_cmdL s"