Re: [Puppet Users] string matching in erb template

2012-08-04 Thread Stefan Schulte
On Sat, Aug 04, 2012 at 03:10:11AM -0700, danielt wrote:
> Hi!
> 
> I am trying to match a string in an ERB template but for what ever reason 
> it does not work.
> 
>  <% if has_variable?("apache2_phpmyadmin_url") && apache2_phpmyadmin_url != 
> "" then %>
> ProxyPass /<%= apache2_phpmyadmin_url %>/ !
>  <% end %>
> 
> The conditional works on has_variable? but the != "" is not getting 
> evaluated. When the variable is set to "" than the Proxypass is set to  / 
> instead of being left out.
> 
> Any ideas what I am doing wrong?
> 
> Best Regards,
> 
> Dan

Are you sure the variable is an empty string? I just did a short test
myself and your example does work for me.

try to modify your ProxyPass line to

ProxyPass /<%= apache2_phpmyadmin_url.inspect %>/ !

This way an empty string should appear as "" and you may find out that
apache2_phpmyadmin_url does contain some spaces or is not a string at
all.

Sitenote: The documentation recommends to reference your variables as
instance variables [1] to avoid nameclashes with ruby functions [2].
This way your template could look like this

<% if @apache2_phpmyadmin_url and !@apache2_phpmyadmin_url.empty? -%>
ProxyPass /<%= @apache2_phpmyadmin_url %>/ !
<% end -%>

[1] http://docs.puppetlabs.com/guides/templating.html#referencing-variables
[2] http://projects.puppetlabs.com/issues/14527


-Stefan

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



Re: [Puppet Users] How can puppet help with change control of /etc

2012-08-04 Thread Stuart Cracraft
I use Puppet to track /etc for any changes, backing up the changed files and 
original, capture forensics, and then track it down.

Making /etc a derived repository sounds like you're pushing back the problem of 
surprise production changes one step back.
/etc should be for files that are manually copied in and installed or 
automatically *AFTER* a human reviews them thoroughly
BEFORE the configuration management starts tracking it via hash checksums.

Puppet Enterprise has an audit keyword and with exec one can track and collect 
extract lsof/top/last/who/ps, with backup 
you can capture the changed file and preserve it. But the same can easily be 
done with Open Puppet and we have it. Works
fine for this kind of tracking/capture activity.

The point is that people (maybe even you) are tweaking your system at odd 
times, destabilizing production. Puppet could
watch that like a hawk.

To derive from a git repository, one possibility, you'd exec a git of each of 
file on top of the equivalent file in /etc from /etc/.git
and track it using the above, for example - but I'd push the git source back 
onto the Puppet Master, not on the local box being
managed.

On Aug 4, 2012, at 10:55 AM, bailey86  wrote:

> Hi,
> 
> I've used etckeeper before and it puts the contents of /etc/ into a local git 
> repository.  This means that I can easily see any changes which have been 
> made to anything in /etc/
> 
> However, I need to look after a SLES server - and etckeeper is not available. 
>  Also, I'm looking to upgrade server management to Puppet.
> 
> Is there anyway Puppet can be used to manage /etc/ - i.e. act as a sort of 
> code repository for /etc?
> 
> Thanks for any help.
> 
> Kevin Bailey
> 
> -- 
> 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/-/c5kV-fi1VGcJ.
> 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] How can puppet help with change control of /etc

2012-08-04 Thread bailey86
Hi,

I've used etckeeper before and it puts the contents of /etc/ into a local 
git repository.  This means that I can easily see any changes which have 
been made to anything in /etc/

However, I need to look after a SLES server - and etckeeper is not 
available.  Also, I'm looking to upgrade server management to Puppet.

Is there anyway Puppet can be used to manage /etc/ - i.e. act as a sort of 
code repository for /etc?

Thanks for any help.

Kevin Bailey

-- 
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/-/c5kV-fi1VGcJ.
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] string matching in erb template

2012-08-04 Thread danielt
Hi!

I am trying to match a string in an ERB template but for what ever reason 
it does not work.

 <% if has_variable?("apache2_phpmyadmin_url") && apache2_phpmyadmin_url != 
"" then %>
ProxyPass /<%= apache2_phpmyadmin_url %>/ !
 <% end %>

The conditional works on has_variable? but the != "" is not getting 
evaluated. When the variable is set to "" than the Proxypass is set to  / 
instead of being left out.

Any ideas what I am doing wrong?

Best Regards,

Dan

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



Re: [Puppet Users] File default precedence..?

2012-08-04 Thread Calvin Walton
On Fri, 2012-08-03 at 22:43 -0700, Douglas Garstang wrote:
> Something that I have been confused about for a while.
> 
> If I have:
> 
> /etc/puppet/modules/foo/manifests/bar.pp:
> class foo::bar {
> File {
> backup => false
> }
> }
> 
> /etc/puppet/manifests/site.pp:
> File { backup => true }
> 
>  which one takes precedence in this situation? What about when an
> include or an inherit is used instead?

The puppet style guide:
http://docs.puppetlabs.com/guides/style_guide.html#resource-defaults
has a few words on this. As it turns out, the defaults follow dynamic
scope.

The end result will be that if a file {} resource is defined in class
foo:bar you'll get the defaults from foo:bar, and if a file {} resource
is declared outside of class foo:bar you'll get the defaults from the
top level.

It gets really complicated if you set resource defaults in a class, then
include another class from in that one; so don't do that.

-- 
Calvin Walton 

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