Revision 48eb45fc
Added by Alexis Mousset about 7 years ago
4_advanced_usage/60_server_event_hooks.txt | ||
---|---|---|
=== Server Event Hooks
|
||
|
||
Rudder 4.1 introducs the possibility to execute files (hooks), typically scripts,
|
||
when some predefined event occures on Rudder.
|
||
|
||
include::../hooks.asciidoc[]
|
||
|
Makefile | ||
---|---|---|
## Rudder User Documentation Makefile
|
||
|
||
.PHONY: all clean view ncf-doc man links
|
||
.PHONY: all clean view man links hooks.asciidoc generic-methods.asciidoc
|
||
|
||
BASENAME = rudder-doc
|
||
SOURCES = $(BASENAME).txt
|
||
... | ... | |
ncf-doc: generic-methods.asciidoc
|
||
links: xsl/links.xsl
|
||
|
||
epub/$(BASENAME).epub: man ncf-doc $(SOURCES)
|
||
content: man ncf-doc hooks.asciidoc $(SOURCES)
|
||
|
||
epub/$(BASENAME).epub: content
|
||
mkdir -p html
|
||
$(ASCIIDOCTOEPUB) $(SOURCES)
|
||
mv $(BASENAME).epub html/
|
||
|
||
html/$(BASENAME).pdf: man ncf-doc $(SOURCES)
|
||
html/$(BASENAME).pdf: content
|
||
mkdir -p html
|
||
$(ASCIIDOCTODOCBOOK) --backend docbook $(SOURCES)
|
||
$(DOCBOOK2PDF) $(BASENAME).xml
|
||
... | ... | |
|
||
html/rudder.8: man
|
||
mkdir -p html
|
||
cp rudder-command/man/rudder.8 html/
|
||
cp rudder-agent-repo/man/rudder.8 html/
|
||
|
||
rudder-command:
|
||
git clone https://github.com/Normation/rudder-agent.git rudder-command
|
||
rudder-agent-repo:
|
||
git clone https://github.com/Normation/rudder-agent.git rudder-agent-repo
|
||
|
||
man: rudder-command
|
||
cd rudder-command && git checkout branches/rudder/$(RUDDER_VERSION) 2>/dev/null || git checkout master
|
||
cd rudder-command/man && make rudder.8
|
||
man: rudder-agent-repo
|
||
cd rudder-agent-repo && git checkout branches/rudder/$(RUDDER_VERSION) 2>/dev/null || git checkout master
|
||
cd rudder-agent-repo/man && make rudder.8
|
||
# Adapt title level to be insertable in the manual
|
||
sed 's/^=/====/' -i rudder-command/man/rudder.asciidoc
|
||
sed 's/^=/====/' -i rudder-agent-repo/man/rudder.asciidoc
|
||
# Avoid going too far (the maximum level is 5)
|
||
sed 's/^======/=====/' -i rudder-command/man/rudder.asciidoc
|
||
sed 's/^======/=====/' -i rudder-agent-repo/man/rudder.asciidoc
|
||
|
||
rudder-repo:
|
||
git clone https://github.com/fanf/rudder.git rudder-repo
|
||
|
||
hooks.asciidoc: rudder-repo
|
||
cd rudder-repo && git checkout bug_10200/change_readme_layout_for_hooks 2>/dev/null || git checkout master
|
||
cp rudder-repo/rudder-core/src/main/resources/hooks.d/readme.adoc hooks.asciidoc
|
||
echo "" >> hooks.asciidoc
|
||
for hook in `ls rudder-repo/rudder-core/src/main/resources/hooks.d/*/readme.adoc`; do \
|
||
echo "" >> hooks.asciidoc ; \
|
||
sed 's/^=/=/' $$hook >> hooks.asciidoc ; \
|
||
done
|
||
# Adapt title level to be insertable in the manual
|
||
sed 's/^=/===/' -i hooks.asciidoc
|
||
|
||
ncf:
|
||
git clone https://github.com/Normation/ncf.git
|
||
ncf-repo:
|
||
git clone https://github.com/Normation/ncf.git ncf-repo
|
||
|
||
generic-methods.asciidoc: ncf
|
||
cd ncf && git checkout $(NCF_VERSION) && git pull
|
||
cp tools/ncf_doc_rudder.py ncf/tools/
|
||
./ncf/tools/ncf_doc_rudder.py
|
||
generic-methods.asciidoc: ncf-repo
|
||
cd ncf-repo && git checkout $(NCF_VERSION) && git pull
|
||
cp tools/ncf_doc_rudder.py ncf-repo/tools/
|
||
./ncf-repo/tools/ncf_doc_rudder.py
|
||
# Remove language setting on code field (#9621)
|
||
sed -i 's/```.*/```/' generic_methods.md
|
||
pandoc -t asciidoc -f markdown generic_methods.md > generic_methods.asciidoc
|
||
... | ... | |
xsl/links.xsl:
|
||
./tools/generate_dynamic_content.py $(RUDDER_VERSION) xsl
|
||
|
||
webhelp/index.html: links man ncf-doc $(SOURCES)
|
||
webhelp/index.html: links content
|
||
mkdir -p webhelp
|
||
$(ASCIIDOC) --doctype=book --backend docbook $(SOURCES)
|
||
xsltproc --xinclude --output xincluded-profiled.xml \
|
||
... | ... | |
sed -ri 's/(<div class="titlepage">).*/\1<\/div>/' webhelp/index.html
|
||
sed -i '/<div class="titlepage">/ r xsl/index.html' webhelp/index.html
|
||
|
||
webhelp-localsearch/index.html: links man ncf-doc $(SOURCES)
|
||
webhelp-localsearch/index.html: links content
|
||
mkdir -p webhelp-localsearch
|
||
$(ASCIIDOC) --doctype=book --backend docbook $(SOURCES)
|
||
xsltproc --xinclude --output xincluded-profiled.xml \
|
||
... | ... | |
com.nexwave.nquindexer.IndexerMain
|
||
cp -r template/search/* webhelp-localsearch/search
|
||
|
||
html/$(BASENAME).html: man ncf-doc $(SOURCES)
|
||
html/$(BASENAME).html: content
|
||
mkdir -p html
|
||
$(ASCIIDOCTOHTML) --out-file $@ $(SOURCES)
|
||
cp -R style/html/* images html/
|
||
... | ... | |
mkdir -p html
|
||
$(ASCIIDOCTOHTML) --out-file $@ $?
|
||
|
||
slides.html: man $(SOURCES)
|
||
$(ASCIIDOC) -a theme=volnitsky --out-file slides.html --backend slidy $(SOURCES)
|
||
|
||
quicktest:
|
||
# Disable link tests on master beacause it is normal some links do not exist yet
|
||
[ "`git rev-parse --abbrev-ref HEAD`" = "master" ] || ./tests/check_title_syntax.sh
|
||
... | ... | |
## WARNING: at cleanup, delete png files that were produced by output only !
|
||
|
||
clean:
|
||
rm -rf rudder-doc.xml *.pdf *.html *.png *.svg temp html epub webhelp webhelp-localsearch xincluded-profiled.xml $(BASENAME).xml rudder-command extensions ncf generic_methods.{asciidoc,md} xsl/links.xsl xsl/index.html
|
||
rm -rf rudder-doc.xml *.pdf *.html *.png *.svg temp html epub webhelp webhelp-localsearch xincluded-profiled.xml $(BASENAME).xml rudder-agent-repo rudder-repo extensions ncf generic_methods.{asciidoc,md} hooks.asciidoc xsl/links.xsl xsl/index.html
|
||
|
||
view: all
|
||
$(SEE) $(TARGETS)
|
Also available in: Unified diff
Fixes #10201: Use readme from hooks to build rudder doc chapter on them