a >h@s@ddlZddlmZddlmZmZmZGdddeeeZdS)N) gethostname)Plugin RedHatPlugin UbuntuPluginc@s0eZdZdZdZdZdZdZddZdd Z d S) CephRGWzCEPH rgwZceph_rgw)ZstorageZvirt containerZ webserverZceph)zceph-(.*)?rgw.*)z/var/lib/ceph/radosgw/*z)/var/snap/microceph/common/data/radosgw/*c s|d}gd}|jjd}|rR|r6|dgn |dg|gdn0|sf|jddd n|jd dd |gd |rd nd t|fdd|D|dd}|ddkr>z:t |d}|d}|D]}|dd|qWn6t y<}z| d|WYd}~n d}~00|dd}|ddkrzUz!CephRGW.setup..r z zone liststatusroutputZzonesz zone get --rgw-zone=z'Error while getting get rgw zone list: z zonegroup list zonegroupsz zone get --rgw-zonegroup=z,Error while getting get rgw zonegroup list: ) Z get_optionZpolicyZpackage_managerZ pkg_by_nameZ add_copy_specZadd_forbidden_pathrZadd_cmd_outputZcollect_cmd_outputjsonloads ValueErrorZ _log_error) selfrZcmdsr resZ_outZ zone_listzoneerrrZzgroupr rrsetups`   z CephRGW.setupcCsd}|d|ddS)z& Obfuscate secondary zone access keys z!("access_key":|"secret_key":)\s.*z radosgw-adminz\1 "**********"N)Zdo_cmd_output_sub)rZrsubr r rpostprocrszCephRGW.postprocN) __name__ __module__ __qualname__Z short_descZ plugin_nameZprofilesZ containersfilesrrr r r rrsYr)rZsocketrZsos.report.pluginsrrrrr r r r s