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

refactoring #10458

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 20 additions & 15 deletions hack/hooks/verify_generated_modules/pre-commit
Expand Up @@ -15,40 +15,45 @@
# the module fragments.

# Did the commit modify any source module files?
CHANGES=`git diff-index --stat --cached HEAD | grep -E '^ roles/lib_(openshift|utils)/src/(class|doc|ansible|lib)/'`
CHANGES=$(git diff-index --stat --cached HEAD | grep -E '^ roles/lib_(openshift|utils)/src/(class|doc|ansible|lib)/')
RET_CODE=$?
ABORT=0

if [ "${RET_CODE}" -eq "0" ]; then
if [ $RET_CODE == 0 ]
then
# Modifications detected. Run the verification scripts.

# Which was it?
if $(echo $CHANGES | grep -q 'roles/lib_openshift/'); then
if $(echo $CHANGES | grep -q 'roles/lib_openshift/')
then
echo "Validating lib_openshift..."
./roles/lib_openshift/src/generate.py --verify
if [ "${?}" -ne "0" ]; then
if [ $? != 0 ]
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want tabs here

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want tabs here

then
ABORT=1
fi
fi

if $(echo $CHANGES | grep -q 'roles/lib_utils/'); then
if $(echo $CHANGES | grep -q 'roles/lib_utils/')
then
echo "Validating lib_utils..."
./roles/lib_utils/src/generate.py --verify
if [ "${?}" -ne "0" ]; then
if [ $? != 0 ]
then
ABORT=1
fi
fi

if [ "${ABORT}" -eq "1" ]; then
cat <<EOF
if [ $ABORT == 1 ]
then
cat <<EOF
ERROR: Module verification failed. Generated files do not match fragments.

ERROR: Module verification failed. Generated files do not match fragments.

Choices to continue:
1) Run './roles/lib_(openshift|utils)/src/generate.py' from the root of
the repo to regenerate the files
2) Skip verification with '--no-verify' option to 'git commit'
EOF
Choices to continue:
1) Run './roles/lib_(openshift|utils)/src/generate.py' from the root of
the repo to regenerate the files
2) Skip verification with '--no-verify' option to 'git commit'
EOF
fi
fi

Expand Down