Re: [Puppet Users] Howto check if augeas is available

2010-12-16 Thread Hubert Krause
Hello Patrick, hello Martijn,

thank you both for your sugestions:

Am Friday 10 December 2010 21:37:29 schrieb Patrick:
> On Dec 9, 2010, at 7:14 AM, Martijn Grendelman wrote:
> > On 09-12-10 15:30, Martijn Grendelman wrote:
> >> An example: add the following to
> >>
> >> /modules//lib/facter/augeas_available.rb
> >>
> >> -- cut here --
> >> require 'facter'
> >>
> >> Facter.add("augeas_available") do
> >>
> >>setcode do
> >>
> >>avail = "no"
> >>Dir.glob("/usr/lib/libaugeas*") { |filename|
> >>  avail = "yes"
> >>}
> >>avail
> >>end
> >> end
> >> -- cut here --
> I think this one might be better:
> https://github.com/camptocamp/puppet-augeas/blob/master/lib/facter/augeasve
>rsion.rb
>
> I think it will check if Augeas and the ruby bindings exist.

Both works well. If you modify the glob in Martijns script to:

/usr/lib*/libaugeas*

it works with Debian and CentOS5 (and RedHat5 of course). The other script 
works out of the box on both OS. Only One thing made some trouble for me: You 
have to set executable bits to the fact scripts. May be, this should be 
documentented in the wiki.

Best regards,

Hubert

-- 
Hubert Krause
Risk & Fraud Division
INFORM GmbH, Pascalstraße 23, 52076 Aachen, Germany
Phone: +49 24 08 - 94 56 5145
E-Mail: hubert.kra...@inform-ac.com, Web: http://www.inform-ac.com
INFORM Institut fuer Operations Research und Management GmbH
Registered AmtsG Aachen HRB1144 Gfhr. Adrian Weiler


signature.asc
Description: This is a digitally signed message part.


Re: [Puppet Users] Howto check if augeas is available

2010-12-10 Thread Patrick

On Dec 9, 2010, at 7:14 AM, Martijn Grendelman wrote:

> I made a small mistake. Please see at the bottom.
> 
> On 09-12-10 15:30, Martijn Grendelman wrote:
>> An example: add the following to
>> 
>> /modules//lib/facter/augeas_available.rb
>> 
>> -- cut here --
>> require 'facter'
>> 
>> Facter.add("augeas_available") do
>> 
>>setcode do
>> 
>>avail = "no"
>>Dir.glob("/usr/lib/libaugeas*") { |filename|
>>avail = "yes"
>>}
>>avail
>>end
>> end
>> -- cut here --
>> 
>> It simple looks for files named /usr/lib/libaugeas*. I am not sure if that
>> is appropriate for CentOS too, but it works on Debian. Of course, this is
>> no guarantee that the Ruby-bindings are also available, so this is still
>> not idiot-proof.
>> 
>> After installing the fact, you can do something like this in a manifest:
>> 
>> if $augeas_availabe {
>> 
>>augeas { "foo":
>>}
>> 
>> }
> 
> Sorry, that should be:
> 
> if $augeas_availabe == "yes" {
> }
> 

I think this one might be better:
https://github.com/camptocamp/puppet-augeas/blob/master/lib/facter/augeasversion.rb

I think it will check if Augeas and the ruby bindings exist.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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] Howto check if augeas is available

2010-12-09 Thread Martijn Grendelman
I made a small mistake. Please see at the bottom.

On 09-12-10 15:30, Martijn Grendelman wrote:
> An example: add the following to
> 
> /modules//lib/facter/augeas_available.rb
> 
> -- cut here --
> require 'facter'
> 
> Facter.add("augeas_available") do
> 
> setcode do
> 
> avail = "no"
> Dir.glob("/usr/lib/libaugeas*") { |filename|
> avail = "yes"
> }
> avail
> end
> end
> -- cut here --
> 
> It simple looks for files named /usr/lib/libaugeas*. I am not sure if that
> is appropriate for CentOS too, but it works on Debian. Of course, this is
> no guarantee that the Ruby-bindings are also available, so this is still
> not idiot-proof.
> 
> After installing the fact, you can do something like this in a manifest:
> 
> if $augeas_availabe {
> 
> augeas { "foo":
> }
> 
> }

Sorry, that should be:

if $augeas_availabe == "yes" {
}

Regards,
Martijn.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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] Howto check if augeas is available

2010-12-09 Thread Martijn Grendelman
On 09-12-10 09:44, Hubert Krause wrote:
> Hello,
> 
> Am Wednesday 08 December 2010 22:22:10 schrieb Patrick:
>> What distro are you using?
> 
> CentOS and Debian. New server will always be Debian. Our Puppet Server is 
> CentOS at the moment.
> 
>> Why not just install Augeas when you install puppet?  That's usually much
>> easier.
> 
> Yes, but I want something Idiot proof (I am the idiot in case of doubt). At 
> the moment we install our server by hand. In future we want to use some sort 
> of automatic install, but not at the moment.
> 
> We get errormessages verry instantly If we forget to install augeas, so we 
> have not that big pressure to implement automatic augeas detection. But it 
> would be nice.

An example: add the following to

/modules//lib/facter/augeas_available.rb

-- cut here --
require 'facter'

Facter.add("augeas_available") do

setcode do

avail = "no"
Dir.glob("/usr/lib/libaugeas*") { |filename|
  avail = "yes"
}
avail
end
end
-- cut here --

It simple looks for files named /usr/lib/libaugeas*. I am not sure if that
is appropriate for CentOS too, but it works on Debian. Of course, this is
no guarantee that the Ruby-bindings are also available, so this is still
not idiot-proof.

After installing the fact, you can do something like this in a manifest:

if $augeas_availabe {

augeas { "foo":
}

}

Best regards,
Martijn.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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] Howto check if augeas is available

2010-12-09 Thread Hubert Krause
Hello,

Am Wednesday 08 December 2010 22:22:10 schrieb Patrick:
> What distro are you using?

CentOS and Debian. New server will always be Debian. Our Puppet Server is 
CentOS at the moment.

> Why not just install Augeas when you install puppet?  That's usually much
> easier.

Yes, but I want something Idiot proof (I am the idiot in case of doubt). At 
the moment we install our server by hand. In future we want to use some sort 
of automatic install, but not at the moment.

We get errormessages verry instantly If we forget to install augeas, so we 
have not that big pressure to implement automatic augeas detection. But it 
would be nice.

Best regards,

Hubert

-- 
Hubert Krause
Risk & Fraud Division
INFORM GmbH, Pascalstraße 23, 52076 Aachen, Germany
Phone: +49 24 08 - 94 56 5145
E-Mail: hubert.kra...@inform-ac.com, Web: http://www.inform-ac.com
INFORM Institut fuer Operations Research und Management GmbH
Registered AmtsG Aachen HRB1144 Gfhr. Adrian Weiler


signature.asc
Description: This is a digitally signed message part.


Re: [Puppet Users] Howto check if augeas is available

2010-12-08 Thread Patrick

On Dec 8, 2010, at 2:32 AM, Hubert Krause wrote:

> Hello,
> 
> Am Wednesday 08 December 2010 11:00:11 schrieb Patrick:
>> The best answer is usually, "install Augeas when you install Puppet".  If
>> that's not possible, I know of two options: 1) Custom fact wrapper
>> 2) Use a bootstrap enviroment and don't have your client leave it without
>> Augeas.
> 
> Do you know a link to an example for such a "Custom fact wrapper?"

I saw one once, but I can't find it.

What distro are you using?

Why not just install Augeas when you install puppet?  That's usually much 
easier.

>> Aside from that, your catalog should compile fine without Augeas on the
>> client.  Are we talking about the server here?
> 
> Hm. I dont know what you mean. If I just do: 
> 
> include class_using_augeas
> 
> for all clients, those which don't have augeas installed run into the 
> error "could not run puppet configuration client: could not find a default 
> provider for augeas".

