Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 405
KomodoDave Avatar asked Oct 30 '12 16:10

KomodoDave


2 Answers

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

like image 144
Ger Apeldoorn Avatar answered Sep 27 '22 15:09

Ger Apeldoorn


You can try :

 puppet apply -e 'include app_test::test'

or for a dry run

 puppet apply -e 'include app_test::test' --noop

For more puppet apply, see manual page : http://docs.puppetlabs.com/man/apply.html

like image 36
iamauser Avatar answered Sep 27 '22 17:09

iamauser