salt icon indicating copy to clipboard operation
salt copied to clipboard

Method to access the requesting user from module/runner

Open jacksontj opened this issue 13 years ago • 7 comments

RIght now the only way to get the username of the requestor is to instantiate the client and do client.salt_user (which only works in the runner). I know that the requestor is passed around in the payload_kwargs. Can we make that accessible in some sort of payload dict or something?

jacksontj avatar Aug 08 '13 02:08 jacksontj

Not sure on this one. I'll get @thatch45 to comment. Thanks for the request.

basepi avatar Aug 08 '13 16:08 basepi

where would you like to see this? It is in the job cache and this data should be getting fired ont he event bus, where else should we be able to get it?

thatch45 avatar Aug 08 '13 19:08 thatch45

Within the module itself. If i want to log (or post to some other tracking service) i'd like access to the username from within a salt module while it is executing.

I'd like to be able to access it similar to __salt__ and __pillar__, maybe have __payload__ ? or something like that. The difference would be that it would have to be set per call to the module-- which shouldn't be terribly difficult.

jacksontj avatar Aug 08 '13 22:08 jacksontj

Looks like this is already available, just not documented

sudo salt hostname test.arg a b=1
[sudo] password for thjackso: 
hostname:
    ----------
    args:
        - a
    kwargs:
        ----------
        __pub_arg:
            - a
            - b=1
        __pub_fun:
            test.arg
        __pub_jid:
            20130827173034843233
        __pub_ret:

        __pub_tgt:
            hostname
        __pub_tgt_type:
            glob
        __pub_user:
            sudo_thjackso
        b:
            1

Where would be the correct place to document this?

jacksontj avatar Aug 27 '13 17:08 jacksontj

@jacobhammons @jacksontj I am closing this ticket due to inactivity. If anyone feels that this feature needs more attention feel free to reopen it.

arroyoc avatar Jan 14 '16 20:01 arroyoc

This still needs to be added to the docs, reopening.

jacobhammons avatar Jan 14 '16 20:01 jacobhammons

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] avatar Mar 11 '18 01:03 stale[bot]