Revision b544a3c2 lib/backend.py
b/lib/backend.py | ||
---|---|---|
1162 | 1162 |
return result |
1163 | 1163 |
|
1164 | 1164 |
|
1165 |
def GetCryptoTokens(token_types): |
|
1166 |
"""Get the node's public cryptographic tokens. |
|
1167 |
|
|
1168 |
This can be the public ssh key of the node or the certificate digest of |
|
1169 |
the node's public client SSL certificate. |
|
1170 |
|
|
1171 |
Note: so far, only retrieval of the SSL digest is implemented |
|
1172 |
|
|
1173 |
@type token_types: list of strings in constants.CRYPTO_TYPES |
|
1174 |
@param token_types: list of types of requested cryptographic tokens |
|
1175 |
@rtype: list of tuples (string, string) |
|
1176 |
@return: list of tuples of the token type and the public crypto token |
|
1177 |
|
|
1178 |
""" |
|
1179 |
tokens = [] |
|
1180 |
for token_type in token_types: |
|
1181 |
if token_type not in constants.CRYPTO_TYPES: |
|
1182 |
raise errors.ProgrammerError("Token type %s not supported." % |
|
1183 |
token_type) |
|
1184 |
if token_type == constants.CRYPTO_TYPE_SSL_DIGEST: |
|
1185 |
tokens.append((token_type, utils.GetClientCertificateDigest())) |
|
1186 |
return tokens |
|
1187 |
|
|
1188 |
|
|
1165 | 1189 |
def GetBlockDevSizes(devices): |
1166 | 1190 |
"""Return the size of the given block devices |
1167 | 1191 |
|
Also available in: Unified diff