Ah.  Compiling happens on the server.  Your catalog did compile, it just isn't 
usable.

> I thought that this is a client error message? My Server does have augeas 
> installed.
> 
> With my solution above I can switch off manually those classes 
> like "class_using_augeas". But It looks like that it must be easy to 
> implement a check for such requirements directly into puppet, maybe with a 
> fact (as you mentioned above). Thats why I asked this question, because I 
> dislike my manual solution.
> 
> Best regards,
> 
> Hubert

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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] Howto check if augeas is available

2010-12-08 Thread Hubert Krause
Hello,

Am Wednesday 08 December 2010 11:00:11 schrieb Patrick:
> The best answer is usually, "install Augeas when you install Puppet".  If
> that's not possible, I know of two options: 1) Custom fact wrapper
> 2) Use a bootstrap enviroment and don't have your client leave it without
> Augeas.

Do you know a link to an example for such a "Custom fact wrapper?"

> Aside from that, your catalog should compile fine without Augeas on the
> client.  Are we talking about the server here?

Hm. I dont know what you mean. If I just do: 

include class_using_augeas

for all clients, those which don't have augeas installed run into the 
error "could not run puppet configuration client: could not find a default 
provider for augeas".

I thought that this is a client error message? My Server does have augeas 
installed.

With my solution above I can switch off manually those classes 
like "class_using_augeas". But It looks like that it must be easy to 
implement a check for such requirements directly into puppet, maybe with a 
fact (as you mentioned above). Thats why I asked this question, because I 
dislike my manual solution.

Best regards,

Hubert


signature.asc
Description: This is a digitally signed message part.


Re: [Puppet Users] Howto check if augeas is available

2010-12-08 Thread Patrick

On Dec 8, 2010, at 1:22 AM, Hubert Krause wrote:

> Hello List,
> 
> I have a Problem with classes wich uses augeas. if augeas is not installed, 
> The complete catalog will not compile. So I can not install augeas with a 
> different class. I have to switch off all classes wich uses augeas, until 
> augeas is installed. I solved this Problem by introducing the variable 
> $augeas_avail and do a test in my templates with:
> 
> if $augeas_avail == 'true' {
>   include class_using_augeas
> }
> 
> If there are new machines, I have to put $augeas_avail manually to 'false', 
> wait until augeas is installed on every machine and after that set 
> $augeas_avail to 'true' for running the class_using_augeas.
> 
> I would like to use something like:
> 
> if defined(augeas) { ...
> 
> To automate augeas detection. Is this somehow possible? or what about a fact 
> to determine if augeas is available or not in standart puppet? My 
> Clientversion is 0.25.4.
> 

Answering your question directly:
The best answer is usually, "install Augeas when you install Puppet".  If 
that's not possible, I know of two options:
1) Custom fact wrapper
2) Use a bootstrap enviroment and don't have your client leave it without 
Augeas.


Aside from that, your catalog should compile fine without Augeas on the client. 
 Are we talking about the server here?

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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] Howto check if augeas is available

2010-12-08 Thread Hubert Krause
Hello List,

I have a Problem with classes wich uses augeas. if augeas is not installed, 
The complete catalog will not compile. So I can not install augeas with a 
different class. I have to switch off all classes wich uses augeas, until 
augeas is installed. I solved this Problem by introducing the variable 
$augeas_avail and do a test in my templates with:

if $augeas_avail == 'true' {
include class_using_augeas
}

If there are new machines, I have to put $augeas_avail manually to 'false', 
wait until augeas is installed on every machine and after that set 
$augeas_avail to 'true' for running the class_using_augeas.

I would like to use something like:

if defined(augeas) { ...

To automate augeas detection. Is this somehow possible? or what about a fact 
to determine if augeas is available or not in standart puppet? My 
Clientversion is 0.25.4.

Best regards,

Hubert


signature.asc
Description: This is a digitally signed message part.