3 ܓi @s,ddlZddlmZdZGdddeZdS)N)Clusterz9/var/lib/mistral/overcloud/tripleo-ansible-inventory.yamlc@s.eZdZdZdZdddgZd d Zd dZdS)rhospa This cluster profile is for use with Red Hat OpenStack Platform environments. Different types of nodes may be enumerated by toggling the various profile options such as Controllers and Compute nodes. By default, only Controller nodes are enumerated. Node enumeration is done by inspecting the ansible inventory file used for deployment of the environment. This is canonically located at /var/lib/mistral/overcloud/tripleo-ansible-inventory.yaml. Similarly, the presence of this file on the primary node is what triggers the automatic enablement of this profile. Special consideration should be taken for where `sos collect` is being run from, in that the hostnames of the enumerated nodes must be resolveable from that system - not just from the primary node from which those nodes are discovered. If this is not possible, consider enabling the `use-ip` cluster option to instead have this profile source the IP addresses of the nodes in question. zRed Hat OpenStack Platformuse-ipF0use IP addresses instead of hostnames to connect controllerT%collect reports from controller nodescompute"collect reports from compute nodescCs|jjtddS)NT)Z need_root)primaryZ file_exists INVENTORY)selfr /usr/lib/python3.6/openstack.py check_enabled0szrhosp.check_enabledcCsg}|jdrdnd}ytj|jjt}Wn<tk rh}z |jd|td|WYdd}~XnXyTxNd D]F}|j|jrrx2||dj D]}|j ||d||qWqrWWn8tk r}z|j d |d |WYdd}~XnX|S) Nzuse-ipZ external_ipZctlplane_hostnamezError parsing yaml: z'Could not parse yaml for node addresses ControllerComputeZhostszError getting z host addresses: )rr) Z get_optionyamlZ safe_loadr Z read_filer ExceptionZlog_infolowerkeysappendZ log_error)r Z_nodesZ _addr_fieldZ_inverrZ_thostr r r get_nodes3s  &(zrhosp.get_nodesN)rFr)rTr)rFr )__name__ __module__ __qualname____doc__Z cluster_nameZ option_listrrr r r rrsr)rZsos.collector.clustersrr rr r r r s