Ask Your Question
0

How do deal with files that both humans, and services can modify?

asked 2013-10-16 13:45:47 -0600

spuder gravatar image

updated 2013-10-16 13:51:44 -0600

I am writing a manifest to install and configure a program that manages linux resources.

The program has a file which has some rows that are edited by a human, and some rows that are edited by the deamon. How can I use puppet to ensure this file exists, and optionally change some rows, but leave the rest of the rows alone?

<server_db>
<numjobs>0</numjobs>
<numque>3</numque>
<nextjobid>19745</nextjobid>
<savetime>1381950755</savetime>
<attributes>
<server_state>3</server_state>
<scheduling>1</scheduling>
<total_jobs>0</total_jobs>
<state_count>Transit:0 Queued:0 Held:0 Waiting:0 Running:0 Exiting:0 Complete:0 ...
(more)
edit retag flag offensive close merge delete

Comments

2

This seems overly complex to me, but Augeas is where I'd start looking.

Ancillas gravatar imageAncillas ( 2013-10-16 18:27:53 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-10-17 02:06:00 -0600

asktbt gravatar image

I'd also go for the augeas provider here. Alternatively you can run some defined types on the file.

  1. Put it in puppet as a resource to make sure you've got actually the file there, but don't define the content within the resource.
  2. Start modifying the parameter you like either by
    1. augeas provider through lenses,
    2. your own defined type using exec and e.g. sed.

That way you make sure you only edit the lines you want to and you don't overwrite changes done outside your puppet scope.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-10-16 13:45:47 -0600

Seen: 152 times

Last updated: Oct 17 '13