56: def flush
57: raise Puppet::Error, "Cannot write SSH authorized keys without user" unless @resource.should(:user)
58: raise Puppet::Error, "User '#{@resource.should(:user)}' does not exist" unless uid = Puppet::Util.uid(@resource.should(:user))
59: unless File.exist?(dir = File.dirname(target))
60: Puppet.debug "Creating #{dir}"
61: Dir.mkdir(dir, dir_perm)
62: File.chown(uid, nil, dir)
63: end
64:
65:
66:
67:
68:
69: self.class.backup_target(target)
70:
71: Puppet::Util::SUIDManager.asuser(@resource.should(:user)) { super }
72: File.chown(uid, nil, target)
73: File.chmod(file_perm, target)
74: end