defunzip(zip_file,
dest,
excludes=None,
options=None,
template=None,
runas=None,
trim_output=False,
password=None,
extract_perms=True):if notexcludes:
excludes=[]ifrunas:
euid=os.geteuid()
egid=os.getegid()
uinfo= __salt__['user.info'](runas)if notuinfo:raiseSaltInvocationError("User '{0}' does not exist".format(runas)
)
zip_file, dest=_render_filenames(zip_file, dest, None, template)if runas and (euid != uinfo['uid'] or egid != uinfo['gid']):#Change the egid first, as changing it after the euid will fail
#if the runas user is non-privileged.
os.setegid(uinfo['gid'])
os.seteuid(uinfo['uid'])try:
exc=None#Define cleaned_files here so that an exception will not prevent this