Ask Your Question

define vs virtual resources

asked 2013-07-24 10:37:54 -0600

I wonder, which one is better to use to write clearer puppet code.

F.e. there are 2 ways to create some resource (f.e. directory) that might be required by different modules.

1) using virtual resource, that might be realized somewhere 2) using defined puppet class, that might contain concrete file

As for me, I don't like virtual resources at all and prefer parameterised classes and/or defined classes. But I would like to hear other opinions.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-07-25 23:14:50 -0600

llowder gravatar image

First off, the custom resource known as a define is not classes. They are resource types, just the same as the built in types like file or user types.

That being said, these two methods are not mutually exclusive - you can make a defined type be virtual.

The answer to this question depends in part on what you need to do with said resource, and how it needs to be composed.

In both cases, a resource is defined in one class for use by a different class.

If the resource in question is a simple resource - user, a fixed content ... (more)

edit flag offensive delete link more

answered 2014-01-12 14:25:48 -0600

The problem with a defined resource is that it cannot be realized two (or more) times with the SAME name. This is one of the reasons to use virtual resources

edit flag offensive delete link more

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


Asked: 2013-07-24 10:37:54 -0600

Seen: 359 times

Last updated: Jan 12 '14