1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Python3 fix for hashing in inventory plugins

This commit is contained in:
Matt Martz 2017-06-02 12:41:02 -05:00 committed by Brian Coca
parent 84eea2a7e3
commit 99a30f8fdb

View file

@ -61,11 +61,11 @@ class BaseInventoryPlugin(object):
''' create predictable unique prefix for plugin/inventory ''' ''' create predictable unique prefix for plugin/inventory '''
m = hashlib.sha1() m = hashlib.sha1()
m.update(self.NAME) m.update(to_bytes(self.NAME))
d1 = m.hexdigest() d1 = m.hexdigest()
n = hashlib.sha1() n = hashlib.sha1()
n.update(path) n.update(to_bytes(path))
d2 = n.hexdigest() d2 = n.hexdigest()
return 's_'.join([d1[:5], d2[:5]]) return 's_'.join([d1[:5], d2[:5]])