fix: Making the gates happy
Change-Id: Iddf3469f07486f2c58b46ea993547eecd6df3382
This commit is contained in:
parent
29be6e96a6
commit
7c42c56f1f
12
bindep.txt
12
bindep.txt
@ -31,8 +31,8 @@ mariadb [platform:rpm]
|
||||
mariadb-devel [platform:rpm]
|
||||
mariadb-server [platform:rpm]
|
||||
memcached
|
||||
mongodb [platform:dpkg]
|
||||
mongodb-server [platform:rpm]
|
||||
mongodb [platform:dpkg !platform:ubuntu-jammy]
|
||||
mongodb-server [platform:rpm !platform:ubuntu-jammy]
|
||||
mysql-client [platform:dpkg]
|
||||
mysql-server [platform:dpkg]
|
||||
pkg-config [platform:dpkg]
|
||||
@ -41,14 +41,14 @@ postgresql
|
||||
postgresql-client [platform:dpkg]
|
||||
postgresql-devel [platform:rpm]
|
||||
postgresql-server [platform:rpm]
|
||||
python-dev [platform:dpkg]
|
||||
python-dev [platform:dpkg !platform:ubuntu-jammy]
|
||||
python-devel [platform:rpm]
|
||||
python-libvirt [platform:dpkg !platform:ubuntu-focal]
|
||||
python-lxml
|
||||
python-libvirt [platform:dpkg !platform:ubuntu-focal !platform:ubuntu-jammy]
|
||||
python-lxml [!platform:ubuntu-jammy]
|
||||
python3-all-dev [platform:ubuntu !platform:ubuntu-precise]
|
||||
python3-dev [platform:dpkg]
|
||||
python3-devel [platform:fedora]
|
||||
python3-libvirt [platform:ubuntu-focal]
|
||||
python3-libvirt [platform:ubuntu-focal platform:ubuntu-jammy]
|
||||
python3.4 [platform:ubuntu-trusty]
|
||||
python34-devel [platform:centos]
|
||||
python3.5 [platform:ubuntu-xenial]
|
||||
|
@ -45,7 +45,7 @@ class A10Session(object):
|
||||
payload = {"credentials": {"username": self.username, "password": self.passwd}}
|
||||
try:
|
||||
get_request = requests.post(url=url, headers={"content-type": "application/json"},
|
||||
data=json.dumps(payload), verify=False)
|
||||
data=json.dumps(payload), verify=False, timeout=5)
|
||||
except urllib3.exceptions.SSLError as e:
|
||||
self.log.warning("Caught SSL exception {}".format(e))
|
||||
|
||||
@ -55,8 +55,12 @@ class A10Session(object):
|
||||
|
||||
def log_out(self, auth_sig):
|
||||
url = "https://" + self.device + "/axapi/v3/logoff"
|
||||
requests.post(url=url, headers={"Content-type": "application/json",
|
||||
"Authorization": "A10 %s" % auth_sig}, verify=False)
|
||||
requests.post(
|
||||
url=url,
|
||||
headers={"Content-type": "application/json", "Authorization": "A10 %s" % auth_sig},
|
||||
verify=False,
|
||||
timeout=5,
|
||||
)
|
||||
|
||||
|
||||
class A10MemoryCheck(AgentCheck):
|
||||
@ -101,7 +105,8 @@ class A10MemoryCheck(AgentCheck):
|
||||
"Content-type": "application/json",
|
||||
"Authorization": "A10 %s" %
|
||||
self.auth_sig},
|
||||
verify=False)
|
||||
verify=False,
|
||||
timeout=5)
|
||||
except urllib3.exceptions.SSLError as e:
|
||||
self.log.warning("Caught SSL exception {}".format(e))
|
||||
|
||||
|
@ -120,7 +120,7 @@ class CadvisorHost(AgentCheck):
|
||||
self.cadvisor_url = "{}/{}".format(cadvisor_url, "api/v2.0/stats?count=1")
|
||||
dimensions = self._set_dimensions(None, instance)
|
||||
try:
|
||||
host_metrics = requests.get(self.cadvisor_url, self.connection_timeout).json()
|
||||
host_metrics = requests.get(self.cadvisor_url, timeout=self.connection_timeout).json()
|
||||
except Exception as e:
|
||||
self.log.error("Error communicating with cAdvisor to collect data - {}".format(e))
|
||||
else:
|
||||
@ -130,7 +130,7 @@ class CadvisorHost(AgentCheck):
|
||||
result = urlparse(self.cadvisor_url)
|
||||
self.cadvisor_machine_url = urlunparse(result._replace(path="api/v2.0/machine"))
|
||||
try:
|
||||
machine_info = requests.get(self.cadvisor_machine_url).json()
|
||||
machine_info = requests.get(self.cadvisor_machine_url, timeout=5).json()
|
||||
except Exception as ex:
|
||||
self.log.error(
|
||||
"Error communicating with cAdvisor to collect machine data - {}".format(ex))
|
||||
|
@ -73,7 +73,8 @@ class Kibana(checks.AgentCheck):
|
||||
def _get_data(self, url):
|
||||
return requests.get(
|
||||
url=url,
|
||||
headers=util.headers(self.agent_config)
|
||||
headers=util.headers(self.agent_config),
|
||||
timeout=5
|
||||
).json()
|
||||
|
||||
def _process_metrics(self, stats, dimensions, instance_metrics):
|
||||
@ -136,4 +137,4 @@ class Kibana(checks.AgentCheck):
|
||||
)
|
||||
|
||||
def _get_kibana_version(self, url):
|
||||
return requests.head(url=url).headers['kbn-version']
|
||||
return requests.head(url=url, timeout=5).headers['kbn-version']
|
||||
|
@ -84,7 +84,7 @@ class KubernetesAPI(checks.AgentCheck):
|
||||
if self.kubernetes_connector:
|
||||
return self.kubernetes_connector.get_request(endpoint, as_json=as_json)
|
||||
else:
|
||||
result = requests.get("{}/{}".format(self.kubernetes_api, endpoint))
|
||||
result = requests.get("{}/{}".format(self.kubernetes_api, endpoint), timeout=5)
|
||||
return result.json() if as_json else result
|
||||
|
||||
def _get_api_health(self):
|
||||
|
@ -78,7 +78,7 @@ class WrapNagios(ServicesCheck):
|
||||
last_run_path +
|
||||
'nagios_wrapper_' +
|
||||
hashlib.md5(
|
||||
instance['name']).hexdigest() +
|
||||
instance['name'], usedforsecurity=False).hexdigest() +
|
||||
'.pck')
|
||||
|
||||
# Load last-run data from shared memory file
|
||||
|
@ -24,7 +24,7 @@ def post_headers(payload):
|
||||
'User-Agent': 'Mon/Agent',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'text/html, */*',
|
||||
'Content-MD5': md5(payload).hexdigest()
|
||||
'Content-MD5': md5(payload, usedforsecurity=False).hexdigest()
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,7 +119,7 @@ class LaconicFilter(logging.Filter):
|
||||
|
||||
@staticmethod
|
||||
def hash(msg):
|
||||
return hashlib.md5(msg).hexdigest()
|
||||
return hashlib.md5(msg, usedforsecurity=False).hexdigest()
|
||||
|
||||
def filter(self, record):
|
||||
try:
|
||||
|
5
tox.ini
5
tox.ini
@ -1,7 +1,8 @@
|
||||
[tox]
|
||||
envlist = py39,pep8,cover
|
||||
envlist = py3,pep8,cover
|
||||
minversion = 2.5
|
||||
skipsdist = True
|
||||
ignore_basepython_conflict = True
|
||||
|
||||
[testenv]
|
||||
basepython = python3
|
||||
@ -15,7 +16,7 @@ deps =
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
-r{toxinidir}/requirements.txt
|
||||
whitelist_externals = bash
|
||||
allowlist_externals = bash
|
||||
find
|
||||
rm
|
||||
install_command = pip install {opts} {packages}
|
||||
|
Loading…
Reference in New Issue
Block a user