Actually, simpler than that.
Using the stdlib puppet-forge module, I can say

$homedirdir = dirname ( $userhome )

and then

           exec { "mkdir-${username}":
               command => "/bin/mkdir -p ${homedirdir}",
               unless  => "test -d ${homedirdir}",
           }

When the user resource is created, this combination creates the directory with 
the proper permissions.

           user { $username:
               ensure     => present,
               home       => $userhome,
               require => Exec["mkdir-${username}"],
               ....
           }


“Sometimes I think the surest sign that intelligent life exists elsewhere in the 
universe is that none of it has tried to contact us.”  (Bill Waterson: Calvin & 
Hobbes)


On Jan 30, 2014, at 11:31 AM, "Arpin Dominique (Nter)" 
<dominique.ar...@casino.qc.ca> wrote:

Hi,

Simple :

User[‘david’]->File[‘/haha’]

Ref: http://docs.puppetlabs.com/learning/ordering.html

Dominique Arpin

Tél. Interne: 140-4156

Tél. 514 285.2929 Poste: 140-4156


De : puppet-users@googlegroups.com [mailto:puppet-users@googlegroups.com] De la 
part de David Portabella
Envoyé : 30 janvier, 2014 11:28
À : puppet-users@googlegroups.com
Objet : [Puppet Users] circular dependency between user/home and parent 
directory owned by that user

For illustrating purposes,

I need a david user with home directory /haha/david,

and at the same time, the directory /haha also needs to be owned by david.

this code does not work,

because user requires the /haha directory, and the /haha directory requires the 
david user,

so we have a circular dependency,

and it seems that puppet does not know how to handle this.

user {'david':

  ensure      => present,

  home        => '/haha/david',

  managehome  => true

}

file {'/haha':

  ensure => directory,

  owner  => 'david'

}

how to solve this?

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/da03b929-db57-4964-acf9-060beec69d2c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Mise en garde concernant la confidentialité : Le présent message, comprenant 
tout fichier qui y est joint, est envoyé à l'intention exclusive de son 
destinataire; il est de nature confidentielle et peut constituer une 
information protégée par le secret professionnel. Si vous n'êtes pas le 
destinataire, nous vous avisons que toute impression, copie, distribution ou 
autre utilisation de ce message est strictement interdite. Si vous avez reçu ce 
courriel par erreur, veuillez en aviser immédiatement l'expéditeur par retour 
de courriel et supprimer le courriel. Merci!

Confidentiality Warning: This message, including any attachment, is sent only 
for the use of the intended recipient; it is confidential and may constitute 
privileged information. If you are not the intended recipient, you are hereby 
notified that any printing, copying, distribution or other use of this message 
is strictly prohibited. If you have received this email in error, please notify 
the sender immediately by return email, and delete it. Thank you!


--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/C2F62CDF5915D0458F0528664315BAE732344C13%40MTL1EXC01.scqmtl.loto-quebec.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2efda94b-5a70-4df1-953f-6230e639ca2b%40me.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to