On Wed, Aug 11, 2010 at 12:27 PM, Marc Zampetti <[email protected]>wrote:

> To do this, I see two issues.
> 1) How do I test for the existence of a file? The docs don't seem to be
> able to do so. I'm guessing I would need to define a custom fact for that,
> right?
> 2) How do make it so that the service "ensure" property is correct? Right
> now, it appears that only "running" or "notrunning" is valid. Would
> "ignored" or undef or something like that work?
>

Depends whether you want puppet to fail the rest of the dependency of this
service or simply not perform any changes to the service state but allow the
rest of the manifest to process without any issues.

In the first scenario, require an exec which checks for file absent. In the
second scenario, write a custom fact $maintenance (recommend prefixing your
site name to the fact) and simply apply the meta-parameter noop => true and
Puppet simply won't make any changes to the service state:

# maintenance.rb
Facter.add("maintenance") do
  setcode do
    File::exists?("/path/to/file")
  end
end

# in Puppet Class
If ${maintenance} {
  notice ("System in maintenance mode.")
  Service {
    noop => true,
  }
}

Not sure if it's ideal, since both solutions will generate a fair amount of
logging.

Thanks,

Nan

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to