a )g @spddlmZmZmZeZdZddlZddlm Z ddl m Z m Z ddl mZddlmZmZGdd d eZdS) )absolute_importdivisionprint_functionaB name: tree type: notification requirements: - invoked in the command line short_description: Save host events to files version_added: "2.0" options: directory: version_added: '2.11' description: directory that will contain the per host JSON files. Also set by the C(--tree) option when using adhoc. ini: - section: callback_tree key: directory env: - name: ANSIBLE_CALLBACK_TREE_DIR default: "~/.ansible/tree" type: path description: - "This callback is used by the Ansible (adhoc) command line option C(-t|--tree)." - This produces a JSON dump of events in a directory, a file for each host, the directory used MUST be passed as a command line option. N)TREE_DIR)to_bytesto_text) CallbackBase) makedirs_safe unfrackpathcs\eZdZdZdZdZdZdZdfdd Zd d Z d d Z d dZ dddZ ddZ ZS)CallbackModulez] This callback puts results into a host specific file in a directory in json format. g@Z aggregatetreeTNcs6tt|j|||dtr&tt|_n |d|_dS)z override to set self.tree ) task_keys var_optionsdirectZ directoryN)superr set_optionsrr r Z get_option)selfr rr __class__A/usr/lib/python3.9/site-packages/ansible/plugins/callback/tree.pyr1s zCallbackModule.set_optionsc Cst|}zt|jWnFttfy\}z*|jdt|jt|fWYd}~n d}~00zLttj |j|}t |d}| |Wdn1s0YWn@ttfy}z$|jd|t|fWYd}~n d}~00dS)z' write something into treedir/hostname zs