• R/O
  • SSH

pm_crmgen: Commit

※リポジトリは、https://github.com/linux-ha-japan/pm_crmgen-1.0 へ移行しました。

Pacemaker 1.0 設定編集ツール

Heartbeat-2.1.4 用 hb-cibgen(*) の Pacemaker対応版。
(*) http://sourceforge.jp/projects/linux-ha/releases/?package_id=10290


Commit MetaInfo

Revisionc099f701580570a8f0876845b87260fb3ec6d161 (tree)
Time2011-12-14 14:32:40
AuthorKazunori INOUE <inouekazu@inte...>
CommiterKazunori INOUE

Log Message

Add adduuid file for 'node' command when Heartbeat is used

Change Summary

Incremental Difference

diff -r 1a2323558547 -r c099f7015805 Makefile.am
--- a/Makefile.am Wed Sep 28 14:28:01 2011 +0900
+++ b/Makefile.am Wed Dec 14 14:32:40 2011 +0900
@@ -10,12 +10,13 @@
1010
1111 SPEC = $(PACKAGE_NAME).spec
1212 TARFILE = $(PACKAGE_NAME)-$(VERSION).tar.gz
13-EXTRA_DIST = $(crmgen_SCRIPTS) $(crmgen_DATA) $(SPEC) autogen.sh
13+EXTRA_DIST = $(crmgen_SCRIPTS) $(crmgen_DATA) $(SPEC) autogen.sh adduuid
1414
1515 install-data-hook:
1616 @$(NORMAL_INSTALL)
1717 test -z $(crmgendir) || $(mkdir_p) $(DESTDIR)$(crmgendir)
1818 $(INSTALL_SCRIPT) $(crmgen_SCRIPTS) $(DESTDIR)$(crmgendir)
19+ $(INSTALL_SCRIPT) adduuid $(DESTDIR)$(crmgendir)
1920 $(INSTALL_DATA) $(crmgen_DATA) $(DESTDIR)$(crmgendir)
2021 test -z $(crmgenlinkdir) || $(mkdir_p) $(DESTDIR)$(crmgenlinkdir)
2122 ln -sf $(crmgendir)/$(crmgen_SCRIPTS) $(DESTDIR)$(crmgenlinkdir)/pm_crmgen
diff -r 1a2323558547 -r c099f7015805 adduuid
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/adduuid Wed Dec 14 14:32:40 2011 +0900
@@ -0,0 +1,41 @@
1+#!/bin/sh
2+
3+HOSTCACHE=/var/lib/heartbeat/hostcache
4+usage() {
5+ echo "Usage: $0 <crm-file> [<hostcache (default:$HOSTCACHE)>]"
6+ exit 1
7+}
8+if [ $# -eq 0 ]; then
9+ usage
10+fi
11+if [ ! -f $1 ]; then
12+ usage
13+fi
14+if [ $# -ge 2 ]; then
15+ if [ ! -f $2 ]; then
16+ usage
17+ fi
18+ HOSTCACHE=$2
19+fi
20+
21+SCRIPT=/tmp/`basename $0`.script
22+HCACHE=/tmp/`basename $0`.hcache
23+OUTPUT=`basename ${1%.*}-uuid.crm`
24+
25+sed 's/\([.*\]\)/\\\1/g' $HOSTCACHE >$HCACHE || { rc=$?;rm $HCACHE 2>/dev/null;exit $rc; }
26+
27+echo 'set -e' >$SCRIPT &&
28+awk -v o=$OUTPUT '{if(NF==3)printf("sed \047s/^[[:blank:]]*node[[:blank:]]\\+%s\\([[:blank:]:]\\)/node $id=\"%s\" %s\\1/\047 -i %s\n",$1,$2,$1,o);}' $HCACHE >>$SCRIPT &&
29+awk -v o=$OUTPUT '{if(NF==3)printf("sed \047s/^[[:blank:]]*node[[:blank:]]\\+%s$/node $id=\"%s\" %s/\047 -i %s\n",$1,$2,$1,o);}' $HCACHE >>$SCRIPT &&
30+cp -p $1 $OUTPUT && /bin/sh $SCRIPT; rc=$?
31+rm $SCRIPT $HCACHE 2>/dev/null
32+
33+if [ $rc -eq 0 ]; then
34+ cnt=$(egrep '^[[:blank:]]*node[[:blank:]]' $OUTPUT | grep -cv '[[:blank:]]$id="' 2>/dev/null)
35+ if [ $cnt -gt 0 ]; then
36+ no=$(egrep -n '^[[:blank:]]*node[[:blank:]]' $OUTPUT | grep -v '[[:blank:]]$id="' | perl -pe 's/:.*\n/,/')
37+ echo "ノード名に対応するuuidが存在しません。($OUTPUTの${no%,}行目を確認してください。)"
38+ rc=1
39+ fi
40+fi
41+exit $rc
diff -r 1a2323558547 -r c099f7015805 pm_crmgen.spec.in
--- a/pm_crmgen.spec.in Wed Sep 28 14:28:01 2011 +0900
+++ b/pm_crmgen.spec.in Wed Dec 14 14:32:40 2011 +0900
@@ -83,4 +83,5 @@
8383 %dir %{gendir}
8484 %{gendir}/pm_crmgen.py
8585 %{gendir}/pm_crmgen_env.xls
86+%{gendir}/adduuid
8687 %{prefix}/bin/pm_crmgen
Show on old repository browser