Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding steps to skip AWS CLI Install if already installed #533

Open
wants to merge 1 commit into
base: mainline
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions agent/plugins/domainjoin/domainjoin_unix_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,19 +421,24 @@ install_components() {
fi
fi

check_awscli_install_dir
if uname -a | grep -e "x86_64" -e "amd64"; then
download_awscli_zipfile "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
elif uname -a | grep "aarch64"; then
download_awscli_zipfile "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"
if $AWSCLI --version | awk '{print $1}' | cut -d / -f 2 | grep -q ^2.; then
Copy link
Contributor

@smhmhmd smhmhmd Aug 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting the PR.
We will incorporate this after including another change that needs to go with this.

echo "Local AWS CLI found at $AWSCLI. Domain join to use the existing AWS CLI."
else
echo "***Failed: install_components processor type is unsupported." && exit 1
fi
echo "No AWS CLI found in the instance. Proceeding to download and install of the AWS CLI."
check_awscli_install_dir
if uname -a | grep -e "x86_64" -e "amd64"; then
download_awscli_zipfile "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
elif uname -a | grep "aarch64"; then
download_awscli_zipfile "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"
else
echo "***Failed: install_components processor type is unsupported." && exit 1
fi

unzip -o "$AWS_CLI_INSTALL_DIR"/awscliv2.zip 1>/dev/null
if [ $? -ne 0 ]; then echo "***Failed: unzip of awscliv2.zip" && exit 1; fi
"$AWS_CLI_INSTALL_DIR"/aws/install -u 1>/dev/null
if [ $? -ne 0 ]; then echo "***Failed: aws cli install" && exit 1; fi
unzip -o "$AWS_CLI_INSTALL_DIR"/awscliv2.zip 1>/dev/null
if [ $? -ne 0 ]; then echo "***Failed: unzip of awscliv2.zip" && exit 1; fi
"$AWS_CLI_INSTALL_DIR"/aws/install -u 1>/dev/null
if [ $? -ne 0 ]; then echo "***Failed: aws cli install" && exit 1; fi
fi
return 0
}

Expand Down