forked from ungleich-public/cdist
		
	document boolean parameters
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								0760ff3c94
							
						
					
				
			
			
				commit
				
					
						79dedb5bb5
					
				
			
		
					 2 changed files with 39 additions and 9 deletions
				
			
		| 
						 | 
					@ -101,12 +101,15 @@ conf/type/<name>/gencode-local::
 | 
				
			||||||
conf/type/<name>/gencode-remote::
 | 
					conf/type/<name>/gencode-remote::
 | 
				
			||||||
    Used to generate code to be executed on the client.
 | 
					    Used to generate code to be executed on the client.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
conf/type/<name>/parameters/required::
 | 
					conf/type/<name>/parameter/required::
 | 
				
			||||||
    Parameters required by type, \n seperated list.
 | 
					    Parameters required by type, \n seperated list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
conf/type/<name>/parameters/optional::
 | 
					conf/type/<name>/parameter/optional::
 | 
				
			||||||
    Parameters optionally accepted by type, \n seperated list.
 | 
					    Parameters optionally accepted by type, \n seperated list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					conf/type/<name>/parameter/boolean::
 | 
				
			||||||
 | 
					   Boolean parameters accepted by type, \n seperated list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
conf/type/<name>/explorer::
 | 
					conf/type/<name>/explorer::
 | 
				
			||||||
    Location of the type specific explorers.
 | 
					    Location of the type specific explorers.
 | 
				
			||||||
    This directory is referenced by the variable __type_explorer (see below).
 | 
					    This directory is referenced by the variable __type_explorer (see below).
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,15 +72,42 @@ To begin a new type, just create the directory **conf/type/__NAME**.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEFINING PARAMETERS
 | 
					DEFINING PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
Every type consists of optional and required parameters, which must
 | 
					Every type consists of required, optional and boolean parameters, which must
 | 
				
			||||||
be created in a newline seperated file in ***parameters/required*** and
 | 
					be created in a newline seperated file in ***parameter/required***,
 | 
				
			||||||
***parameters/optional***. If either or both missing, the type will have
 | 
					***parameter/optional*** and ***parameter/boolean***. If either is missing,
 | 
				
			||||||
no required, no optional or no parameters at all.
 | 
					the type will have no required, no optional, no boolean or no parameters at
 | 
				
			||||||
 | 
					all.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Example:
 | 
					Example:
 | 
				
			||||||
--------------------------------------------------------------------------------
 | 
					--------------------------------------------------------------------------------
 | 
				
			||||||
echo servername >> conf/type/__nginx_vhost/parameter/required
 | 
					echo servername >> conf/type/__nginx_vhost/parameter/required
 | 
				
			||||||
echo logdirectory >> conf/type/__nginx_vhost/parameter/optional
 | 
					echo logdirectory >> conf/type/__nginx_vhost/parameter/optional
 | 
				
			||||||
 | 
					echo use_ssl >> conf/type/__nginx_vhost/parameter/boolean
 | 
				
			||||||
 | 
					--------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					USING PARAMETERS
 | 
				
			||||||
 | 
					----------------
 | 
				
			||||||
 | 
					The parameters given to a type can be accessed and used in all type scripts
 | 
				
			||||||
 | 
					(e.g manifest, gencode-*, explorer/*). Note that boolean parameters are
 | 
				
			||||||
 | 
					represented by file existence. File exists -> True,
 | 
				
			||||||
 | 
					file does not exist -> False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Example: (e.g. in conf/type/__nginx_vhost/manifest)
 | 
				
			||||||
 | 
					--------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					# required parameter
 | 
				
			||||||
 | 
					servername="$(cat "$__object/parameter/servername")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# optional parameter
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/logdirectory" ]; then
 | 
				
			||||||
 | 
					   logdirectory="$(cat "$__object/parameter/logdirectory")"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# boolean parameter
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/use_ssl" ]; then
 | 
				
			||||||
 | 
					   # file exists -> True
 | 
				
			||||||
 | 
					   # do some fancy ssl stuff
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
--------------------------------------------------------------------------------
 | 
					--------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue