but then we're not sure how to pass the output of the command into the email block to be sent out. The 'uid' is retrieved from a log file and we're trying to look up the user before sending the email. How can we achieve this?
How about using a translate filter to map the uid to a username? A ruby filter similar to what you have above should also work but it clearly less efficient.
I agree. I would prefer an integrated solution, if possible.
Could you please direct me to some materials that I could read on that or an example? Still relatively new to salt.
I need to call this from inside the email block by passing a UID to the command, then reading the output and including it in the email I'm about to send.
Could you please direct me to some materials that I could read on that or an example?
I'm sure the archives of these forums contain concrete examples.
Still relatively new to salt.
Salt?
I need to call this from inside the email block by passing a UID to the command, then reading the output and including it in the email I'm about to send.
The translate filter allows you to look up the uid and store the resulting username in another field. This field can then be referenced in your email output.
Magnus, in your reply, I'm thinking you're only referring to the conversion of the UID to a username, not the rest of my questions? This also looks like a static assignment that's possible via the translate functions not something where we can pass a UID variable to translate and it goes and looks up the user on the system.
We do not know what the UID will be and need to look that up dynamically. (I've edited and clarified the original ask above.)
If the mappings really can't be static you could, as I said, use a ruby filter that runs the command to dynamically make the mapping. If that isn't performant enough, perhaps you can run an external service and use a ruby filter to query that service via e.g. HTTP?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.