Merge pull request #61 from ashcrow/RHBZ1792423
rhcos-toolbox: Pass env to sudo when required
diff --git a/rhcos-toolbox b/rhcos-toolbox
index 1729f16..2052032 100755
--- a/rhcos-toolbox
+++ b/rhcos-toolbox
@@ -71,12 +71,12 @@
}
image_pull() {
- if ! sudo podman pull --authfile /var/lib/kubelet/config.json "$TOOLBOX_IMAGE"; then
+ if ! sudo --preserve-env podman pull --authfile /var/lib/kubelet/config.json "$TOOLBOX_IMAGE"; then
read -r -p "Would you like to manually authenticate to registry: '${REGISTRY}' and try again? [y/N] "
if [[ $REPLY =~ ^([Yy][Ee][Ss]|[Yy])+$ ]]; then
- sudo podman login "${REGISTRY}"
- sudo podman pull "$TOOLBOX_IMAGE"
+ sudo --preserve-env podman login "${REGISTRY}"
+ sudo --preserve-env podman pull "$TOOLBOX_IMAGE"
else
echo "Exiting..."
exit 1