Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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 </state_count>
<acl_hosts>mongo-test3</acl_hosts>
<default_queue>batch</default_queue>
<log_events>511</log_events>
<mail_from>adm</mail_from>
<resources_assigned>            <nodect>0</nodect>
</resources_assigned>
<scheduler_iteration>600</scheduler_iteration>
<node_check_rate>150</node_check_rate>
<tcp_timeout>300</tcp_timeout>
<job_stat_rate>45</job_stat_rate>
<poll_jobs>1</poll_jobs>
<mom_job_sync>1</mom_job_sync>
<pbs_version>4.2.2</pbs_version>
<keep_completed>300</keep_completed>
<next_job_number>19745</next_job_number>
<net_counter>0 0 0</net_counter>
<moab_array_compatible>1</moab_array_compatible>
</attributes>
</server_db>

Some of the rows that should be edited by the human:

<acl_hosts>mongo-test3</acl_hosts>
<default_queue>batch</default_queue>
<tcp_timeout>300</tcp_timeout>
<keep_completed>300</keep_completed>

Some of the rows that should be edited by the deamon:

<pbs_version>4.2.2</pbs_version>
<nextjobid>19745</nextjobid>
<savetime>1381950755</savetime>

How can I use puppet to manage this file? I've started looking into augeas and writing my own provider and type, but I'm looking for any other advice.

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

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 </state_count>
<acl_hosts>mongo-test3</acl_hosts>
<default_queue>batch</default_queue>
<log_events>511</log_events>
<mail_from>adm</mail_from>
<resources_assigned>            <nodect>0</nodect>
</resources_assigned>
<scheduler_iteration>600</scheduler_iteration>
<node_check_rate>150</node_check_rate>
<tcp_timeout>300</tcp_timeout>
<job_stat_rate>45</job_stat_rate>
<poll_jobs>1</poll_jobs>
<mom_job_sync>1</mom_job_sync>
<pbs_version>4.2.2</pbs_version>
<keep_completed>300</keep_completed>
<next_job_number>19745</next_job_number>
<net_counter>0 0 0</net_counter>
<moab_array_compatible>1</moab_array_compatible>
</attributes>
</server_db>

Some of the rows that should be edited by the human:

<acl_hosts>mongo-test3</acl_hosts>
<default_queue>batch</default_queue>
<tcp_timeout>300</tcp_timeout>
<keep_completed>300</keep_completed>

Some of the rows that should be edited by the deamon:

<pbs_version>4.2.2</pbs_version>
<nextjobid>19745</nextjobid>
<savetime>1381950755</savetime>

The human can edit this file in two ways, 1. Manually editing it, 2. Using the qmgr shell that ships with the program

How can I use puppet to manage this file? I've started looking into augeas and writing my own provider and type, but I'm looking for any other advice.