Skip to content

Commit eb8b1d6

Browse files
committed
Don't trust HOME or USER env variables
On Ubuntu under sudo, it seems to be very wonky. We already have code to compute them based on UID, so let's just always do that and never bother even checking what they come to us as.
1 parent 655445b commit eb8b1d6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tasks/enable_replica.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
USER="${USER:-$(id -un)}"
4-
HOME="${HOME:-$(getent passwd "$USER" | cut -d : -f 6)}"
3+
USER=$(id -un)
4+
HOME=$(getent passwd "$USER" | cut -d : -f 6)
55

66
if [ -z "$PT_token_file" -o "$PT_token_file" = "null" ]; then
77
TOKEN_FILE="${HOME}/.puppetlabs/token"

tasks/provision_replica.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
USER="${USER:-$(id -un)}"
4-
HOME="${HOME:-$(getent passwd "$USER" | cut -d : -f 6)}"
3+
USER=$(id -un)
4+
HOME=$(getent passwd "$USER" | cut -d : -f 6)
55

66
if [ -z "$PT_token_file" -o "$PT_token_file" = "null" ]; then
77
TOKEN_FILE="${HOME}/.puppetlabs/token"

0 commit comments

Comments
 (0)