Skip to content

Commit

Permalink
Fixes #5508: Rewrite techniques to use normal ordering on 2.11
Browse files Browse the repository at this point in the history
  • Loading branch information
peckpeck committed Sep 10, 2014
1 parent f9a012e commit 4a6a9af
Show file tree
Hide file tree
Showing 19 changed files with 436 additions and 436 deletions.
58 changes: 29 additions & 29 deletions techniques/applications/apacheReverseProxy/2.0/configuration.st
Original file line number Diff line number Diff line change
Expand Up @@ -55,35 +55,6 @@ bundle agent rudder_reverse_proxy_apache_configuration(service_name, internal_na

"rudder_reverse_proxy_apache_mod_${rudder_reverse_proxy_apache_debian_modules}_loaded" expression => fileexists("/etc/apache2/mods-enabled/${rudder_reverse_proxy_apache_debian_modules}.load");

processes:

"${rudder_reverse_proxy_apache_binary_name}"
restart_class => "rudder_reverse_proxy_apache_process_down",
comment => "Ensuring apache is up";

commands:

debian::
"/usr/sbin/a2enmod ${rudder_reverse_proxy_apache_debian_modules}"
classes => rudder_common_classes("rudder_reverse_proxy_apache_modules"),
ifvarclass => "!rudder_reverse_proxy_apache_mod_${rudder_reverse_proxy_apache_debian_modules}_loaded",
comment => "Enable Apache modules on Debian";

rudder_reverse_proxy_apache_selinux_adjust.!rudder_reverse_proxy_apache_selinux_proxy_policy::
"/usr/sbin/setsebool httpd_can_network_relay on"
classes => rudder_common_classes("rudder_reverse_proxy_apache_selinux"),
comment => "Enable SELinux Apache entry to let Apache proxy entries";

rudder_reverse_proxy_apache_configuration_repaired::
"${rudder_reverse_proxy_apache_restart_command} reload"
classes => rudder_common_classes("rudder_reverse_proxy_apache_reload"),
comment => "reloading apache";

(rudder_reverse_proxy_apache_process_down|rudder_reverse_proxy_apache_modules_repaired)::
"${rudder_reverse_proxy_apache_restart_command} restart"
classes => rudder_common_classes("rudder_reverse_proxy_apache_restart"),
comment => "restarting apache";

files:

"${reverse_proxy_configuration_file}"
Expand Down Expand Up @@ -113,6 +84,35 @@ bundle agent rudder_reverse_proxy_apache_configuration(service_name, internal_na
"any"
usebundle => rudder_common_report("${internal_name}", "result_error", "${${params}[tracking_key]}", "Daemon status", "None", "Unable to restart or reload ${service_name}"),
ifvarclass => "rudder_reverse_proxy_apache_restart_error|rudder_reverse_proxy_apache_reload_error";
processes:

"${rudder_reverse_proxy_apache_binary_name}"
restart_class => "rudder_reverse_proxy_apache_process_down",
comment => "Ensuring apache is up";

commands:

debian::
"/usr/sbin/a2enmod ${rudder_reverse_proxy_apache_debian_modules}"
classes => rudder_common_classes("rudder_reverse_proxy_apache_modules"),
ifvarclass => "!rudder_reverse_proxy_apache_mod_${rudder_reverse_proxy_apache_debian_modules}_loaded",
comment => "Enable Apache modules on Debian";

rudder_reverse_proxy_apache_selinux_adjust.!rudder_reverse_proxy_apache_selinux_proxy_policy::
"/usr/sbin/setsebool httpd_can_network_relay on"
classes => rudder_common_classes("rudder_reverse_proxy_apache_selinux"),
comment => "Enable SELinux Apache entry to let Apache proxy entries";

rudder_reverse_proxy_apache_configuration_repaired::
"${rudder_reverse_proxy_apache_restart_command} reload"
classes => rudder_common_classes("rudder_reverse_proxy_apache_reload"),
comment => "reloading apache";

(rudder_reverse_proxy_apache_process_down|rudder_reverse_proxy_apache_modules_repaired)::
"${rudder_reverse_proxy_apache_restart_command} restart"
classes => rudder_common_classes("rudder_reverse_proxy_apache_restart"),
comment => "restarting apache";

}

# The reporting is made on separate bundles to abstract the complexity
Expand Down
184 changes: 92 additions & 92 deletions techniques/applications/apacheServer/2.0/apacheServerConfiguration.st
Original file line number Diff line number Diff line change
Expand Up @@ -104,78 +104,6 @@ bundle agent check_apache_configuration
# Check if the variable apache_modules is defined so that they can be managed
"apache_module_list_defined" expression => isvariable("apache_modules");
processes:
!redhat.!SuSE.apache_autostart::
"/usr/sbin/apache2"
restart_class => "apache_down",
comment => "Ensuring apache is up";
redhat.apache_autostart::
"/usr/sbin/httpd"
restart_class => "apache_down",
comment => "Ensuring apache is up";
SuSE.apache_bin_prefork.apache_autostart::
"/usr/sbin/httpd2-prefork"
restart_class => "apache_down",
comment => "Ensuring apache is up";
SuSE.!apache_bin_prefork.apache_autostart::
"/usr/sbin/httpd2-worker"
restart_class => "apache_down",
comment => "Ensuring apache is up";
commands:
debian.apache_module_list_defined::
"/usr/sbin/a2enmod"
args => "${apache_modules}",
classes => cf2_if_else("apache_module_${apache_modules}_enabled", "apache_module_${apache_vhost_index}_not_apache_modules"),
comment => "Enable Apache modules on Debian";
apache_selinux_adjust.selinux_bin_present::
"/usr/bin/chcon"
args => "-R --type=httpd_sys_content_t \"${apache_vhost_root[${apache_vhost_index}]}\"",
classes => cf2_if_else("apache_selinux_${apache_vhost_index}_adjusted", "apache_selinux_${apache_vhost_index}_not_adjusted"),
comment => "Set SELinux context for Apache VHosts";
!redhat.(apache_down|apache_change)::
"/etc/init.d/apache2"
args => "restart",
classes => cf2_if_else("apache_restarted", "cant_restart_apache"),
comment => "restarting apache";
redhat.(apache_down|apache_change)::
"/etc/init.d/httpd"
args => "restart",
classes => cf2_if_else("apache_restarted", "cant_restart_apache"),
comment => "restarting apache";
(debian.apache_unbootstarted).apache_bin_present::
"/usr/sbin/update-rc.d"
args => "apache2 defaults",
classes => cf2_if_else("apache_bootstarted_ok", "apache_still_unbootstarted"),
comment => "adding apache to the startup scripts";
(redhat.apache_unbootstarted).apache_bin_present::
"/sbin/chkconfig"
args => "--add httpd",
classes => cf2_if_else("apache_bootstarted_ok", "apache_still_unbootstarted"),
comment => "adding apache to the startup scripts";
(SuSE.apache_unbootstarted).apache_bin_present::
"/sbin/chkconfig"
args => "--add apache2",
classes => cf2_if_else("apache_bootstarted_ok", "apache_still_unbootstarted"),
comment => "adding apache to the startup scripts";
files:
debian::
Expand Down Expand Up @@ -322,6 +250,78 @@ bundle agent check_apache_configuration
classes => if_repaired("root_${apache_vhost_root[${apache_vhost_index}]}_created"),
comment => "Make sure the root directory exists";
processes:
!redhat.!SuSE.apache_autostart::
"/usr/sbin/apache2"
restart_class => "apache_down",
comment => "Ensuring apache is up";
redhat.apache_autostart::
"/usr/sbin/httpd"
restart_class => "apache_down",
comment => "Ensuring apache is up";
SuSE.apache_bin_prefork.apache_autostart::
"/usr/sbin/httpd2-prefork"
restart_class => "apache_down",
comment => "Ensuring apache is up";
SuSE.!apache_bin_prefork.apache_autostart::
"/usr/sbin/httpd2-worker"
restart_class => "apache_down",
comment => "Ensuring apache is up";
commands:
debian.apache_module_list_defined::
"/usr/sbin/a2enmod"
args => "${apache_modules}",
classes => cf2_if_else("apache_module_${apache_modules}_enabled", "apache_module_${apache_vhost_index}_not_apache_modules"),
comment => "Enable Apache modules on Debian";
apache_selinux_adjust.selinux_bin_present::
"/usr/bin/chcon"
args => "-R --type=httpd_sys_content_t \"${apache_vhost_root[${apache_vhost_index}]}\"",
classes => cf2_if_else("apache_selinux_${apache_vhost_index}_adjusted", "apache_selinux_${apache_vhost_index}_not_adjusted"),
comment => "Set SELinux context for Apache VHosts";
!redhat.(apache_down|apache_change)::
"/etc/init.d/apache2"
args => "restart",
classes => cf2_if_else("apache_restarted", "cant_restart_apache"),
comment => "restarting apache";
redhat.(apache_down|apache_change)::
"/etc/init.d/httpd"
args => "restart",
classes => cf2_if_else("apache_restarted", "cant_restart_apache"),
comment => "restarting apache";
(debian.apache_unbootstarted).apache_bin_present::
"/usr/sbin/update-rc.d"
args => "apache2 defaults",
classes => cf2_if_else("apache_bootstarted_ok", "apache_still_unbootstarted"),
comment => "adding apache to the startup scripts";
(redhat.apache_unbootstarted).apache_bin_present::
"/sbin/chkconfig"
args => "--add httpd",
classes => cf2_if_else("apache_bootstarted_ok", "apache_still_unbootstarted"),
comment => "adding apache to the startup scripts";
(SuSE.apache_unbootstarted).apache_bin_present::
"/sbin/chkconfig"
args => "--add apache2",
classes => cf2_if_else("apache_bootstarted_ok", "apache_still_unbootstarted"),
comment => "adding apache to the startup scripts";
reports:
# if the list is not defined, there is nothing to report !
apache_modules_nok::
Expand Down Expand Up @@ -475,6 +475,10 @@ bundle edit_line set_apache_config_security(tab)
# Be careful if the index string contains funny chars
"cindex[${index}]" string => canonify("${index}");
delete_lines:
"^.*${index}.*$";
field_edits:
# If the line is there, but commented out, first uncomment it
Expand All @@ -486,10 +490,6 @@ bundle edit_line set_apache_config_security(tab)
edit_field => col("\s+","2","${${tab}[${index}]}","set"),
classes => if_ok("not_${cindex[${index}]}");
delete_lines:
"^.*${index}.*$";
insert_lines:
"${index} ${${tab}[${index}]}"
Expand All @@ -500,22 +500,6 @@ bundle edit_line set_apache_config_security(tab)
bundle edit_line set_apache_config_vhost(fqdn, port, root, exp, exp_ttl, alias_one_src, alias_one_dst, alias_two_src, alias_two_dst, alias_three_src, alias_three_dst, template)
{
classes:
"set_expires" expression => strcmp("${exp}","true");
"unset_expires" expression => strcmp("${exp}","false");
"set_alias_one" not => strcmp("${alias_one_src}","Disabled");
"set_alias_two" not => strcmp("${alias_two_src}","Disabled");
"set_alias_three" not => strcmp("${alias_three_src}","Disabled");
"unset_alias_one" expression => strcmp("${alias_one_src}","Disabled");
"unset_alias_two" expression => strcmp("${alias_two_src}","Disabled");
"unset_alias_three" expression => strcmp("${alias_three_src}","Disabled");
"mylock1" expression => "any";
"mylock" expression => strcmp("mylock", "${mylock}");
vars:
mylock1::
Expand Down Expand Up @@ -563,6 +547,22 @@ bundle edit_line set_apache_config_vhost(fqdn, port, root, exp, exp_ttl, alias_o
"finalias_three" string => "# Alias 3 disabled",
policy => "overridable";
classes:
"set_expires" expression => strcmp("${exp}","true");
"unset_expires" expression => strcmp("${exp}","false");
"set_alias_one" not => strcmp("${alias_one_src}","Disabled");
"set_alias_two" not => strcmp("${alias_two_src}","Disabled");
"set_alias_three" not => strcmp("${alias_three_src}","Disabled");
"unset_alias_one" expression => strcmp("${alias_one_src}","Disabled");
"unset_alias_two" expression => strcmp("${alias_two_src}","Disabled");
"unset_alias_three" expression => strcmp("${alias_three_src}","Disabled");
"mylock1" expression => "any";
"mylock" expression => strcmp("mylock", "${mylock}");
insert_lines:
mylock::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@
bundle agent check_apt_settings
{

classes:

# Repositories edition ?
"apt_repositories_edit" not => strcmp("&APT_ADDREPOSITORIES&","false");

# Disable repositories ?
"apt_disablerepositories" not => strcmp("&APT_DISABLEREPOSITORIES&","false");

# InstallRecommends edition ?
"apt_installrecommends_edit" not => strcmp("&APT_INSTALLRECOMMENDS&","dontchange");

# InstallSuggests edition ?
"apt_installsuggests_edit" not => strcmp("&APT_INSTALLSUGGESTS&","dontchange");

vars:

debian_4::
Expand Down Expand Up @@ -123,6 +109,20 @@ bundle agent check_apt_settings
&APT_DISTRIBUTION, APT_DISTRO_AUTODETECT:{apt_distro, apt_autodetect |"apt_distro[&i&]" string => "&if (apt_autodetect)&${apt_detected_distro}&else&&apt_distro&&endif&";
}&

classes:

# Repositories edition ?
"apt_repositories_edit" not => strcmp("&APT_ADDREPOSITORIES&","false");

# Disable repositories ?
"apt_disablerepositories" not => strcmp("&APT_DISABLEREPOSITORIES&","false");

# InstallRecommends edition ?
"apt_installrecommends_edit" not => strcmp("&APT_INSTALLRECOMMENDS&","dontchange");

# InstallSuggests edition ?
"apt_installsuggests_edit" not => strcmp("&APT_INSTALLSUGGESTS&","dontchange");

files:

debian.apt_repositories_edit::
Expand Down
Loading

0 comments on commit 4a6a9af

Please sign in to comment.