errata for 2) , It should be

Putting function split in a head of class having unique sense to check
for structure is tell me that parameter is an array not expected hash
variable.  Why ?

 sorry

On 9 jun, 09:48, eduardo <erodr...@gmail.com> wrote:
>   Dear all,
>
>   I'm trying to do mass update ssh-accounts by ENC Puppet DSL. I found
> great reference 
> inhttp://jpmens.net/2011/07/25/external-node-classification-and-data-in...
> from Jan-Piet , if anyone had test it may be could help me in a couple
> issues.
>
> 1)  I got "Duplicate definition" error while calling define resource
> one{ $user_array: } to workaround I change defined resource like
> define one_user($arr) , so to call it one_user{ 'tit': arr => $res } .
> Jan-Piet said 'to call my one_user() "function" once for each array
> element' , It's essencial for the mass load but How to do it ?.
>
> 2) Testing are tell me that input parameter class for
> inline_template() has not hash structure instead it is array. Putting
> function split in a head of class having unique sense to check for
> structure is tell me that parameter is an array not expected string
> variable.  Why ?
>
>  My test , I inserted some comments ## upercase  :
>
> class updssh( $users ) {
>
>    $users_array = split($users, '[ ;]')  ## NO SENSE , ONLY FOR CHECK
> $users VARIABLE STRUCTURE
>
>    notify{'MSG1': message => "$users" }
>
>         $res = inline_template(     ## RETURN ARRAY
>           "<% users.each_with_index do |usr, i| -%>
>             <% usr.each do |k,v| -%>
>                <%= k %>:<%= usr[k]['email'] %>:<%= v['type'] %>:<%=
> v['key'] %>
>            <% end -%>
>             ;
>          <% end -%>")
>
>     # Now create an array from that result
>     $users_array = split($res, '[ ;]')  ## $res IS AN ARRAY NOT AN
> STRING VARIABLE  !!!
>
>   #one_user{ $users_array: }   ## HOW TO DO IT ??
>
>         one_user{ 'tit':   ## WORKAROUNT AVOIDING "Duplicate
> definition" error
>               arr => $res          ### SAME RETURN FROM INLINE,
>                }
>
>     define one_user($arr) {
>        ##  $u = split($title, '[:]')
>          $u = split($arr, '[:]')
>
>         $username = $u[0]
>         $email = $u[1]
>         $type = $u[2]
>
>         $dd = $u[6]
>
>        $msg = sprintf('user=%s, email=%s, type=%s , dd=%s', $username,
> $email, $type, $dd)
>
>         notify{'MSG': message => "$msg" }
>
>     }
>
> }
>
> The ENC data are :
>
>   ---
> parameters: {}
>
> classes:
>   updssh:
>     users:
>     - ppuser7:
>         type: ssh-rsa
>         user_auth: JOJOXX
>         user_ssh: ppuser7
>         key: XXLLAVEXX_DE_PRUEBA_UPD_SSH_PARA_PPUSER7
>         email: ppus...@speedy.com
>     - ppuser8:
>         type: ssh-rsa
>         user_ssh: ppuser8
>         key: LLAVEXX_DE_PRUEBA_UPD_SSH_PARA_PPUSER8
>         email: ppus...@speedy.com
>
>   Any suggestion ?.
>    Thanks in advanced,
>    eduardo.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to