Re: [Puppet Users] sourceselect & multiple sources not working

2011-04-07 Thread Brett Cave
On Thu, Apr 7, 2011 at 3:04 PM, Felix Frank  wrote:

> note here http://docs.puppetlabs.com/references/stable/type.html#file
> that sourceselect "is only used in recursive copies".
>

ah ok. thanks

Single files cannot be merged. After all, how would you define the merge
> of two files?
>

concat :p - i.e. append file contents to each in the order they are listed


> If you want to concatenate the files, you may want to abuse the
> template() function for that. But please don't ;-)
>

I did come across this too - http://projects.puppetlabs.com/issues/5158, and
implemented this:
custom function added:

module Puppet::Parser::Functions
  newfunction(:cat, :type => :rvalue) do |args|
args.join("")
  end
end


files then uses content:
content => cat(file("/etc/puppet/modules/app/files/sysconfig-base"),
file("/etc/puppet/modules/app/files/$env/sysconfig.$hostname")),

Just need to add in some path detection or some variable so that I don't
have to specify the path the files (is there a variable available that gives
$module_path? )

brett


> Regards,
> Felix
>
> --
> 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.
>
>

-- 
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.



[Puppet Users] sourceselect & multiple sources not working

2011-04-07 Thread Brett Cave
Hi,

I am trying to configure a file resource with multiple sources, and browsing
list archives and forums seems to indicate that sourceselect parameter with
an array for the source param. But the final file gets created using the
first matching parameter in the array.

file { '/etc/sysconfig/myconfig':
sourceselect=> all,
source  => [
 "puppet:///modules/app/$env/sysconfig.$hostname",
 "puppet:///modules/app/sysconfig-base"
   ],
owner   => 'someuser',
group   => 'somegroup',
mode=> '0664',
require => Package['app'],
}

If i set source to either 1 or the other, instead of an array, it works as
expected. by swapping the 2 array elements around, i get either the hostname
version only, or the base version only, but the content is never merged (i
get the content of the first element).

Is this the correct way to have multiple source files merged?
puppet / puppet-master version (RHEL rpm): 2.6.6-0.5

brett

-- 
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.



[Puppet Users] Serverside concatenation and conditional checks

2011-04-06 Thread Brett Cave
Hi,

I'm trying to configure sysconfig file for a module.
within modules, i have mod/files/ directory which contains sysconfig-base
and sysconfig-nodename files.

>From the module's init.pp, I then want to create a final file that consists
of the concatenation of sysconfig-base and sysconfig-nodename (if
sysconfig-nodename exists). This is what I have:

file { '/etc/sysconfig/application':
   source   => "puppet:///modules/mod/sysconfig-base"
   other_flags => "all other required file flags configured"
}

I am not sure how to concatenate the sysconfig-$hostname file on the server
side. I have installed r.i. pienaars concat module, but that seems to work
client-side, and not sure how to configure a conditional statement for
server-side module file after this.  1 way of implementing that will work is
by creating 2 files on the client: sysconfig.base and sysconfig.$hostname,
and THEN using the client-side concat module, but I don't think this is a
good way of implementing this.

alternatively: create a "concat.rb" ruby file (a new area of knowledge for
me) to define a server-side concat of the files from the module dir, and
then define the file above using "content" instead of "source"...

Any of these methods on the right "puppetized" way of doing things?

-- 
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.