mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add hash_type argument to key module fingerprint functions
This commit is contained in:
parent
d0f4c300b7
commit
c8681269a4
1 changed files with 20 additions and 8 deletions
|
@ -11,31 +11,43 @@ import os
|
|||
import salt.utils
|
||||
|
||||
|
||||
def finger():
|
||||
def finger(hash_type=None):
|
||||
'''
|
||||
Return the minion's public key fingerprint
|
||||
|
||||
hash_type
|
||||
The hash algorithm used to calculate the fingerprint
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' key.finger
|
||||
'''
|
||||
# MD5 here is temporary. Change to SHA256 when retired.
|
||||
return salt.utils.pem_finger(os.path.join(__opts__['pki_dir'], 'minion.pub'),
|
||||
sum_type=__opts__.get('hash_type', 'md5'))
|
||||
if hash_type is None:
|
||||
hash_type = __opts__['hash_type']
|
||||
|
||||
return salt.utils.pem_finger(
|
||||
os.path.join(__opts__['pki_dir'], 'minion.pub'),
|
||||
sum_type=hash_type)
|
||||
|
||||
|
||||
def finger_master():
|
||||
def finger_master(hash_type=None):
|
||||
'''
|
||||
Return the fingerprint of the master's public key on the minion.
|
||||
|
||||
hash_type
|
||||
The hash algorithm used to calculate the fingerprint
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' key.finger_master
|
||||
'''
|
||||
# MD5 here is temporary. Change to SHA256 when retired.
|
||||
return salt.utils.pem_finger(os.path.join(__opts__['pki_dir'], 'minion_master.pub'),
|
||||
sum_type=__opts__.get('hash_type', 'md5'))
|
||||
if hash_type is None:
|
||||
hash_type = __opts__['hash_type']
|
||||
|
||||
return salt.utils.pem_finger(
|
||||
os.path.join(__opts__['pki_dir'], 'minion_master.pub'),
|
||||
sum_type=hash_type)
|
||||
|
|
Loading…
Add table
Reference in a new issue