Skip to content

Commit

Permalink
Merge pull request #500 from peckpeck/bug_5548/rewrite_system_techniq…
Browse files Browse the repository at this point in the history
…ues_to_use_normal_ordering_on_2_10

Bug 5548/rewrite system techniques to use normal ordering on 2 10
Reindent and merge
  • Loading branch information
peckpeck committed Sep 30, 2014
2 parents 215f5d9 + c5f3f33 commit 92072d2
Show file tree
Hide file tree
Showing 14 changed files with 229 additions and 229 deletions.
2 changes: 1 addition & 1 deletion techniques/system/common/1.0/failsafe.st
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ body action WarnOnly
body file_select exclude(name)
{
leaf_name => { "$(name)"};
leaf_name => { "${name}"};
file_result => "!leaf_name";
}
90 changes: 45 additions & 45 deletions techniques/system/common/1.0/process_matching.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,51 +40,6 @@ bundle agent process_matching

"restart_cf" expression => "Hr05.Min00_05";

processes:

windows::
# Always stop cf-monitord
"${g.escaped_workdir}\/bin\/cf-monitord" signals => { "${stop_signal}" };

!windows::
# Always stop cf-monitord
"${sys.workdir}/bin/cf-monitord" signals => { "${stop_signal}" };

restart_cf.!policy_server::
"${cf_components}" signals => { "${stop_signal}" };

# Policy servers have both Nova and Community, don't blindly kill the wrong processes
restart_cf.policy_server::
"${sys.workdir}/bin/${cf_components}" signals => { "${stop_signal}" };
restart_cf.!windows::
"${sys.workdir}/bin/cf-execd" signals => { "${stop_signal}" };
# Note: cron will get restarted automatically by init (respawn directive in inittab)
aix.rudder_aix_crontab_insertion::
"^/usr/sbin/cron" signals => { "${stop_signal}" };
commands:
restart_cf.!windows::
"${sys.cf_serverd}";
"${sys.cf_execd}";
&if(NOVA)&
services:
restart_cf.windows::
"CfengineNovaExec"
service_policy => "stop",
comment => "Stop the executor service, part of scheduled restart";
"CfengineNovaExec"
service_policy => "start",
comment => "Start the executor service, part of scheduled restart";
&endif&
files:

linux::
Expand Down Expand Up @@ -127,6 +82,51 @@ bundle agent process_matching
classes => rudder_common_classes("rudder_aix_crontab_insertion"),
comment => "Insert an AIX-compatible user crontab to run /opt/rudder/bin/check-rudder-agent";

processes:

windows::
# Always stop cf-monitord
"${g.escaped_workdir}\/bin\/cf-monitord" signals => { "${stop_signal}" };

!windows::
# Always stop cf-monitord
"${sys.workdir}/bin/cf-monitord" signals => { "${stop_signal}" };

restart_cf.!policy_server::
"${cf_components}" signals => { "${stop_signal}" };

# Policy servers have both Nova and Community, don't blindly kill the wrong processes
restart_cf.policy_server::
"${sys.workdir}/bin/${cf_components}" signals => { "${stop_signal}" };
restart_cf.!windows::
"${sys.workdir}/bin/cf-execd" signals => { "${stop_signal}" };
# Note: cron will get restarted automatically by init (respawn directive in inittab)
aix.rudder_aix_crontab_insertion::
"^/usr/sbin/cron" signals => { "${stop_signal}" };
&if(NOVA)&
services:
restart_cf.windows::
"CfengineNovaExec"
service_policy => "stop",
comment => "Stop the executor service, part of scheduled restart";
"CfengineNovaExec"
service_policy => "start",
comment => "Start the executor service, part of scheduled restart";
&endif&
commands:
restart_cf.!windows::
"${sys.cf_serverd}";
"${sys.cf_execd}";
reports:
restart_cf::
Expand Down
22 changes: 11 additions & 11 deletions techniques/system/common/1.0/promises.st
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,6 @@ bundle agent check_disable_agent
##########################################################
bundle agent clean_red_button()
{
commands:
safe.policy_server::
"${sys.workdir}/bin/cf-runagent"
args => "-Dsafe",
comment => "Propagate the safe information to children";
files:
safe.policy_server::
"${g.rudder_var}/share/[a-f0-9A-F\-]+/rules/cfengine-(community|nova)/stopFile"
Expand All @@ -217,6 +211,12 @@ bundle agent clean_red_button()
delete => tidy,
comment => "Deleting the stop file, cfengine is good to go";
commands:
safe.policy_server::
"${sys.workdir}/bin/cf-runagent"
args => "-Dsafe",
comment => "Propagate the safe information to children";
reports:
safe::
"@@Common@@result_repaired@@&TRACKINGKEY&@@Red Button@@None@@${g.execRun}##${g.uuid}@#Authorizing Cfengine to restart";
Expand Down Expand Up @@ -568,19 +568,19 @@ bundle agent check_rsyslog_version {
reports:
rsyslogd.!check_rsyslog_version_present::
"@@Common@@result_error@@&TRACKINGKEY&@@Log system for reports@@None@@$(g.execRun)##$(g.uuid)@#The file ${g.rudder_tools}/check_rsyslog_version is missing";
"@@Common@@result_error@@&TRACKINGKEY&@@Log system for reports@@None@@${g.execRun}##${g.uuid}@#The file ${g.rudder_tools}/check_rsyslog_version is missing";
rsyslog_limit_error::
"@@Common@@result_error@@&TRACKINGKEY&@@Log system for reports@@None@@$(g.execRun)##$(g.uuid)@#Could not remove limitation of message in rsyslog";
"@@Common@@result_error@@&TRACKINGKEY&@@Log system for reports@@None@@${g.execRun}##${g.uuid}@#Could not remove limitation of message in rsyslog";
rsyslog_limit_repaired::
"@@Common@@log_repaired@@&TRACKINGKEY&@@Log system for reports@@None@@$(g.execRun)##$(g.uuid)@#Updated the rsyslog configuration to remove limitation of messages";
"@@Common@@log_repaired@@&TRACKINGKEY&@@Log system for reports@@None@@${g.execRun}##${g.uuid}@#Updated the rsyslog configuration to remove limitation of messages";
rsyslog_restarted::
"@@Common@@log_repaired@@&TRACKINGKEY&@@Log system for reports@@None@@$(g.execRun)##$(g.uuid)@#Configured logging system for report centralization";
"@@Common@@log_repaired@@&TRACKINGKEY&@@Log system for reports@@None@@${g.execRun}##${g.uuid}@#Configured logging system for report centralization";
cant_restart_rsyslog::
"@@Common@@result_error@@&TRACKINGKEY&@@Log system for reports@@None@@$(g.execRun)##$(g.uuid)@#Could not restart the logging system";
"@@Common@@result_error@@&TRACKINGKEY&@@Log system for reports@@None@@${g.execRun}##${g.uuid}@#Could not restart the logging system";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
Add a decent PATH to the environment before triggering anything
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

0,5,10,15,20,25,30,35,40,45,50,55 * * * * root . /etc/profile; if [ -e ${g.rudder_base}/bin/check-rudder-agent ]; then ${g.rudder_base}/bin/check-rudder-agent; else if [ ! -e ${g.rudder_base}/etc/disable-agent -a `ps -efww | grep -E "(cf-execd|cf-agent)" | grep -E "${sys.workdir}/bin/(cf-execd|cf-agent)" | grep -v grep | wc -l` -eq 0 ]; then ${sys.workdir}/bin/cf-agent -f failsafe.cf >/dev/null 2>\&1 \&\& ${sys.workdir}/bin/cf-agent >/dev/null 2>\&1; if [ $? != 0 ]; then if [ -f /opt/rudder/etc/rudder-restart-message.txt ]; then cat /opt/rudder/etc/rudder-restart-message.txt; else echo "Rudder agent was unable to restart on $(hostname)."; fi; fi; fi; fi
0,5,10,15,20,25,30,35,40,45,50,55 * * * * root . /etc/profile; if [ -e ${g.rudder_base}/bin/check-rudder-agent ]; then ${g.rudder_base}/bin/check-rudder-agent; else if [ ! -e ${g.rudder_base}/etc/disable-agent -a `ps -efww | grep -E "(cf-execd|cf-agent)" | grep -E "${sys.workdir}/bin/(cf-execd|cf-agent)" | grep -v grep | wc -l` -eq 0 ]; then ${sys.workdir}/bin/cf-agent -f failsafe.cf >/dev/null 2>\&1 \&\& ${sys.workdir}/bin/cf-agent >/dev/null 2>\&1; if [ $? != 0 ]; then if [ -f /opt/rudder/etc/rudder-restart-message.txt ]; then cat /opt/rudder/etc/rudder-restart-message.txt; else echo "Rudder agent was unable to restart on ${hostname}."; fi; fi; fi; fi
2 changes: 1 addition & 1 deletion techniques/system/common/1.0/rudder_agent_nova_cron.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
Add a decent PATH to the environment before triggering anything
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

0,5,10,15,20,25,30,35,40,45,50,55 * * * * root . /etc/profile; if [ ! -e ${g.rudder_base}/etc/disable-agent -a `ps -efww | grep -E "(cf-execd|cf-agent)" | grep -E "${sys.workdir}/bin/(cf-execd|cf-agent))" | grep -v grep | wc -l` -eq 0 ]; then ${sys.workdir}/bin/cf-agent -f failsafe.cf >/dev/null 2>\&1 \&\& ${sys.workdir}/bin/cf-agent >/dev/null 2>\&1; if [ $? != 0 ]; then if [ -f /opt/rudder/etc/rudder-restart-message.txt ]; then cat /opt/rudder/etc/rudder-restart-message.txt; else echo "Rudder agent was unable to restart on $(hostname)."; fi; fi; fi
0,5,10,15,20,25,30,35,40,45,50,55 * * * * root . /etc/profile; if [ ! -e ${g.rudder_base}/etc/disable-agent -a `ps -efww | grep -E "(cf-execd|cf-agent)" | grep -E "${sys.workdir}/bin/(cf-execd|cf-agent))" | grep -v grep | wc -l` -eq 0 ]; then ${sys.workdir}/bin/cf-agent -f failsafe.cf >/dev/null 2>\&1 \&\& ${sys.workdir}/bin/cf-agent >/dev/null 2>\&1; if [ $? != 0 ]; then if [ -f /opt/rudder/etc/rudder-restart-message.txt ]; then cat /opt/rudder/etc/rudder-restart-message.txt; else echo "Rudder agent was unable to restart on ${hostname}."; fi; fi; fi
6 changes: 3 additions & 3 deletions techniques/system/common/1.0/rudder_lib.st
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ body copy_from scp(from, server,compare,trustkey,preserve,purge)
# running on a policy server instead of copying from a localhost remote blindly.
body copy_from rudder_copy_from(from, server,compare,trustkey,preserve,purge) {
source => "$(from)";
source => "${from}";
compare => "$(compare)";
compare => "${compare}";
encrypt => "true";
verify => "true";
trustkey => "${trustkey}";
Expand Down Expand Up @@ -475,7 +475,7 @@ body package_method rudder_yum
package_list_version_regex => "^\S+?\s(\S+?)\s\S+$";
package_list_arch_regex => "^\S+?\s\S+?\s(\S+)$";
package_installed_regex => ".*";
package_name_convention => "$(name)";
package_name_convention => "${name}";
package_list_update_command => "/usr/bin/yum --quiet check-update";
package_list_update_ifelapsed => "240";
package_patch_name_regex => "([^.]+).*";
Expand Down
10 changes: 5 additions & 5 deletions techniques/system/common/1.0/rudder_stdlib.st
Original file line number Diff line number Diff line change
Expand Up @@ -126,28 +126,28 @@ body file_select rudder_common_minutes_old(minutes)
bundle edit_line rudder_ensure_section_content(section_start, section_end, content)
{
vars:
"csection" string => canonify("$(section_start)");
"csection" string => canonify("${section_start}");
"escaped_section_start" string => escape(${section_start});
"escaped_section_end" string => escape(${section_end});

classes:
# Detect if section is already there
"has_$(csection)" expression => regline("${escaped_section_start}", "$(edit.filename)");
"has_${csection}" expression => regline("${escaped_section_start}", "${edit.filename}");

delete_lines:
".*"
select_region => rudder_section_selector("${escaped_section_start}", "${escaped_section_end}"),
ifvarclass => "has_$(csection)";
ifvarclass => "has_${csection}";

insert_lines:
# Insert new, empty section if it doesn't exist already.
"${section_start}
${section_end}"
insert_type => "preserve_block",
ifvarclass => "!has_$(csection)";
ifvarclass => "!has_${csection}";
# Insert missing lines into the section
"$(content)"
"${content}"
select_region => rudder_section_selector("${escaped_section_start}", "${escaped_section_end}");
}
Expand Down
26 changes: 13 additions & 13 deletions techniques/system/common/1.0/update.st
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,16 @@ bundle agent update_action
config.!windows::
"cf-execd" restart_class => "start_exec";

&if(NOVA)&
services:
windows::
"CfengineNovaExec"
service_policy => "start",
service_method => u_bootstart,
classes => outcome("executor"),
comment => "Start the executor windows service now and at boot time";
&endif&

commands:
start_exec.!windows::
"${sys.cf_execd}"
Expand All @@ -247,16 +257,6 @@ bundle agent update_action
classes => outcome("server");

#########################################################
&if(NOVA)&
services:
windows::
"CfengineNovaExec"
service_policy => "start",
service_method => u_bootstart,
classes => outcome("executor"),
comment => "Start the executor windows service now and at boot time";
&endif&

reports:
server_ok::
"@@Common@@log_repaired@@&TRACKINGKEY&@@Update@@None@@${g.execRun}##${g.uuid}@#Started the server (cf-serverd)";
Expand Down Expand Up @@ -349,7 +349,7 @@ body service_method u_bootstart

body perms u_mog(mode,user,group)
{
owners => { "$(user)" };
groups => { "$(group)" };
mode => "$(mode)";
owners => { "${user}" };
groups => { "${group}" };
mode => "${mode}";
}
18 changes: 9 additions & 9 deletions techniques/system/distributePolicy/1.0/initCheck.st
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ bundle agent generic_process_check_bootstart(binary, initscript, name) {
"check_command" string => "/sbin/chkconfig --list ${initscript} | grep -q on";
"bootstart_command" string => "/sbin/chkconfig ${initscript} on";

files:

debian::

"/etc/rc2.d/S.*${initscript}.*"
create => "true",
action => WarnOnly,
classes => if_else("service_bootstarted_${canoname}", "service_unbootstarted_${canoname}");

commands:

(SuSE|redhat)::
Expand All @@ -156,15 +165,6 @@ bundle agent generic_process_check_bootstart(binary, initscript, name) {
ifvarclass => "service_unbootstarted_${canoname}",
comment => "Set the service ${name} to start on boot";

files:

debian::

"/etc/rc2.d/S.*${initscript}.*"
create => "true",
action => WarnOnly,
classes => if_else("service_bootstarted_${canoname}", "service_unbootstarted_${canoname}");

reports:

cfengine::
Expand Down
8 changes: 4 additions & 4 deletions techniques/system/distributePolicy/1.0/passwordCheck.st
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,15 @@ bundle edit_line root_password_check_file_pgpass(parameter)

"indices" slist => getindices(${parameter});

insert_lines:

"localhost:5432:rudder:${${parameter}[4]}:${${parameter}[5]}";

field_edits:

"localhost:5432:rudder:.*"

# Set field of the file to parameter
edit_field => col(":","${indices}","${${parameter}[${indices}]}","set");

insert_lines:

"localhost:5432:rudder:${${parameter}[4]}:${${parameter}[5]}";

}
18 changes: 9 additions & 9 deletions techniques/system/distributePolicy/1.0/postgresCheck.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ bundle agent root_postgres_check

"configuration_statements" slist => { "host all rudder ::1/128 md5", "host all rudder 127.0.0.1/32 md5" };

commands:

SuSE::

"/etc/init.d/postgresql"
args => "restart",
classes => kept_if_else("psql_restart_ok", "psql_restart_ok", "psql_restart_error"),
ifvarclass => "psql_conf_updated";

files:

SuSE::
Expand All @@ -44,6 +35,15 @@ bundle agent root_postgres_check
classes => kept_if_else("psql_conf_ok", "psql_conf_updated", "psql_conf_update_error"),
comment => "Edit the SuSE postgresql configuration to enable account-less logins";

commands:

SuSE::

"/etc/init.d/postgresql"
args => "restart",
classes => kept_if_else("psql_restart_ok", "psql_restart_ok", "psql_restart_error"),
ifvarclass => "psql_conf_updated";

reports:

SuSE::
Expand Down
Loading

0 comments on commit 92072d2

Please sign in to comment.