/usr/lib/python3/dist-packages/sos/collector/transports/__pycache__
NameSizeModeActions
control_persist.cpython-310.pyc70450644editdlrm
juju.cpython-310.pyc31240644editdlrm
local.cpython-310.pyc18730644editdlrm
oc.cpython-310.pyc65060644editdlrm
saltstack.cpython-310.pyc56970644editdlrm
__init__.cpython-310.pyc148720644editdlrm
Edit: /usr/lib/python3/dist-packages/sos/collector/transports/__pycache__/oc.cpython-310.pyc (6506B)
o G%@i%@sLddlZddlZddlZddlmZddlmZmZmZGdddeZ dS)N)RemoteTransport) is_executablesos_get_command_outputSoSTimeoutErrorcseZdZdZdZdZddZeddZdd Z d d Z fd d Z  dfdd Z ddZ eddZddZddZZS) OCTransportaq This transport leverages the execution of commands via a locally available and configured ``oc`` binary for OCPv4 environments. The location of the oc binary MUST be in the $PATH used by the locally loaded SoS policy. Specifically this means that the binary cannot be in the running user's home directory, such as ~/.local/bin. OCPv4 clusters generally discourage the use of SSH, so this transport may be used to remove our use of SSH in favor of the environment provided method of connecting to nodes and executing commands via debug pods. The debug pod created will be a privileged pod that mounts the host's filesystem internally so that sos report collections reflect the host, and not the container in which it runs. This transport will execute within a temporary 'sos-collect-tmp' project created by the OCP cluster profile. The project will be removed at the end of execution. In the event of failures due to a misbehaving OCP API or oc binary, it is recommended to fallback to the control_persist transport by manually setting the --transport option. oczsos-collect-tmpcKstd|jd|fi|S)z\Format and run a command with `oc` in the project defined for our execution oc -n  )rproject)selfcmdkwargsr=/usr/lib/python3/dist-packages/sos/collector/transports/oc.pyrun_oc1s zOCTransport.run_occCs|d|j}|ddkS)Nz,wait --timeout=0s --for=condition=ready pod/statusrrpod_name)r uprrr connected:s  zOCTransport.connectedcCsdd|jddd|jdddd d d d d dd d d ddd d d dddd d gd|jjs5dn|jjdgdddgidddd ddddddddgddddddd g|jjradndd |jdddd!d"S)#zBased on our template for the debug container, add the node-specific items so that we can deploy one of these on each node we're collecting from Podv1.rz-sos-collector)name namespacezsystem-cluster-criticalhost/ Directory)pathtype)rhostPathrunz/runvarlogz/var/logz machine-idz/etc/machine-idFilezsos-collector-tmpz®istry.redhat.io/rhel8/support-toolsz /bin/bashHOSTz/host)rvalue)r mountPathT) privileged runAsUser) rimagecommandenv resources volumeMountssecurityContextstdin stdinOncettyAlways IfNotPresentNever)volumes containersimagePullPolicy restartPolicynodeName hostNetworkhostPIDhostIPC)kind apiVersionmetadatapriorityClassNamespec)addresssplitr optsr)force_pull_imager rrrget_node_pod_configAs +zOCTransport.get_node_pod_configc CsztdsdS|}|dd|_tj|jd\}|_t|ddd}t ||Wdn1s3wY| d |jd t d |j}|d d ks[d|jd|dvrl| d| d|ddS| d|jdz|j d|jddd}|d d ks| dWdSWdSty| dYdSty}z| d|WYd}~dSd}~ww)NrFr?r)dirwzutf-8)encodingz"Starting sos collector container ''z oc create -f rrzpod/z createdoutputz Unable to deploy sos collect podzDebug pod deployment failed: zPod 'z=' successfully deployed, waiting for pod to enter ready statezwait --for=condition=Ready pod/z --timeout=30s(timeoutz"Pod not available after 30 secondsz'Timeout while polling for pod readinessz)Error while waiting for pod to be ready: T)rrGrtempfilemkstemptmpdir pod_tmp_confopenjsondump log_debugr log_errorrr Exception)r passwordpodconffdcfileoutrerrrrr_connectsH     zOCTransport._connectcs0|drd|jd|jd|St|S)Nrr exec --request-timeout=0 z -- chroot /host ) startswithr rsuper_format_cmd_for_exec)r r  __class__rrrds   z OCTransport._format_cmd_for_execFNcs"|r|d7}tj||||ddS)N F) use_shell)rc run_command)r r rO need_rootr+rirerrrjs  zOCTransport.run_commandcCsXtj|jr t|j|d|j}d|dvr*|d|jd|dSdS)Nz delete pod deletedrLzCalling delete on pod 'z ' failed: FT)osrexistsrSunlinkrrrW)r removedrrr _disconnects  zOCTransport._disconnectcCsd|jd|jdS)Nrraz -- /bin/bash -c)r rrFrrr remote_execs zOCTransport.remote_execc CsV|jddd}d|dvrdnd}|jd|d |d |jd |d d }|d dkS)N cp --retriesTstderr unknown flagrL --retries=5cp r :rNrrrr fnamedestresultflagsr rrr_copy_file_to_remotes   z OCTransport._copy_file_to_remotec CsR|jddd}d|dvrdnd}|d|d |jd |d |}|d d kS) NrsTrtrvrLrwrxryr rzrrrr|rrr_retrieve_files$ zOCTransport._retrieve_file)rgFNF)__name__ __module__ __qualname____doc__rr rpropertyrrGr`rdrjrqrrrr __classcell__rrrerrs$ ` *  r) rUrPrmsos.collector.transportsr sos.utilitiesrrrrrrrrs