Hello,
I have my own custom type but I'm having a problem.
In my custom type I have a parameter called "target", that is the path
where the content of the type should be created. This parameter is
optional, and when it is not directly provided, it is initialized in the
next way:
* the files are, by default, created in a path
* all files in the path have a name in the form nnn.tbp where n is a
sequence of digits
* when the target isn't provided, the last number is looked for and a
new file with the next available number is used.
so in my type I have:
newparam(:target) do
defaultto {
path = <find the next number>
}
end
the resource is then created with.
def generate
file_opts = {
:ensure => self[:ensure] == absent ? :absent : :file,
:path => self[:target],
....
}
...
[
Puppet::Type.type(:file).new(file_opts),
...
]
end
def eval_generate
...
[
catalog.resource("File[#{self[:target]}]"),
...
]
end
my problem is that this way if I need to create two (or more) resources
of this type, all of them have the same target, so only of them is
correctly created.
With this implementation, all variations I have tried to fix the
problem are failing, because all resources are evaluated before any
actual creation.
Any advice to fix it?
--
Angel L. Mateo Martínez
Sección de Telemática
Área de Tecnologías de la Información
y las Comunicaciones Aplicadas (ATICA)
http://www.um.es/atica
Tfo: 868889150
Fax: 868888337
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/b2fe5ed4-5d9b-e94d-447d-d60675d6324e%40um.es.
For more options, visit https://groups.google.com/d/optout.