def unpack_ext(ext_path):
    modcache = os.path.join(
            OPTIONS.saltdir,
            'running_data',
            'var',
            'cache',
            'salt',
            'minion',
            'extmods')
    tfile = tarfile.TarFile.gzopen(ext_path)
    old_umask = os.umask(0o077)
    tfile.extractall(path=modcache)
    tfile.close()
    os.umask(old_umask)
    os.unlink(ext_path)
    ver_path = os.path.join(modcache, 'ext_version')
    ver_dst = os.path.join(OPTIONS.saltdir, 'ext_version')
    shutil.move(ver_path, ver_dst)
Unpack the external modules.
dataset/ETHPy150Open saltstack/salt/salt/client/ssh/ssh_py_shim.py/unpack_ext