This commit is contained in:
brent s 2017-09-09 12:25:14 -04:00
parent f652aa7c35
commit 3869b30198

View File

@ -80,6 +80,8 @@ def destPrep():
except FileNotFoundError: # broken symlink except FileNotFoundError: # broken symlink
try: try:
os.remove(os.path.join(thisdir, f)) os.remove(os.path.join(thisdir, f))
except:
pass # just... ignore it. it's fine, whatever.
# Delete if empty dir # Delete if empty dir
if len(os.listdir(thisdir)) == 0: if len(os.listdir(thisdir)) == 0:
os.rmdir(thisdir) os.rmdir(thisdir)
@ -92,7 +94,7 @@ def destPrep():
# pass # thisisfine.jpg # pass # thisisfine.jpg
os.makedirs(nowdir, exist_ok = True) os.makedirs(nowdir, exist_ok = True)
if getpass.getuser() == 'root': if getpass.getuser() == 'root':
uid = getpwnam(sks['user']).pw_uid uid = getpwnam(sks['user']).pw_uidFileNotFoundError
gid = getgrnam(sks['group']).gr_gid gid = getgrnam(sks['group']).gr_gid
for d in (sks['destdir'], nowdir): # we COULD set it as part of the os.makedirs, but iirc it doesn't set it for existing dirs for d in (sks['destdir'], nowdir): # we COULD set it as part of the os.makedirs, but iirc it doesn't set it for existing dirs
os.chown(d, uid, gid) os.chown(d, uid, gid)