Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to add a require to the default resource for users in Puppet:

User { require => Mount['/home'] }

Using Puppet 0.25, I get the following error:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Syntax error at '+>'; expected '}' at /home/rpinson/puppetmaster/manifests/foo.pp:71 on node ip-bar.internal

Is there a way to achieve that?

share|improve this question
I assume line 71 is 'User {...'? Also, '+>' appears to be supported in 0.25: – Kyle Smith Apr 4 '12 at 13:39
Yes @KyleSmith, the syntax is supported in 0.25, but it doesn't seem to work unless it's applied in the case of an inheritance. – ℝaphink Apr 4 '12 at 13:46

In this case, it might be easier to leverage a define resource instead of resource defaults.

define myuser (
  ... # you certainly need the rest of the user attribute.
) {
  user { $name:
    require => Mount['/home'],
    ... # and the rest of your attributes.

If you declare myuser{ 'johndoe': }, it should also have mount as a requirement.

share|improve this answer
It doesn't work in this case. My use case is: I'm defining partitions and some servers have /home as a separate partition (using LVM). As a result, creating users (whatever they are) requires /home to be mounted on these servers. This is a general requirement, whatever resource triggers the user creation, so I can't use a wrapper for the user type. – ℝaphink Apr 6 '12 at 6:27

Use a resource collector:

User <| |> {
    require +> Mount['/home'],

This adds the requirement to all User instances, but also has a side-effect of realizing any virtual users.

As far is I remember, this is supported in 0.25.

Also, +> operator cannot be used in regular parameter definitions, only in overrides or collectors. Replace those with =>.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.