Each time a new pcmk__output_t object is created, it sets the OCF_OUTPUT_FORMAT environment variable. This is problematic for at least two reasons:
- The environment variable is set based on the most recently created output object. So for example, if we had a log object and a text object, the order in which they're created determines the value of the environment variable.
- This approach doesn't seem to align with the intent of OCF_OUTPUT_FORMAT. The environment variable is supposed to tell an OCF resource agent which format to use for any output that it generates. But a resource agent isn't coupled to any pcmk__output_t object that may (or may not exist). So IMO it doesn't make sense to set the variable based on a pcmk__output_t object.
Also note that no ClusterLabs-provided resource agents actually check OCF_OUTPUT_FORMAT yet.
Ref:
- https://github.com/ClusterLabs/OCF-spec/blob/main/ra/1.1/resource-agent-api.md
- RFE: support resource agent XML output for validate-all action in crm_resource --validate (https://bugzilla.redhat.com/show_bug.cgi?id=1644628)