Hi,

I have create the following module:

modules/foo
`-- manifests
    |-- definitions
    |   `-- line.pp
    `-- init.pp

$ cat modules/foo/manifests/init.pp
import "definitions/*.pp"

$ cat modules/foo/manifests/definitions/line.pp
define myline($file, $line, $ensure = 'present') {
    ....
}

I try to use the definition in a class:

class testfile {

    file { "/tmp/testfile":
        ensure => present,
    }

    myline { test:
        file => "/tmp/testfile",
        line => "# This is a test",
        ensure => present,
    }
}

Now, if I do a catalog run on a fresh client, it errors out like this:

err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid
resource type myline at /etc/puppet/manifests/classes/testfile.pp:7 on
node martijn.

However, if I first do a run /without/ the 'testfile' class included for
the node, and then re-enable it, everything is fine, and the class/define
do everything they're supposed to do.

Is the way I am trying to do things supposed to work?

What is the reason that this doesn't work? Is it an issue with loading order?

How can I ensure that the module is loaded/available before the 'testfile'
class is evaluated?

Thanks,
Martijn.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to