rhtconsulting / rhc-ose

OpenShift Automation and Utilities by Red Hat Consulting
42 stars 34 forks source link

updated if check for grep return code to be greater than 1 #50

Closed JaredBurck closed 8 years ago

JaredBurck commented 8 years ago

What does this PR do?

Brief explanation of the code or documentation change you've made:

Updated if return code test from -ne 0 to -gt 1

The grep utility exits with one of the following values:

When no docker image was found or had been previously built, the run.sh script would return 1 and error out with the message: "Error: Failed to determine installed docker images. Please verify connectivity to Docker socket".

How should this be manually tested?

Include commands to run your new feature, and also post-run commands to validate that it worked. (please use code blocks to format code samples)

Steps to recreate:

docker rmi {openstack-docker-client id}
./run.sh --repository=/path/to/repo

Same steps as above to verify this works after update.

Is there a relevant Issue open for this?

Provide a link to any open issues that describe the problem you are solving.

No, though worked with Andy for this solution.

Who would you like to review this?

/cc @sabre1041 @etsauer

sabre1041 commented 8 years ago

@JaredBurck if the docker socket is not active, it will return a code 1 which would not prevent the execution to stop as intended

I would recommend splitting up the steps. First grab the images and store them into a variable. Then check to see if 1 was returned. if returned, stop due to Docker socket not active. Otherwise proceed.

Then, perform the awk/grep check

JaredBurck commented 8 years ago

@sabre1041 Updated the run.sh script and split out the checks as suggested. Please take a look and try it out.

sabre1041 commented 8 years ago

@JaredBurck the branch you used for this PR contains additional commits that would also be pulled in. can you create a feature branch that only includes the enhancements

Thanks

JaredBurck commented 8 years ago

@sabre1041 Created feature branch containing only changes and no other commits. Closing this PR. New PR is #52. https://github.com/rhtconsulting/rhc-ose/pull/52