Puppet 2.7: Calling puppet apply init.pp does nothing - why?

KomodoDave picture KomodoDave · Oct 30, 2012 · Viewed 15.6k times · Source

Directory and file layout as follows:

app_test/
app_test/manifests
app_test/manifests/init.pp
app_test/manifests/test.pp

Contents of init.pp:

class app_test {
    include app_test::test
}

Contents of test.pp:

class app_test::test {
    exec { 'hello world':
        command => "/bin/echo Hello World >> /tmp/are-you-there.txt"
    }
}

Puppet v2.7.11 is installed.

$ puppet apply init.pp 
notice: Finished catalog run in 0.01 seconds

Could someone please indicate why this doesn't generate the file /tmp/are-you-there-txt?

Answer

Ger Apeldoorn picture Ger Apeldoorn · Oct 30, 2012

You are only defining classes, not declaring them.

Create a file modules/[module_name]/tests/init.pp:

Contents:

include app_test

Test your class then with:

puppet apply tests/init.pp

That should do the trick!

Kind regards,

Ger Apeldoorn