From 6180d82f1431b8b0c9348de6cd2ee3b14ff4cc9e Mon Sep 17 00:00:00 2001
From: Gregory Haynes <greg@greghaynes.net>
Date: Fri, 19 Aug 2016 16:04:32 +0000
Subject: [PATCH] Allow ramdisk-create to run without $USER set

It's possible this is run form an environment where $USER isn't set,
properly fallback to whoami in this case.

Change-Id: I1181f714c3c456ee264b34d282bac5c0adb67a0e
---
 elements/ironic-agent/cleanup.d/99-ramdisk-create | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/elements/ironic-agent/cleanup.d/99-ramdisk-create b/elements/ironic-agent/cleanup.d/99-ramdisk-create
index 16229dede..5e04a18ea 100755
--- a/elements/ironic-agent/cleanup.d/99-ramdisk-create
+++ b/elements/ironic-agent/cleanup.d/99-ramdisk-create
@@ -11,6 +11,8 @@ set -o pipefail
 
 [ -n "$TARGET_ROOT" ]
 
+USER=${USER:-$(whoami)}
+
 source $_LIB/img-functions
 
 IMAGE_PATH=$(readlink -f $IMAGE_NAME)