Ask Your Question
1

Is init.pp a mandatory element of the module?

asked 2013-06-16 05:52:00 -0500

Quite often I find modules, which contain dummy init.pp with empty class definition. So, I wanted to ask if that file is mandatory or not? Can it just be omitted?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-06-16 23:22:03 -0500

updated 2013-06-16 23:23:52 -0500

I don't believe it is mandatory, if you use another define or class as long as it is properly named it will be fine

Ex :

.
|-- modules
|   `-- test
|       `-- manifests
|           `-- my.pp
|-- sandbox.pp
[...]


$ cat sandbox.pp
include test::my

$ cat modules/test/manifests/my.pp 
class test::my {
  notice ('hello')
}


$ puppet apply --modulepath modules sandbox.pp 
notice: Scope(Class[Test::My]): hello
notice: Finished catalog run in 0.01 seconds

More on init.pp

edit flag offensive delete link more

Comments

Thanks for the example!

Andrey Adamovich gravatar imageAndrey Adamovich ( 2013-06-17 02:07:03 -0500 )edit

Docs say "init.pp is special and _always_ contains a class with the same name as the module.", but they don't mention it can be omited, so, it is ...(more)

Andrey Adamovich gravatar imageAndrey Adamovich ( 2013-06-17 02:08:41 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-06-16 05:52:00 -0500

Seen: 1,070 times

Last updated: Jun 16 '13