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

CLI - Fix for CHE-3993 - Proper integer comparison #4028

Merged
merged 3 commits into from
Feb 6, 2017
Merged

Conversation

TylerJewell
Copy link

@TylerJewell TylerJewell commented Feb 6, 2017

Signed-off-by: Tyler Jewell tjewell@codenvy.com

What does this PR do?

This PR adds a function to the base CLI to use awk to do numerical comparisons. Our default function was having problems if the decimal place was in a different location, and this improvement makes it simpler to do these checks.

This check was being used when comparing RAM and disk sizes to minimums.

What issues does this PR fix or reference?

#3993

Changelog

Add awk function to do numerical comparisons in CLI but reverted by PR #4035.

Release Notes

N/A

Docs PR

N/A

Signed-off-by: Tyler Jewell <tjewell@codenvy.com>
@TylerJewell TylerJewell added the kind/bug Outline of a bug - must adhere to the bug report template. label Feb 6, 2017
@TylerJewell TylerJewell requested a review from riuvshin February 6, 2017 16:44
Signed-off-by: Tyler Jewell <tjewell@codenvy.com>
@@ -87,28 +87,30 @@ cmd_start_check_host_resources() {
HOST_RAM=$(echo ${HOST_RAM#*:} | xargs)
HOST_RAM=${HOST_RAM% *}

COMPARE=$(echo "$HOST_RAM<$CHE_MIN_RAM" | bc -l)
Copy link
Contributor

Choose a reason for hiding this comment

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

we could use awk so we don't need to add another tool inside the image

/ # awk 'BEGIN { print (1.543 >= 5.234) ? 0 : 1}'
1
/ # awk 'BEGIN { print (15.43 >= 5.234) ? 0 : 1}'
0

Signed-off-by: Tyler Jewell <tjewell@codenvy.com>
@TylerJewell
Copy link
Author

Per @benoitf request, I removed bc and added in a comparison using awk instead.

@TylerJewell TylerJewell changed the title CLI - Fix for CHE-3993 - Proper integeer comparison CLI - Fix for CHE-3993 - Proper integer comparison Feb 6, 2017
@TylerJewell TylerJewell merged commit f0e2a32 into master Feb 6, 2017
@TylerJewell TylerJewell deleted the che-3993 branch February 6, 2017 21:15
@TylerJewell TylerJewell added the severity/P2 Has a minor but important impact to the usage or development of the system. label Feb 6, 2017
@TylerJewell TylerJewell added this to the 5.3.0 milestone Feb 6, 2017
@codenvy-ci
Copy link

Build # 1895 - FAILED

Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/1895/ to view the results.

@riuvshin riuvshin restored the che-3993 branch February 7, 2017 08:17
@JamesDrummond JamesDrummond mentioned this pull request Feb 17, 2017
9 tasks
JPinkney pushed a commit to JPinkney/che that referenced this pull request Aug 17, 2017
* fix integer comparison
Signed-off-by: Tyler Jewell <tjewell@codenvy.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template. severity/P2 Has a minor but important impact to the usage or development of the system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants