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