Who is the current user


#1

Hi,

Is there a way to know from within a recipe the name of the user running the recipe?

Cheers,
Florian

LEGAL DISCLAIMER
This communication and any attached documents are strictly confidential and/or legally privileged and they may not be used or disclosed by someone who is not a named recipient. If you have received this electronic communication in error please notify the sender by replying to this electronic communication inserting the word “misdirected” as the subject and delete this communication from your system.


#2

ENV['USER’] # works on *NIX
ENV['USERNAME’] # works on Windows.

This should work on all platforms:

require 'etc’
Etc.getlogin

On 8-mei-2014, at 09:57, Florian Hehlen Florian.Hehlen@mri-group.com wrote:

Hi,

Is there a way to know from within a recipe the name of the user running the recipe?

Cheers,
Florian

LEGAL DISCLAIMER
This communication and any attached documents are strictly confidential and/or legally privileged and they may not be used or disclosed by someone who is not a named recipient. If you have received this electronic communication in error please notify the sender by replying to this electronic communication inserting the word “misdirected” as the subject and delete this communication from your system.


#3

Hello Florian,

you can use the following node attribute provided by Ohai:

node[‘current_user’]

Cheers,
Dennis

On 08.05.2014 09:57, Florian Hehlen wrote:

Hi,

Is there a way to know from within a recipe the name of the user
running the recipe?

Cheers,

Florian

LEGAL DISCLAIMER
This communication and any attached documents are strictly
confidential and/or legally privileged and they may not be used or
disclosed by someone who is not a named recipient. If you have
received this electronic communication in error please notify the
sender by replying to this electronic communication inserting the word
"misdirected" as the subject and delete this communication from your
system.

Dennis Benzinger
Platform Automation Engineer
Managed Services

Nymphenburger Straße 86
80636 München, Deutschland
www.hybris.com http://www.hybris.com

Geschäftsführer:
Ariel Lüdi, Carsten Thoma, Moritz Zimmermann, Michael Zips

Amtsgericht:
München, HRB 124384