Fixing the gates

fix: sha256 instead of sha1 for metric_id

fix: allowlist added to .tox file
Change-Id: I0384f8e9cdae901df9403c442fce4cf1bf036968
This commit is contained in:
Hasan Acar 2024-03-19 06:08:55 +00:00 committed by Gökhan
parent 1ea4e21eb2
commit 84f03c516a
4 changed files with 4 additions and 4 deletions

View File

@ -132,7 +132,7 @@ class MetricCassandraRepository(abstract_repository.AbstractCassandraRepository)
dim_names.append(name) dim_names.append(name)
hash_string = '%s\0%s\0%s\0%s' % (region, tenant_id, metric_name, '\0'.join(dim_list)) hash_string = '%s\0%s\0%s\0%s' % (region, tenant_id, metric_name, '\0'.join(dim_list))
metric_id = hashlib.sha1(hash_string.encode('utf8')).hexdigest() metric_id = hashlib.sha256(hash_string.encode('utf8')).hexdigest()
# TODO(brtknr): If database per tenant becomes the default and the # TODO(brtknr): If database per tenant becomes the default and the
# only option, recording tenant_id will be redundant. # only option, recording tenant_id will be redundant.

View File

@ -128,7 +128,7 @@ def main():
hash_string = '%s\0%s\0%s\0%s' % (row.region, row.tenant_id, hash_string = '%s\0%s\0%s\0%s' % (row.region, row.tenant_id,
row.metric_name, row.metric_name,
'\0'.join(row.dimensions)) '\0'.join(row.dimensions))
# metric_id = hashlib.sha1(hash_string.encode('utf8')).hexdigest() # metric_id = hashlib.sha256(hash_string.encode('utf8')).hexdigest()
# id_bytes = bytearray.fromhex(metric_id) # id_bytes = bytearray.fromhex(metric_id)
LOG.info("Recreated hash for metric id: {}".format(hash_string)) LOG.info("Recreated hash for metric id: {}".format(hash_string))

View File

@ -143,7 +143,7 @@ def main():
hash_string = '%s\0%s\0%s\0%s' % (row.region, row.tenant_id, hash_string = '%s\0%s\0%s\0%s' % (row.region, row.tenant_id,
row.metric_name, row.metric_name,
'\0'.join(row.dimensions)) '\0'.join(row.dimensions))
metric_id = hashlib.sha1(hash_string.encode('utf8')).hexdigest() metric_id = hashlib.sha256(hash_string.encode('utf8')).hexdigest()
id_bytes = bytearray.fromhex(metric_id) id_bytes = bytearray.fromhex(metric_id)
LOG.info("Recreated hash for metric id: {}".format(hash_string)) LOG.info("Recreated hash for metric id: {}".format(hash_string))

View File

@ -14,7 +14,7 @@ passenv = http_proxy
no_proxy no_proxy
NO_PROXY NO_PROXY
usedevelop = True usedevelop = True
whitelist_externals = bash allowlist_externals = bash
find find
rm rm
install_command = pip install {opts} {packages} install_command = pip install {opts} {packages}