# Buggy code
def zone_compare(timezone):
    """
    Checks the md5sum between the given timezone, and the one set in
    /etc/localtime. Returns True if they match, and False if not. Mostly useful
    for running state checks.

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.zone_compare 'America/Denver'
    """
    if "Solaris" in __grains__["os_family"]:
        return "Not implemented for Solaris family"

    tzfile = "/etc/localtime"
    zonepath = "/usr/share/zoneinfo/{0}".format(timezone)

    if not os.path.exists(tzfile):
        return "Error: {0} does not exist.".format(tzfile)

    with salt.utils.fopen(zonepath, "r") as fp_:
        usrzone = hashlib.md5(fp_.read()).hexdigest()

    with salt.utils.fopen(tzfile, "r") as fp_:
        etczone = hashlib.md5(fp_.read()).hexdigest()

    if usrzone == etczone:
        return True
    return False


# Traceback (ValueError)
[root@minion-fips ~]# salt-call state.sls httpd
[INFO    ] Loading fresh modules for state activity
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
ValueError: error:060800A3:digital envelope routines:EVP_DigestInit_ex:disabled for fips
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 82, in salt_call
client.run()
File "/usr/lib/python2.6/site-packages/salt/cli/__init__.py", line 314, in run
caller.run()
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 142, in run
ret = self.call()
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 80, in call
ret['return'] = func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/modules/state.py", line 372, in sls
high_, errors = st_.render_highstate({saltenv: mods})
File "/usr/lib/python2.6/site-packages/salt/state.py", line 2375, in render_highstate
state, errors = self.render_state(sls, saltenv, mods, matches)
File "/usr/lib/python2.6/site-packages/salt/state.py", line 2084, in render_state
state_data = self.client.get_state(sls, saltenv)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 413, in get_state
dest = self.cache_file(path, saltenv)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 143, in cache_file
return self.get_url(path, '', True, saltenv)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 503, in get_url
return self.get_file(url, dest, makedirs, saltenv)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 894, in get_file
hash_local = self.hash_file(dest2check, saltenv)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 1100, in hash_file
path, form='md5', chunk_size=4096)
File "/usr/lib/python2.6/site-packages/salt/utils/__init__.py", line 1437, in get_hash
hash_obj = hash_type()
ValueError: error:060800A3:digital envelope routines:EVP_DigestInit_ex:disabled for fips

# Fixed code
def zone_compare(timezone):
    """
    Checks the hash sum between the given timezone, and the one set in
    /etc/localtime. Returns True if they match, and False if not. Mostly useful
    for running state checks.

    CLI Example:

    .. code-block:: bash

        salt '*' timezone.zone_compare 'America/Denver'
    """
    if "Solaris" in __grains__["os_family"]:
        return "Not implemented for Solaris family"

    tzfile = "/etc/localtime"
    zonepath = "/usr/share/zoneinfo/{0}".format(timezone)

    if not os.path.exists(tzfile):
        return "Error: {0} does not exist.".format(tzfile)

    hash_type = getattr(hashlib, __opts__.get("hash_type", "md5"))
    with salt.utils.fopen(zonepath, "r") as fp_:
        usrzone = hashtype(fp_.read()).hexdigest()

    with salt.utils.fopen(tzfile, "r") as fp_:
        etczone = hashtype(fp_.read()).hexdigest()

    if usrzone == etczone:
        return True
    return False