In the very first place, this might not be the happiest approach, waiting for corrections.
Let's suppose you have a triggered configuration change (as a reaction to an event). Requirements: the system to be configured as the triggered job dictates and the pillar to be updated.
I would firstly update the pillar data, then execute the state that manages the configuration.
But the pillar data can originate from various places, either external pillars, either even from the localfs where you may have multiple roots so you can't know for sure where to save the contents.
I am sure I'm not the first one having this need, I'd love to hear how people approached this use case.
Is there any generic way, or depends very much on the environment?
Thanks,
-Mircea