Closed owenbendavies closed 8 years ago
This method was improved with https://github.com/applicationsonline/librarian/pull/147 however the Etc.getlogin relies on USER env.
I've just hit exactly the same issue (running librarian in cloudinit on EC2).
Would it work better if you use something like Etc::getpwuid(Process.euid).name, ie. don't assume that someone is logged on?
R.
I had forgotten about this ticket and no longer have this issue. I would guess it's because I am now using sudo in the script, but unfortunately I can't remember. See:
https://github.com/obduk/setup_server/blob/master/bin/install
I've worked round it with this code in the script:
[[ -v HOME ]] || export HOME=/root
ie. set (and export - this is important) $HOME if it's not already set.
I'm sure it would be possible to fix this in the librarian code by using the approach I suggested.
R.
Working version here: https://github.com/ecwws/librarian/commit/c6cc53e7e435ce9b9c871c7eadcd8ed4928bdad0
Summary
I am trying to run
librarian-puppet install
on an Amazon EC2 instance with a shell script in the user data.It is failing because librarian is not picking up the user, this is because when the script is run, neither the USER or HOME environment variables are set.
I was wondering if anyone has any suggestions of how I could make the Environment.default_home method work? I can just add a HOME= to my script, but it would be nice to fix the method.
Versions
librarian (0.1.2)
Stacktrace
Environment