Hi guys, I need help with the class, i have created my class (users) but when i apply from agent apers the next error: [................] [root@nodo1 ~]# puppet agent --test --verbose --noop Info: Retrieving plugin Info: Caching catalog for nodo1.example.com Error: Failed to apply catalog: Could not find dependency User[mike] for File[/home/mike] [................] My class is: [................] class users($user,$uid) { group { "Administracion" : gid => 3000, } define adm_user ($user,$uid) { user { "$user" : ensure => present, home => "/home/$user", owner => "$user", group => "$user", mode => 0600, uid => "$uid", gid => "Administracion", require => Group[Administracion], } } file { "/home/$user": ensure => "directory", owner => $user, group => $user, mode => 0664, require => User[$user], } file { "/home/$user/.ssh/": ensure => "directory", owner => $user, group => $user, mode => 0664, require => File["/home/$user"] } file { "/home/$user/.ssh/id_rsa.pub": ensure => present, source => "puppet:///modules/users/$user/id_rsa.pub", owner => $user, group => $user, mode => 0600, } } [................] My class intance (inside site.pp) node ''nodo1.example.com'' { class { ''users'': user => ''elmo'', uid => ''9000'',} } ¿What''s the Problem? -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
There is no user type declared in the users class. Perhaps move the user type call out of the adm_user define. On 9 Mar 2013 17:57, "mike" <miguelcoam@gmail.com> wrote:> Hi guys, > I need help with the class, i have created my class (users) but when i > apply from agent apers the next error: > > [................] > [root@nodo1 ~]# puppet agent --test --verbose --noop > Info: Retrieving plugin > Info: Caching catalog for nodo1.example.com > Error: Failed to apply catalog: Could not find dependency User[mike] for > File[/home/mike] > [................] > > > My class is: > > [................] > class users($user,$uid) { > > group { "Administracion" : > gid => 3000, > } > > define adm_user ($user,$uid) { > user { "$user" : > ensure => present, > home => "/home/$user", > owner => "$user", > group => "$user", > mode => 0600, > uid => "$uid", > gid => "Administracion", > require => Group[Administracion], > } > } > > file { "/home/$user": > ensure => "directory", > owner => $user, > group => $user, > mode => 0664, > require => User[$user], > } > > file { "/home/$user/.ssh/": > ensure => "directory", > owner => $user, > group => $user, > mode => 0664, > require => File["/home/$user"] > } > > file { "/home/$user/.ssh/id_rsa.pub": > ensure => present, > source => "puppet:///modules/users/$user/id_rsa.pub", > owner => $user, > group => $user, > mode => 0600, > } > } > [................] > > My class intance (inside site.pp) > > node ''nodo1.example.com'' { > class { ''users'': user => ''elmo'', uid => ''9000'',} > } > > ¿What''s the Problem? > > > -- > 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+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Hello, I change the sintax for my class and the instance for this inside site.pp , but I still have problem when run the agent from node: [................] [root@nodo1 ~]# puppet agent --test --noop Info: Retrieving plugin Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter group at /etc/puppet/modules/users/manifests/init.pp:11 on node nodo1.example.com Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run [................] My user manifests: [root@master ~]# cat /etc/puppet/modules/users/manifests/init.pp define users::add_user ($user, $uid) { user { $user: ensure => present, home => "/home/${user}", owner => $user, group => $user, mode => 0600, uid => $uid, gid => $uid, } group { $user: gid => $uid, require => User[$user] } file { "/home/${username}": ensure => "directory", owner => $user, group => $user, mode => 0664, require => User[$user], } file { "/home/${user}/.ssh/": ensure => "directory", owner => $user, group => $user, mode => 0700, require => File["/home/${user}"], } file { "/home/${user}/.ssh/id_rsa.pub": ensure => present, source => "puppet:///modules/users/${user}/id_rsa.pub", owner => $user, group => $user, mode => 0600, require => File["/home/${user}"] } } [................] Declare intance from site.pp [................] node ''nodo1.example.com'' { # include users adm_user { ''mcoa'': name => ''mcoa'', uid => ''9000'',} users::add_user { ''mcoa'': user => "mcoa", uid => ''9000''} } [................] Thanks for help. El sábado, 9 de marzo de 2013 14:57:31 UTC-3, mike escribió:> > Hi guys, > I need help with the class, i have created my class (users) but when i > apply from agent apers the next error: > > [................] > [root@nodo1 ~]# puppet agent --test --verbose --noop > Info: Retrieving plugin > Info: Caching catalog for nodo1.example.com > Error: Failed to apply catalog: Could not find dependency User[mike] for > File[/home/mike] > [................] > > > My class is: > > [................] > class users($user,$uid) { > > group { "Administracion" : > gid => 3000, > } > > define adm_user ($user,$uid) { > user { "$user" : > ensure => present, > home => "/home/$user", > owner => "$user", > group => "$user", > mode => 0600, > uid => "$uid", > gid => "Administracion", > require => Group[Administracion], > } > } > > file { "/home/$user": > ensure => "directory", > owner => $user, > group => $user, > mode => 0664, > require => User[$user], > } > > file { "/home/$user/.ssh/": > ensure => "directory", > owner => $user, > group => $user, > mode => 0664, > require => File["/home/$user"] > } > > file { "/home/$user/.ssh/id_rsa.pub": > ensure => present, > source => "puppet:///modules/users/$user/id_rsa.pub", > owner => $user, > group => $user, > mode => 0600, > } > } > [................] > > My class intance (inside site.pp) > > node ''nodo1.example.com'' { > class { ''users'': user => ''elmo'', uid => ''9000'',} > } > > ¿What''s the Problem? > > >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Sunday, March 10, 2013 11:31:49 AM UTC-5, mike wrote:> > Hello, > I change the sintax for my class and the instance for this inside site.pp > , but I still have problem when run the agent from node: > > [................] > > [root@nodo1 ~]# puppet agent --test --noop > Info: Retrieving plugin > Error: Could not retrieve catalog from remote server: Error 400 on SERVER: > Invalid parameter group at /etc/puppet/modules/users/manifests/init.pp:11 > on node nodo1.example.com > Warning: Not using cache on failed catalog > Error: Could not retrieve catalog; skipping run > > [................] > > My user manifests: > > [root@master ~]# cat /etc/puppet/modules/users/manifests/init.pp > define users::add_user ($user, $uid) { > > user { $user: > ensure => present, > home => "/home/${user}", > owner => $user, > group => $user, > mode => 0600, > uid => $uid, > gid => $uid, > } > >[...] The User type has no property named ''group'' (exactly as the error message says). See the type docs: http://docs.puppetlabs.com/references/3.1.latest/type.html#user. There is a property named ''groups'' (note the ''s''), but that is for specifying the user''s *secondary* groups only. After removing that, you would find that the User type also does not have properties ''owner'' or ''mode'', so remove those, too. Next, you may notice that you are inconsistent in your naming. You declare a File["/home/$username"], but everywhere else the user name variable is spelled $user. This one could be insidious, as "/home/$username" probably becomes just "/home/", which exists, so you will manage a different directory than you intended to do. You may also trip over your wrong-direction relationship between User[$user] and Group[$user]. You need to apply the group first, because creating the user is likely to fail if the primary group to which you are assigning him does not already exist. You could change the ''require'' in Group[$user] (only that one) to a ''before'', but you could also just remove it, because Puppet will generate the correct relationship automatically in that particular case (see the "Autorequires" section in the type docs). John -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.