diff options
author | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-09-15 07:58:52 -0700 |
---|---|---|
committer | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-09-16 13:46:06 -0700 |
commit | 4a8f130775e30a24c94de1873899c69a34227fd0 (patch) | |
tree | d0432d9b75b2672d0c33888ea6aff38c3e26c350 /test/code-smell/replace-urlopen.sh | |
parent | 0685262d06d31e43ec54ce4038db347a6679c8fc (diff) | |
download | ansible-urlib2-travis.tar.gz |
Fix urlopen usage to use open_url insteadurlib2-travis
Add a travis test for urlopen usage
Diffstat (limited to 'test/code-smell/replace-urlopen.sh')
-rwxr-xr-x | test/code-smell/replace-urlopen.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/code-smell/replace-urlopen.sh b/test/code-smell/replace-urlopen.sh new file mode 100755 index 0000000000..410b2e565e --- /dev/null +++ b/test/code-smell/replace-urlopen.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +BASEDIR=${1-"."} + +URLLIB_USERS=$(find "$BASEDIR" -name '*.py' -exec grep -H urlopen \{\} \;) +URLLIB_USERS=$(echo "$URLLIB_USERS" | sed '/\(\n\|lib\/ansible\/module_utils\/urls.py\)/d') +if test -n "$URLLIB_USERS" ; then + printf "$URLLIB_USERS" + exit 1 +else + exit 0 +fi |