# Buggy code
def mount(location, access="rw"):
    """
    Mount an image

    CLI Example:

    .. code-block:: bash

        salt '*' guest.mount /srv/images/fedora.qcow
    """
    root = os.path.join(
        tempfile.gettempdir(), "guest", location.lstrip(os.sep).replace("/", ".")
    )
    if not os.path.isdir(root):
        try:
            os.makedirs(root)
        except OSError:
            # somehow the directory already exists
            pass
    while True:
        if os.listdir(root):
            # Stuf is in there, don't use it
            rand = hashlib.md5(str(random.randint(1, 1000000))).hexdigest()
            root = os.path.join(
                tempfile.gettempdir(),
                "guest",
                location.lstrip(os.sep).replace("/", ".") + rand,
            )
        else:
            break
    cmd = "guestmount -i -a {0} --{1} {2}".format(location, access, root)
    __salt__["cmd.run"](cmd)
    return root


# 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 mount(location, access="rw"):
    """
    Mount an image

    CLI Example:

    .. code-block:: bash

        salt '*' guest.mount /srv/images/fedora.qcow
    """
    root = os.path.join(
        tempfile.gettempdir(), "guest", location.lstrip(os.sep).replace("/", ".")
    )
    if not os.path.isdir(root):
        try:
            os.makedirs(root)
        except OSError:
            # somehow the directory already exists
            pass
    while True:
        if os.listdir(root):
            # Stuf is in there, don't use it
            hash_type = getattr(hashlib, __opts__.get("hash_type", "md5"))
            rand = hash_type(str(random.randint(1, 1000000))).hexdigest()
            root = os.path.join(
                tempfile.gettempdir(),
                "guest",
                location.lstrip(os.sep).replace("/", ".") + rand,
            )
        else:
            break
    cmd = "guestmount -i -a {0} --{1} {2}".format(location, access, root)
    __salt__["cmd.run"](cmd)
    return root