# -*- coding: utf-8 -*-
'''
Functions to view the minion's public key information
'''
from __future__ import absolute_import

# Import python libs
import os

# Import Salt libs
import salt.utils


def finger():
    '''
    Return the minion's public key 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'))


def finger_master():
    '''
    Return the fingerprint of the master's public key on the minion.

    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'))

@@ -201,16 +201,30 @@
  finger(
+hash_type=None
 ):%0A    '
@@ -274,16 +274,92 @@
 rprint%0A%0A
+    hash_type%0A        The hash algorithm used to calculate the fingerprint%0A%0A
     CLI 
@@ -438,63 +438,72 @@
     
-# MD5 here is temporary. Change to SHA256 when retired.
+if hash_type is None:%0A        hash_type = __opts__%5B'hash_type'%5D%0A
 %0A   
@@ -524,32 +524,41 @@
 tils.pem_finger(
+%0A        
 os.path.join(__o
@@ -602,74 +602,26 @@
     
-                         sum_type=__opts__.get('hash_type', 'md5')
+sum_type=hash_type
 )%0A%0A%0A
@@ -638,16 +638,30 @@
 _master(
+hash_type=None
 ):%0A    '
@@ -733,16 +733,92 @@
 inion.%0A%0A
+    hash_type%0A        The hash algorithm used to calculate the fingerprint%0A%0A
     CLI 
@@ -904,63 +904,72 @@
     
-# MD5 here is temporary. Change to SHA256 when retired.
+if hash_type is None:%0A        hash_type = __opts__%5B'hash_type'%5D%0A
 %0A   
@@ -998,16 +998,25 @@
 _finger(
+%0A        
 os.path.
@@ -1075,72 +1075,24 @@
     
-                         sum_type=__opts__.get('hash_type', 'md5')
+sum_type=hash_type
 )%0A

Add hash_type argument to key module fingerprint functions