Explain in the doc how to create a global dependency
This commit is contained in:
		
					parent
					
						
							
								9184c310f2
							
						
					
				
			
			
				commit
				
					
						3e7c804fe5
					
				
			
		
					 1 changed files with 24 additions and 1 deletions
				
			
		| 
						 | 
					@ -125,7 +125,7 @@ requirements can be added white space separated.
 | 
				
			||||||
--------------------------------------------------------------------------------
 | 
					--------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Above the "require" variable is only set for the command that is 
 | 
					Above the "require" variable is only set for the command that is 
 | 
				
			||||||
immediately following it. Dependencies should allways be declared that way.
 | 
					immediately following it. Dependencies should always be declared that way.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
On line 4 you can see that the instantion of a type "\__link" object needs
 | 
					On line 4 you can see that the instantion of a type "\__link" object needs
 | 
				
			||||||
the object "__file/etc/cdist-configured" to be present, before it can proceed.
 | 
					the object "__file/etc/cdist-configured" to be present, before it can proceed.
 | 
				
			||||||
| 
						 | 
					@ -136,6 +136,29 @@ to be created. The task of cdist is to make sure, that the dependency will be
 | 
				
			||||||
resolved appropriately and thus "\__file/etc/cdist-configured" be created
 | 
					resolved appropriately and thus "\__file/etc/cdist-configured" be created
 | 
				
			||||||
if necessary before "__link" proceeds (or to abort execution with an error).
 | 
					if necessary before "__link" proceeds (or to abort execution with an error).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you really need to make all types depend on a common dependency, you can
 | 
				
			||||||
 | 
					export the "require" variable as well. But then, if you need to add extra
 | 
				
			||||||
 | 
					dependencies to a specific type, you have to make sure that you append these
 | 
				
			||||||
 | 
					to the globally already defined one.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# First of all, update the package index
 | 
				
			||||||
 | 
					__package_update_index
 | 
				
			||||||
 | 
					# Upgrade all the installed packages afterwards
 | 
				
			||||||
 | 
					require="__package_update_index" __package_upgrade_all
 | 
				
			||||||
 | 
					# Create a common dependency for all the next types so that they get to
 | 
				
			||||||
 | 
					# be executed only after the package upgrade has finished
 | 
				
			||||||
 | 
					export require="__package_upgrade_all"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Ensure that lighttpd is installed after we have upgraded all the packages
 | 
				
			||||||
 | 
					__package lighttpd --state present
 | 
				
			||||||
 | 
					# Ensure that munin is installed after lighttpd is present and after all
 | 
				
			||||||
 | 
					# the packages are upgraded
 | 
				
			||||||
 | 
					require="$require __package/lighttpd" __package munin --state present
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
All objects that are created in a type manifest are automatically required
 | 
					All objects that are created in a type manifest are automatically required
 | 
				
			||||||
from the type that is calling them. This is called "autorequirement" in
 | 
					from the type that is calling them. This is called "autorequirement" in
 | 
				
			||||||
cdist jargon.
 | 
					cdist jargon.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue