MCPcopy
hub / github.com/saltstack/salt / finger

Method finger

salt/key.py:916–947  ·  view source on GitHub ↗

Return the fingerprint for a specified key

(self, match, hash_type=None)

Source from the content-addressed store, hash-verified

914 return self.list_keys()
915
916 def finger(self, match, hash_type=None):
917 """
918 Return the fingerprint for a specified key
919 """
920 if hash_type is None:
921 hash_type = self.opts["hash_type"]
922
923 matches = self.glob_match(match, full=True)
924 ret = {}
925 for status, keys in matches.items():
926 ret[status] = {}
927 for key in keys:
928 if status == "minions_denied":
929 denied = self.cache.fetch("denied_keys", key)
930 for den in denied:
931 finger = salt.utils.crypt.pem_finger(
932 key=den.encode("utf-8"), sum_type=hash_type
933 )
934 ret[status].setdefault(key, []).append(finger)
935 # brush over some dumb backcompat with how denied keys work
936 # with the legacy system
937 if len(denied) == 1:
938 ret[status][key] = ret[status][key][0]
939 else:
940 if status == "local":
941 pub = self.cache.fetch("master_keys", key).encode("utf-8")
942 else:
943 pub = self.cache.fetch("keys", key)["pub"].encode("utf-8")
944 ret[status][key] = salt.utils.crypt.pem_finger(
945 key=pub, sum_type=hash_type
946 )
947 return ret
948
949 def finger_all(self, hash_type=None):
950 """

Callers 4

finger_allMethod · 0.95
safe_acceptFunction · 0.80
fingerFunction · 0.80
test_fingerFunction · 0.80

Calls 5

glob_matchMethod · 0.95
itemsMethod · 0.45
fetchMethod · 0.45
appendMethod · 0.45
setdefaultMethod · 0.45

Tested by 1

test_fingerFunction · 0.64