On Wednesday, July 25, 2012 9:29:18 AM UTC-4, jcbollinger wrote:
>
>
>
> Something is very strange with that.  It is routine practice for 
> definition bodies to set local variables, and for such definitions to be 
> instantiated multiple times.  Among other things, it is sometimes used to 
> mangle definitions' properties.  For that matter, definitions' property 
> variables are defined separately for each instance, too.
>
> To troubleshoot your problem, I will need to see the exact code you 
> tested, including the corresponding manifest file layout, and the exact 
> error message Puppet emitted.
>
>
Yes something was very strange.  I did something wrong.  I've got it 
working now.  The only major problem I had was that puppet didn't like 

mything { regsubst($versions, '^.*$', "$name:\0"): }

I had to take out the regsubst function and do $foo = regsubst(...) mything 
{ $foo: } I don't understand why that was necessary.  It would say

err: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Syntax error at ':'; expected '}' at 
/etc/puppet/modules/mything/manifests/init.pp:6 on node test.domain.tld

Here are my files:
/etc/puppet/manifests/nodes.d/test.domain.tld.pp

node "web1test.vcu.edu" {
  include "base"

  include mything

  $u = [ "A", "B", "C"]
  $v = [ "1.5", "2.0", "4.2", "0.01" ]

  # $u = "A"
  # $v = "1.5"

  mything::mythings {$u:
    versions => $v }

}
 
and /etc/puppet/modules/mything/manifests/init.pp

class mything {

  define mythings($versions) {
    # $name == $title == the user


    # this didn't work
    # mything { regsubst($versions, '^.*$', "$name:\0"): }

    # this works
    
    foo = regsubst($versions, '^.*$', "$name:\0")
    mything { $foo: }
    
  }

  define mything () {
  # $name == $title == the version

    $user_and_version = split($name, ':')
    $user = $user_and_version[0]
    $version = $user_and_version[1]

    exec { "mything_${name}_${user}_${version}":
      command => "/bin/date >> /tmp/mything.txt; echo /bin/echo mything v. 
$version for $user >> /tmp/mything.txt; /bin/echo '' >> /tmp/mything.txt"
    }
  
  }

}

Can anyone tell me why it wouldn't let me use regsubst(...)  as the name 
when calling mything.  If I could use it, so many possibilities would open 
up.

Puppet on the client machine is 2.6.16 and the puppet master is 2.7.12

Thanks.


>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/0IUOimQ80TcJ.
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