def __init__(self, uid, gid, cwd, env): (state_file, state_file_name) = tempfile.mkstemp(dir=cwd, prefix='cloudr', suffix="_state", text=True) chmod(state_file_name, 'IR', 'IW', 'IE') chown(state_file_name, uid, gid) self.env = env self.state_file_name = state_file_name os.close(state_file) self.env[ENV_FILE_NAME] = state_file_name.replace('\\', '\\\\')
def __init__(self, uid, gid, cwd, env): (state_file, state_file_name) = tempfile.mkstemp(dir=cwd, prefix='cloudr', suffix="_state", text=True) try: chmod(state_file_name, uid, 'IR', 'IW', 'IE', 'GR', 'GW') except: LOG.warn("Cannot set permissions for PowerShell script") self.env = env self.state_file_name = state_file_name os.close(state_file) self.env[ENV_FILE_NAME] = state_file_name
def chmod(self, path, *modes): chmod(path, self.get_uid(), *modes)