Having issues trying to create the same symlink for multiple web
sites.  This is my class:
class assoc_symlinks {
  $assocs=[ "asecs", "mgsa", "athe" ]
  define create_assoc_symlinks() {
    file {"/www/domains/${name}.press.jhu.edu/cgi-bin/
membership_directory.cgi":
      ensure => symlink,
      target => "/www/shared/cgi-bin/membership_directory.cgi",
      owner => apache, group => apache, mode => 2775,
    }
  }
  create_assoc_symlinks { "$assocs" }
}
Then I call it in my nodes.pp file as "include assoc_symlinks"
When I run puppet, it gives me this error:
hu May 12 14:14:57 -0400 2011 //Node[adv01jh]/
Assoc_symlinks[asecsmgsaathe]/File[/www/domains/
asecsmgsaathe.press.jhu.edu/cgi-bin/membership_directory.cgi]/ensure
(err): change from absent to link failed: Could not set link on
ensure: No such file or directory - /www/domains/
asecsmgsaathe.press.jhu.edu/cgi-bin at /etc/puppet/manifests/classes/
assoc_symlinks.pp:8
As you can see, it is combining my $assocs array into one string,
instead of iterating through it as an array.
Any suggestions would be great as I am relatively new and only been
using puppet for a month or 2 now.
Thanks,
Thom
-- 
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
On Thu, May 12, 2011 at 6:21 PM, tjmaszc <thom@muse.jhu.edu> wrote:> Having issues trying to create the same symlink for multiple web > sites. This is my class: > > class assoc_symlinks { > $assocs=[ "asecs", "mgsa", "athe" ] > > define create_assoc_symlinks() { > file {"/www/domains/${name}.press.jhu.edu/cgi-bin/ > membership_directory.cgi": > ensure => symlink, > target => "/www/shared/cgi-bin/membership_directory.cgi", > owner => apache, group => apache, mode => 2775, > } > } > create_assoc_symlinks { "$assocs" }Don''t quote the array. If you do quote it, Puppet sees it as a string "[''one'', ''two'']" rather than the array ["one", "two"].> } > > Then I call it in my nodes.pp file as "include assoc_symlinks" > > When I run puppet, it gives me this error: > hu May 12 14:14:57 -0400 2011 //Node[adv01jh]/ > Assoc_symlinks[asecsmgsaathe]/File[/www/domains/ > asecsmgsaathe.press.jhu.edu/cgi-bin/membership_directory.cgi]/ensure > (err): change from absent to link failed: Could not set link on > ensure: No such file or directory - /www/domains/ > asecsmgsaathe.press.jhu.edu/cgi-bin at /etc/puppet/manifests/classes/ > assoc_symlinks.pp:8 > > As you can see, it is combining my $assocs array into one string, > instead of iterating through it as an array. > Any suggestions would be great as I am relatively new and only been > using puppet for a month or 2 now. > > Thanks, > Thom > > -- > 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+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. > >-- Nigel Kersten Product, Puppet Labs @nigelkersten -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thank you very much Nigel.  Changing the one line to:
create_assoc_symlinks { $assocs: }
made it work just as I wanted.
Thom
On May 12, 8:10 pm, Nigel Kersten <ni...@puppetlabs.com>
wrote:> On Thu, May 12, 2011 at 6:21 PM, tjmaszc <t...@muse.jhu.edu> wrote:
> > Having issues trying to create the same symlink for multiple web
> > sites.  This is my class:
>
> > class assoc_symlinks {
> >  $assocs=[ "asecs", "mgsa", "athe" ]
>
> >  define create_assoc_symlinks() {
> >    file {"/www/domains/${name}.press.jhu.edu/cgi-bin/
> > membership_directory.cgi":
> >      ensure => symlink,
> >      target =>
"/www/shared/cgi-bin/membership_directory.cgi",
> >      owner => apache, group => apache, mode => 2775,
> >    }
> >  }
> >  create_assoc_symlinks { "$assocs" }
>
> Don''t quote thearray.
>
> If you do quote it, Puppet sees it as a string
"[''one'', ''two'']" rather
> than thearray["one", "two"].
>
>
>
>
>
>
>
>
>
> > }
>
> > Then I call it in my nodes.pp file as "include
assoc_symlinks"
>
> > When I run puppet, it gives me this error:
> > hu May 12 14:14:57 -0400 2011 //Node[adv01jh]/
> > Assoc_symlinks[asecsmgsaathe]/File[/www/domains/
> > asecsmgsaathe.press.jhu.edu/cgi-bin/membership_directory.cgi]/ensure
> > (err): change from absent to link failed: Could not set link on
> > ensure: No such file or directory - /www/domains/
> > asecsmgsaathe.press.jhu.edu/cgi-bin at /etc/puppet/manifests/classes/
> > assoc_symlinks.pp:8
>
> > As you can see, it is combining my $assocsarrayinto one string,
> > instead of iterating through it as anarray.
> > Any suggestions would be great as I am relatively new and only been
> > using puppet for a month or 2 now.
>
> > Thanks,
> > Thom
>
> > --
> > 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+unsubscribe@googlegroups.com.
> > For more options, visit this group
athttp://groups.google.com/group/puppet-users?hl=en.
>
> --
> Nigel Kersten
> Product, Puppet Labs
> @nigelkersten
-- 
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.