On Thursday, April 21, 2016 at 8:12:21 PM UTC-5, kdo wrote:
>
> Hi all,
>
> i am trying to build a module to install Oracle server on Linux that
> utilises defined types in the module oradb::installdb.pp
>
> one of the checks in the oradb::installdb is this
>
> if ! defined(File["${download_dir}/db_install_${version}.rsp"])
>
> so in order to override this file definition and source my own custom
> response file, I would need to have a file resource in my custom manifest
> that defines File["${download_dir}/db_install_${version}.rsp"] ?
>
If another File resource bearing the specified title has already been
declared at the time that conditional is evaluated, then the conditional
evaluates to false, and the code it protects is not evaluated. Typically,
that code would be the module's own declaration of the File, but it could
be anything.
Note, however, that for this to be effective, the File resource to be
tested must *already* have been declared. The defined() function is
necessarily sensitive to evaluation order, making its use questionable at
best in most circumstances. This is not your present problem, however,
because if evaluation order were tripping you up in this case then catalog
building would fail with a duplicate resource declaration (so defined()
isn't even reliable for its intended purpose).
> so in my custom manifest I have that exact file defined as follows :
>
> file { "${download_dir}/db_install_${version}.rsp":
> ensure => 'present',
> content =>
> template("${module_name}/oracle/server/db_install_AWS_${version}_binary.rsp.erb"),
> mode => '0775',
> owner => $user,
> group => $group,
> }
>
> the file get's setup ok but then get's over written because this check is
> true if ! defined(File["${download_dir}/db_install_${version}.rsp"]) so it
> doesn't find the defined file resource.
>
>
Do observe that the name of the File in the condition contains
interpolations of two unqualified variables. If either of those variables
has a different value in the scope of your class than it does in class
oradb::installdb then your File does not, in fact, prevent the one in oradb
from being declared.
> can anyone see where I am going wrong ?
>
Consider also that Puppet's catalog builder has no knowledge of symlinks
(or hard links) on the target machine. If there is more than one path to
the same physical file, then it is possible to manage it as more than one
resource.
Nevertheless, I'm inclined to guess that you are not, in fact, managing the
file you think you are managing, on account of differing variable
interpolations. Of course, this supposes that your custom class is being
applied to the target node at all.
John
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/1c45303f-f72e-4f1b-a62e-7b2d72637951%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.