From 0bd8fbb8d9ab7432edeb5f2d5a4a3b83cc46c56a Mon Sep 17 00:00:00 2001 From: Kai Xia Date: Thu, 23 Apr 2020 08:32:38 +1000 Subject: [PATCH] write information/errors to stderr. Signed-off-by: Kai Xia --- bk_ssm_secrets/bksecrets.py | 3 ++- hooks/environment | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bk_ssm_secrets/bksecrets.py b/bk_ssm_secrets/bksecrets.py index fd03875..666a8b5 100644 --- a/bk_ssm_secrets/bksecrets.py +++ b/bk_ssm_secrets/bksecrets.py @@ -1,5 +1,6 @@ import os import logging +import sys from . import config, helpers, ssm_parameter_store @@ -48,7 +49,7 @@ def parse_ssh(self): f"Starting an ephemeral ssh-agent for `{self.base}/ssh/key`" ) envvars = helpers.start_ssh_agent(self.store['ssh']['key']) - print(f"Added key `{self.base}/ssh/key` to ssh agent.") + print(f"Added key `{self.base}/ssh/key` to ssh agent.", file=sys.stderr) os.environ.update({ "AWS_PARAMSTORE_SECRETS_AGENT_PID": envvars["SSH_AGENT_PID"], diff --git a/hooks/environment b/hooks/environment index 49a15b7..ede7625 100755 --- a/hooks/environment +++ b/hooks/environment @@ -20,11 +20,9 @@ fi exports=$(/usr/local/bin/bk-ssm-secrets) -echo "$exports" | grep -v "^export " || true - set -o allexport # shellcheck disable=SC1090 -source <( echo "$exports" | grep "^export " || true) +source <( echo "$exports" ) set +o allexport unset -f get-ssm