# File lib/puppet/provider/ssh_authorized_key/parsed.rb, line 63
63:     def flush
64:         # As path expansion had to be moved in the provider, we cannot generate new file
65:         # resources and thus have to chown and chmod here. It smells hackish.
66: 
67:         # Create target's parent directory if nonexistant
68:         if target
69:             dir = File.dirname(target)
70:             if not File.exist? dir
71:                 Puppet.debug("Creating directory %s which did not exist" % dir)
72:                 Dir.mkdir(dir, dir_perm)
73:             end
74:         end
75: 
76:         # Generate the file
77:         super
78: 
79:         # Ensure correct permissions
80:         if target and user
81:             uid = Puppet::Util.uid(user)
82: 
83:             if uid
84:                 File.chown(uid, nil, dir)
85:                 File.chown(uid, nil, target)
86:             else
87:                 raise Puppet::Error, "Specified user does not exist"
88:             end
89:         end
90: 
91:         if target
92:             File.chmod(file_perm, target)
93:         end
94:     end