forked from ungleich-public/cdist
		
	Merge pull request #747 from 4nd3r/__check_messages
new type: __check_messages
This commit is contained in:
		
				commit
				
					
						6e56de4580
					
				
			
		
					 3 changed files with 81 additions and 0 deletions
				
			
		
							
								
								
									
										27
									
								
								cdist/conf/type/__check_messages/gencode-remote
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										27
									
								
								cdist/conf/type/__check_messages/gencode-remote
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
#!/bin/sh -e
 | 
			
		||||
#
 | 
			
		||||
# 2019 Ander Punnar (ander-at-kvlt-dot-ee)
 | 
			
		||||
#
 | 
			
		||||
# This file is part of cdist.
 | 
			
		||||
#
 | 
			
		||||
# cdist is free software: you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
# cdist is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
if grep -Eq \
 | 
			
		||||
    "$( cat "$__object/parameter/pattern" )" \
 | 
			
		||||
    "$__messages_in"
 | 
			
		||||
then
 | 
			
		||||
    cat "$__object/parameter/execute" \
 | 
			
		||||
        | tee "$__messages_out"
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										52
									
								
								cdist/conf/type/__check_messages/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								cdist/conf/type/__check_messages/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,52 @@
 | 
			
		|||
cdist-type__check_messages(7)
 | 
			
		||||
=============================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__check_messages - Check messages for pattern and execute command on match.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
Check messages for pattern and execute command on match.
 | 
			
		||||
 | 
			
		||||
This type is useful if you chain together multiple related types using
 | 
			
		||||
dependencies and want to restart service if at least one type changes
 | 
			
		||||
something.
 | 
			
		||||
 | 
			
		||||
For more information about messages see `cdist messaging <cdist-messaging.html>`_.
 | 
			
		||||
 | 
			
		||||
For more information about dependencies and execution order see
 | 
			
		||||
`cdist manifest <cdist-manifest.html#dependencies>`_ documentation.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
pattern
 | 
			
		||||
   Extended regular expression pattern for search (passed to ``grep -E``).
 | 
			
		||||
 | 
			
		||||
execute
 | 
			
		||||
   Command to execute on pattern match.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    __check_messages munin \
 | 
			
		||||
        --pattern '^__(file|link|line)/etc/munin/' \
 | 
			
		||||
        --execute 'service munin-node restart'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Ander Punnar <ander-at-kvlt-dot-ee>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2019 Ander Punnar. You can redistribute it
 | 
			
		||||
and/or modify it under the terms of the GNU General Public License as
 | 
			
		||||
published by the Free Software Foundation, either version 3 of the
 | 
			
		||||
License, or (at your option) any later version.
 | 
			
		||||
							
								
								
									
										2
									
								
								cdist/conf/type/__check_messages/parameter/required
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								cdist/conf/type/__check_messages/parameter/required
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
pattern
 | 
			
		||||
execute
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue