mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix windows home dir lookup
This commit is contained in:
parent
d3620c3356
commit
f14f7470d9
1 changed files with 9 additions and 2 deletions
|
@ -11,7 +11,6 @@ import glob
|
|||
import hashlib
|
||||
import logging
|
||||
import os
|
||||
import pwd
|
||||
import re
|
||||
import shlex
|
||||
import shutil
|
||||
|
@ -19,6 +18,11 @@ import stat
|
|||
import subprocess
|
||||
import time
|
||||
from datetime import datetime
|
||||
import getpass
|
||||
try:
|
||||
import pwd
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
|
@ -1427,7 +1431,10 @@ class Pygit2(GitProvider):
|
|||
'''
|
||||
# https://github.com/libgit2/pygit2/issues/339
|
||||
# https://github.com/libgit2/libgit2/issues/2122
|
||||
home = pwd.getpwnam(salt.utils.get_user()).pw_dir
|
||||
if salt.utils.is_windows():
|
||||
home = os.path.expanduser('~' + getpass.get_user())
|
||||
else:
|
||||
home = pwd.getpwnam(salt.utils.get_user()).pw_dir
|
||||
pygit2.settings.search_path[pygit2.GIT_CONFIG_LEVEL_GLOBAL] = home
|
||||
new = False
|
||||
if not os.listdir(self.cachedir):
|
||||
|
|
Loading…
Add table
Reference in a new issue