blob: 519bb1221d65ab8738992e8d57c47a76407be168 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
module Puppet
Puppet::Type.type(:file).newproperty(:owner) do
desc "To whom the file should belong. Argument can be user name or
user ID."
@event = :file_changed
def insync?(current)
provider.insync?(current, @should)
end
# We want to print names, not numbers
def is_to_s(currentvalue)
provider.id2name(currentvalue) || currentvalue
end
def should_to_s(newvalue = @should)
case newvalue
when Symbol
newvalue.to_s
when Integer
provider.id2name(newvalue) || newvalue
when String
newvalue
else
raise Puppet::DevError, "Invalid uid type %s(%s)" %
[newvalue.class, newvalue]
end
end
def retrieve
if self.should
@should = @should.collect do |val|
unless val.is_a?(Integer)
if tmp = provider.validuser?(val)
val = tmp
else
raise "Could not find user %s" % val
end
else
val
end
end
end
return provider.retrieve(@resource)
end
def sync
return provider.sync(resource[:path], resource[:links], @should)
end
end
end
|