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

Space in EB App Name cause incorrect data #19

Closed
rob-showit opened this issue Oct 6, 2021 · 1 comment
Closed

Space in EB App Name cause incorrect data #19

rob-showit opened this issue Oct 6, 2021 · 1 comment

Comments

@rob-showit
Copy link

Example App name: "Webserver App"
Example Env Name: "webserver-app-a"

In the script, currently, the delimiter being used for cut is ' ' (space)
for ebenvapp in jq -r '.Environments[] | .ApplicationName +" "+ .EnvironmentName' <<< $ebappraw 2>> errors.txt ## Loop over each application and environment pair
do
ebapp=cut -d " " -f1 <<< $ebenvapp 2>> errors.txt ## Extract the Application name
ebenv=cut -d " " -f2 <<< $ebenvapp 2>> errors.txt ## Extract the Environment name

  • this results in ebapp: "Webserver" & ebenv: "App"

Changing this to delimiter of ':' (colon) is a possible fix tested in our environment with spaces.
for ebenvapp in jq -r '.Environments[] | .ApplicationName +":"+ .EnvironmentName' <<< $ebappraw 2>> errors.txt ## Loop over each application and environment pair
do
ebapp=cut -d ':' -f1 <<< $ebenvapp 2>> errors.txt ## Extract the Application name
ebenv=cut -d ':' -f2 <<< $ebenvapp 2>> errors.txt ## Extract the Environment name

  • this results in ebapp: "Webserver App" & ebenv: "webserver-app-a"

-Not sure if this is necessary, but in the next line I also put double quotes ("") around the $ebapp
ebnsval=aws elasticbeanstalk describe-configuration-settings --application-name **"$ebapp"** --environment-name $ebenv --query 'ConfigurationSettings[*].OptionSettings[?Namespace==\aws:ec2:vpc`&&OptionName==`VPCId`&&Value!=`null`].OptionName' --region $region --output text 2>> errors.txt` ## If the environment is configured for a vpc return "VPCId"

@TheScottMo
Copy link
Contributor

I have released Version 2 today, which runs in Python and handles these as dictionaries instead of complex string parsing in bash. This will resolve this issue. Thank you for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants