Remove type annotations for py2 compatibility add tox-sanity-py27

As seen at [1] the get-hash module [2] fails on centos7. Removing the
annotations should fix this.

Adds the tox-sanity-py27 job for sanity checking that we don't break
py27 support moving forward (until we can kill train).

[1]
https://ab16cb0adf1bbde868e8-d97d31900addfa62359a210d03244371.ssl.cf2.rackcdn.com/807269/1/gate/tripleo-ci-centos-7-content-provider/d1be2fe/job-output.txt
[2] https://review.opendev.org/c/openstack/tripleo-quickstart/+/791486

Change-Id: I289fc02a05fd0e550c5cc9ffeb14da0684d15ee9
This commit is contained in:
Marios Andreou 2021-09-10 17:05:57 +03:00
parent 7d591854b9
commit bdc952b6ec
2 changed files with 11 additions and 5 deletions

View File

@ -22,13 +22,12 @@ from .constants import CONFIG_PATH, CONFIG_KEYS, DEFAULT_CONFIG
from .exceptions import (
TripleOHashInvalidConfig, TripleOHashInvalidDLRNResponse
)
from typing import Any, Tuple
# portable http_get that uses either ansible recommended way or python native
# urllib.
try:
from ansible.module_utils.urls import open_url
def http_get(url: str) -> Tuple[str, int]:
def http_get(url):
try:
response = open_url(url, method='GET')
return (response.read(), response.status)
@ -37,7 +36,7 @@ try:
except ImportError:
from urllib.request import urlopen
def http_get(url: str) -> Tuple[str, int]:
def http_get(url):
# https://stackoverflow.com/questions/35122232/urllib-request-urlopen-return-bytes-but-i-cannot-decode-it
try:
response = urlopen(url)
@ -62,7 +61,7 @@ class TripleOHashInfo:
"""
@classmethod
def load_yaml(cls, filename: str) -> Any:
def load_yaml(cls, filename):
import yaml
return yaml.safe_load(filename)
@ -270,7 +269,7 @@ class TripleOHashInfo:
"delorean commit.yaml results %s", parsed_yaml['commits'][0])
return full, commit, distro, extended
def __repr__(self) -> str:
def __repr__(self):
"""Returns a string representation of the object"""
attrs = vars(self)
return ',\n'.join('%s: %s' % item for item in attrs.items())

View File

@ -1,3 +1,9 @@
- job:
name: tox-sanity-py27
description: Run ansible-test sanity tests on a collection
parent: openstack-tox-py27
vars:
tox_envlist: sanity
- job:
name: tox-sanity-py36
description: Run ansible-test sanity tests on a collection
@ -30,6 +36,7 @@
- openstack-tox-py39
- tripleo-build-containers-ubi-8:
dependencies: *deps_unit_lint_cprovider
- tox-sanity-py27
- tox-sanity-py36
- tox-sanity-py39
gate: