| 
									
										
										
										
											2011-03-09 10:16:46 +01:00
										 |  |  | cdist-explorer(7) | 
					
						
							|  |  |  | ================= | 
					
						
							|  |  |  | Nico Schottelius <nico-cdist--@--schottelius.org> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | NAME | 
					
						
							|  |  |  | ---- | 
					
						
							|  |  |  | cdist-explorer - Explore the target systems | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | DESCRIPTION | 
					
						
							|  |  |  | ----------- | 
					
						
							|  |  |  | Explorer are small shell scripts, which will be executed on the target | 
					
						
							|  |  |  | host. The aim of the explorer is to give hints to types on how to act on the | 
					
						
							|  |  |  | target system. An explorer outputs the result to stdout, which is usually | 
					
						
							|  |  |  | a one liner, but may be empty or multi line especially in the case of | 
					
						
							|  |  |  | type explorers. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | There are general explorers, which are run in an early stage, and | 
					
						
							|  |  |  | type explorers. Both work almost exactly the same way, with the difference | 
					
						
							|  |  |  | that the values of the general explorers are stored in a general location and | 
					
						
							|  |  |  | the type specific below the object. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Explorers can reuse other explorers on the target system by calling  | 
					
						
							|  |  |  | $__explorer/<explorer_name> (general and type explorer) or | 
					
						
							|  |  |  | $__type_explorer/<explorer name> (type explorer). | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | In case of significant errors, the explorer may exit non-zero and return an | 
					
						
							| 
									
										
										
										
											2011-09-27 01:21:16 +02:00
										 |  |  | error message on stderr, which will cause cdist to abort. | 
					
						
							| 
									
										
										
										
											2011-03-09 10:16:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-09 10:17:43 +01:00
										 |  |  | You can also use stderr for debugging purposes while developing a new | 
					
						
							|  |  |  | explorer. | 
					
						
							| 
									
										
										
										
											2011-03-09 10:16:46 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | EXAMPLES | 
					
						
							|  |  |  | -------- | 
					
						
							|  |  |  | A very simple explorer may look like this: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | -------------------------------------------------------------------------------- | 
					
						
							|  |  |  | hostname | 
					
						
							|  |  |  | -------------------------------------------------------------------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-17 23:53:58 +01:00
										 |  |  | Which is in practise the ***hostname*** explorer. | 
					
						
							| 
									
										
										
										
											2011-03-09 10:16:46 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | A type explorer, which could check for the status of a package may look like this: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | -------------------------------------------------------------------------------- | 
					
						
							|  |  |  | if [ -f "$__object/parameter/name" ]; then | 
					
						
							|  |  |  |    name="$(cat "$__object/parameter/name")" | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  |    name="$__object_id" | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Except dpkg failing, if package is not known / installed | 
					
						
							|  |  |  | dpkg -s "$name" 2>/dev/null || exit 0 | 
					
						
							|  |  |  | -------------------------------------------------------------------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | SEE ALSO | 
					
						
							|  |  |  | -------- | 
					
						
							| 
									
										
										
										
											2012-01-11 11:52:02 +01:00
										 |  |  | - cdist(1) | 
					
						
							| 
									
										
										
										
											2011-03-09 10:16:46 +01:00
										 |  |  | - cdist-reference(7) | 
					
						
							|  |  |  | - cdist-stages(7) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | COPYING | 
					
						
							|  |  |  | ------- | 
					
						
							| 
									
										
										
										
											2012-01-17 23:53:58 +01:00
										 |  |  | Copyright \(C) 2010-2012 Nico Schottelius. Free use of this software is | 
					
						
							| 
									
										
										
										
											2011-03-09 10:16:46 +01:00
										 |  |  | granted under the terms of the GNU General Public License version 3 (GPLv3). |