Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 56ac82f2ed4babb8940305411591234698ca212c
Parent: 97d6e7595022a3bd9075740c879c75ddb8161362
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Mar 28 12:22:24 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Mar 28 12:22:24 2011 +0200
rgmanager: Fix problems in generated XML config file for tomcat5
Add support for XML files to resource agents.
Resolves: rhbz#637802
---
rgmanager/src/resources/tomcat-5.sh | 4 ++--
rgmanager/src/resources/utils/config-utils.sh | 23 ++++++++++++++++++++++-
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/rgmanager/src/resources/tomcat-5.sh b/rgmanager/src/resources/tomcat-5.sh
index 52d6f39..2d6215f 100755
--- a/rgmanager/src/resources/tomcat-5.sh
+++ b/rgmanager/src/resources/tomcat-5.sh
@@ -146,10 +146,10 @@ generate_config_file()
clog_generate_config $CLOG_INIT "$original_file" "$generated_file"
-# generate_configTemplate "$generated_file" "$original_file"
+ generate_configTemplateXML "$generated_file" "$original_file"
$(dirname $0)/utils/tomcat-parse-config.pl $ip_addresses < "$original_file"
>> "$generated_file"
- sha1_addToFile "$generated_file"
+ sha1_addToFileXML "$generated_file"
clog_generate_config $CLOG_SUCCEED "$original_file"
"$generated_file"
return 0;
diff --git a/rgmanager/src/resources/utils/config-utils.sh
b/rgmanager/src/resources/utils/config-utils.sh
old mode 100644
new mode 100755
index c54b266..d339479
--- a/rgmanager/src/resources/utils/config-utils.sh
+++ b/rgmanager/src/resources/utils/config-utils.sh
@@ -40,12 +40,33 @@ generate_configTemplate()
EOT
}
+generate_configTemplateXML()
+{
+ cat > "$1" << EOT
+<!--
+ "$1" was created from the "$2"
+
+ This template configuration was automatically generated, and will be
+ automatically regenerated if removed. Once this file has been altered,
+ automatic re-generation will stop. Remember to copy this file to all
+ other cluster members after making changes, or your service will not
+ operate correctly.
+-->
+EOT
+}
+
sha1_addToFile()
{
declare sha1line="# rgmanager-sha1 $(sha1sum "$1")"
echo $sha1line >> "$1"
}
+sha1_addToFileXML()
+{
+ declare sha1line="<!--# rgmanager-sha1 $(sha1sum
"$1")-->"
+ echo $sha1line >> "$1"
+}
+
sha1_verify()
{
declare sha1_new sha1_old
@@ -54,7 +75,7 @@ sha1_verify()
ocf_log debug "Checking: SHA1 checksum of config file $oldFile"
sha1_new=`cat "$oldFile" | grep -v "# rgmanager-sha1" | sha1sum |
sed 's/^\([a-z0-9]\+\) .*$/\1/'`
- sha1_old=`tail -n 1 "$oldFile" | sed 's/^# rgmanager-sha1 \(.*\)$/\1/'
| sed 's/^\([a-z0-9]\+\) .*$/\1/'`
+ sha1_old=`tail -n 1 "$oldFile" | sed 's/^\(<!--\)\?# rgmanager-sha1
\(.*\)$/\2/' | sed 's/^\([a-z0-9]\+\) .*$/\1/'`
if [ $sha1_new = $sha1_old ]; then
ocf_log debug "Checking: SHA1 checksum > succeed"