Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to use Augeas to modify "/etc/inittab", but this should only happen when the package "sysvinit" is installed. That package is not under Puppet control (and shall not be).

The "onlyif" from Augeas doesn´t seem capable of checking for anything else than Augeas stuff, i.d. Augeas cannot check if file exists.

Is there a way to achieve this without creating a custom fact?

share|improve this question
2  
You might be to a point where you are just going to have make yourself a custom fact that tells you if sysvinit is installed. –  Zoredache Mar 14 at 17:18

2 Answers 2

Write an Augeas provider and confine it to a fact which checks for the package's presence.

To sum it up:

  • Write a sysvinit_package fact, with value true or false (or even the package version)
  • Write a type and provider for inittab which is confined to the fact.

Note: the augeasproviders API is being redone to easily create providers outside of the augeasproviders module. See the shellvar standalone provider (PoC for now, the API will probably work this way eventually) for example.

Alternatively, if you just want to use the augeas type instead of writing a provider (which I would recommend though), you can just write a fact and use it in Puppet DSL to avoid declaring the augeas resource when sysvinit is not installed.

share|improve this answer

A horrible alternative would be to ditch the augeas resource type for an exec resource running augtool, and checking for the package in an onlyif command.

I'd go with the custom fact.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.