Skip to content

Commit b75682c

Browse files
committed
fix: remove terminal message and tier detection fix
1 parent 2eb0dff commit b75682c

File tree

4 files changed

+48
-28
lines changed

4 files changed

+48
-28
lines changed

template/v2/dirs/etc/profile.d/q-cli-message.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

template/v2/dirs/etc/sagemaker-ui/sagemaker_ui_post_startup.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,30 @@ else
200200
echo readonly LOGNAME >> ~/.bashrc
201201
fi
202202

203+
# Setup Q CLI auth mode
204+
q_settings_file="$HOME/.aws/amazon_q/settings.json"
205+
if [ -f "$q_settings_file" ]; then
206+
q_auth_mode=$(jq -r '.auth_mode' < $q_settings_file)
207+
if [ "$q_auth_mode" == "IAM" ]; then
208+
export AMAZON_Q_SIGV4=true
209+
else
210+
export AMAZON_Q_SIGV4=false
211+
fi
212+
else
213+
export AMAZON_Q_SIGV4=true
214+
fi
215+
216+
if $AMAZON_Q_SIGV4; then
217+
if grep -q "^export AMAZON_Q_SIGV4=" ~/.bashrc; then
218+
echo "AMAZON_Q_SIGV4 is defined in the env"
219+
else
220+
echo export AMAZON_Q_SIGV4=$AMAZON_Q_SIGV4 >> ~/.bashrc
221+
fi
222+
else
223+
# Remove from .bashrc if it exists
224+
sed -i '/^export AMAZON_Q_SIGV4=/d' ~/.bashrc
225+
fi
226+
203227
# Generate sagemaker pysdk intelligent default config
204228
nohup python /etc/sagemaker/sm_pysdk_default_config.py &
205229
# Only run the following commands if SAGEMAKER_APP_TYPE_LOWERCASE is jupyterlab

template/v3/dirs/etc/profile.d/q-cli-message.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

template/v3/dirs/etc/sagemaker-ui/sagemaker_ui_post_startup.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,30 @@ else
200200
echo readonly LOGNAME >> ~/.bashrc
201201
fi
202202

203+
# Setup Q CLI auth mode
204+
q_settings_file="$HOME/.aws/amazon_q/settings.json"
205+
if [ -f "$q_settings_file" ]; then
206+
q_auth_mode=$(jq -r '.auth_mode' < $q_settings_file)
207+
if [ "$q_auth_mode" == "IAM" ]; then
208+
export AMAZON_Q_SIGV4=true
209+
else
210+
export AMAZON_Q_SIGV4=false
211+
fi
212+
else
213+
export AMAZON_Q_SIGV4=true
214+
fi
215+
216+
if $AMAZON_Q_SIGV4; then
217+
if grep -q "^export AMAZON_Q_SIGV4=" ~/.bashrc; then
218+
echo "AMAZON_Q_SIGV4 is defined in the env"
219+
else
220+
echo export AMAZON_Q_SIGV4=$AMAZON_Q_SIGV4 >> ~/.bashrc
221+
fi
222+
else
223+
# Remove from .bashrc if it exists
224+
sed -i '/^export AMAZON_Q_SIGV4=/d' ~/.bashrc
225+
fi
226+
203227
# Generate sagemaker pysdk intelligent default config
204228
nohup python /etc/sagemaker/sm_pysdk_default_config.py &
205229
# Only run the following commands if SAGEMAKER_APP_TYPE_LOWERCASE is jupyterlab

0 commit comments

Comments
 (0)