Merge project-config linter jobs (2/2)

Now that the job is changed, we can merge the tox environments.

Fix problems flake8 found.

Change-Id: Ia74b3b4a8c92831e8f34776d580dadb321e22d6c
Needed-By: I96c7aa13f5350327a96a9cd551427e60254cc1a4
This commit is contained in:
Andreas Jaeger 2017-11-01 20:41:24 +01:00
parent 5f851fcd91
commit a32a65d4a8
7 changed files with 20 additions and 23 deletions

View File

@ -119,7 +119,7 @@ def tempdir():
def install_and_load_requirements(reqroot, reqdir): def install_and_load_requirements(reqroot, reqdir):
sha = run_command("git --git-dir %s/.git rev-parse HEAD" % reqdir)[0] sha = run_command("git --git-dir %s/.git rev-parse HEAD" % reqdir)[0]
print "requirements git sha: %s" % sha print("requirements git sha: %s" % sha)
req_venv = os.path.join(reqroot, 'venv') req_venv = os.path.join(reqroot, 'venv')
req_pip = os.path.join(req_venv, 'bin/pip') req_pip = os.path.join(req_venv, 'bin/pip')
req_lib = os.path.join(req_venv, 'lib/python2.7/site-packages') req_lib = os.path.join(req_venv, 'lib/python2.7/site-packages')
@ -168,8 +168,8 @@ def main():
"git://git.openstack.org " "git://git.openstack.org "
"openstack/requirements" "openstack/requirements"
% dict(zc=zc, root=reqroot)) % dict(zc=zc, root=reqroot))
print out print(out)
print err print(err)
else: else:
reqdir = args.reqs reqdir = args.reqs

View File

@ -67,7 +67,7 @@ def main():
try: try:
bug = launchpad.bugs[bugid] bug = launchpad.bugs[bugid]
bug.newMessage(subject=args.subject, content=args.content) bug.newMessage(subject=args.subject, content=args.content)
print (" done.") print(" done.")
except lazr.restfulclient.errors.ServerError as e: except lazr.restfulclient.errors.ServerError as e:
print(" TIMEOUT during save !") print(" TIMEOUT during save !")
except Exception as e: except Exception as e:

View File

@ -100,7 +100,7 @@ class OpenStackTarDiff:
pass pass
if len(self.missing_files) > 0: if len(self.missing_files) > 0:
self.error("files missing in package: %s" % self.missing_files) self.error("files missing in package: %s" % self.missing_files)
print "SUCCESS: Generated package '%s' is valid" % self.package print("SUCCESS: Generated package '%s' is valid" % self.package)
def get_project_name(self): def get_project_name(self):
""" get git project name """ """ get git project name """

View File

@ -1,3 +1 @@
hacking>=0.10,<0.11
bashate>=0.2
-e git://git.openstack.org/openstack-infra/nodepool#egg=nodepool -e git://git.openstack.org/openstack-infra/nodepool#egg=nodepool

View File

@ -42,7 +42,7 @@ def check_repo(repo_path):
repo = git.Repo.clone_from(repo_path, repopath) repo = git.Repo.clone_from(repo_path, repopath)
remotes = repo.git.branch('--remote') remotes = repo.git.branch('--remote')
branches = [r.strip() for r in remotes.splitlines() if r.strip()] branches = [r.strip() for r in remotes.splitlines() if r.strip()]
print (" Remote branches:") print(" Remote branches:")
for r in branches: for r in branches:
print(" %s" % r) print(" %s" % r)
if 'origin/master' in branches: if 'origin/master' in branches:

View File

@ -71,6 +71,6 @@ while not done:
continue continue
if value['name'] == 'Jenkins': if value['name'] == 'Jenkins':
continue continue
print "%s\t%s" % (change['project'], value['name']) print("%s\t%s" % (change['project'], value['name']))
last_change = change last_change = change
done = not last_change.get('_more_changes', False) done = not last_change.get('_more_changes', False)

27
tox.ini
View File

@ -8,21 +8,7 @@ deps = -r{toxinidir}/test-requirements.txt
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:linters] [testenv:linters]
commands =
{toxinidir}/tools/run-bashate.sh
flake8
# Check that zuul.d/projects.yaml list is sorted
{toxinidir}/tools/zuul-projects_sorted.sh
[testenv:ansible-linters]
# TODO(jaegerandi): merge this in linters job once it works fine
# zuul needs python3
basepython = python3 basepython = python3
deps =
# Zuul is required to supply the zuul ansible modules for ansible-lint
-egit+https://git.openstack.org/openstack-infra/zuul@feature/zuulv3#egg=zuul
ansible<2.4.0
ansible-lint
whitelist_externals = bash whitelist_externals = bash
setenv = setenv =
ANSIBLE_LIBRARY= {envdir}/src/zuul/zuul/ansible/library ANSIBLE_LIBRARY= {envdir}/src/zuul/zuul/ansible/library
@ -31,7 +17,20 @@ passenv =
# to export ANSIBLE_ROLES_PATH pointing to the currect repos. # to export ANSIBLE_ROLES_PATH pointing to the currect repos.
# see infra-zuul-jobs-linters job for more information. # see infra-zuul-jobs-linters job for more information.
ANSIBLE_ROLES_PATH ANSIBLE_ROLES_PATH
# Add dependencies here since other jobs use python2 and zuul requires
# python3.
deps =
# Zuul is required to supply the zuul ansible modules for ansible-lint
-egit+https://git.openstack.org/openstack-infra/zuul@feature/zuulv3#egg=zuul
ansible<2.4.0
ansible-lint
hacking>=0.10,<0.11
bashate>=0.2
commands = commands =
{toxinidir}/tools/run-bashate.sh
flake8
# Check that zuul.d/projects.yaml list is sorted
{toxinidir}/tools/zuul-projects_sorted.sh
# Ansible lint # Ansible lint
# [ANSIBLE0012] Commands should not change things if nothing needs doing # [ANSIBLE0012] Commands should not change things if nothing needs doing
bash -c "find playbooks -type f -regex '.*.ya?ml' -print0 | \ bash -c "find playbooks -type f -regex '.*.ya?ml' -print0 | \