ConfD User Community

User info from yang file to shell executable


#1

Hi,
I am looking for a way to get logged user in shell script. But, could not find any solution yet. I can get context, if request is from cli or “REST”. It can be done by passing tailf:args to executable.
As given in user guide:
tailf:exec “./ping.pl” {
tailf:args “-c $(context) -p $(path)”;
}

So, it means context and path can be passed to executable. How to know what other parameters are available? I need to know user information. Thanks in advance.


#2

ConfD user guide mentions $(user) is allowed for clispec callback (/clispec/$MODE/show/callback/exec/args). Did you try to use $(user) in tailf:args? If it does not work, you can clispec callback for CLI.


#3

The variables that can be used with tailf:args are documented in the tailf_yang_extensions(5) manual page (which is actually generated from the tailf-common.yang module that defines the extensions, i.e. you can find the same text there). $(user) is the first one of the listed variables.


#4

Thanks. tailf:args with -u $(user) gives the logged user in executable file.