forked from ungleich-public/cdist
		
	++triggers
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								b06122f3a1
							
						
					
				
			
			
				commit
				
					
						fb630437db
					
				
			
		
					 1 changed files with 49 additions and 0 deletions
				
			
		
							
								
								
									
										49
									
								
								docs/dev/logs/2013-01-20.triggers
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								docs/dev/logs/2013-01-20.triggers
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,49 @@
 | 
				
			||||||
 | 
					An alternative / complementary approach to notifications: triggers (or actions?)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					A type may support various actions by creating files in its subdirectory
 | 
				
			||||||
 | 
					"actions". Other types can trigger an action of a different type or object
 | 
				
			||||||
 | 
					by calling them (indirectly?):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if grep "__file/etc/nginx/conf.d/.*:copy" "$__notifications"; then
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Call action from a type
 | 
				
			||||||
 | 
					    cdist trigger __nginx/reload
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Not sure whether this approach (calling "actions" of other types) is sane,
 | 
				
			||||||
 | 
					as nginx should probably better know if it should be restarted "itself".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Alternate approach:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__nginx_vhost www.some-domain.ch --custom << eof
 | 
				
			||||||
 | 
					some custom code for __nginx_vhost inclusion
 | 
				
			||||||
 | 
					eof
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__nginx_vhost:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    manifest:
 | 
				
			||||||
 | 
					        # __nginx_vhost requires __nginx: creates directories
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        require"$__object_name" __nginx --require-only
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        # Do WE or __file ... depend on nginx?
 | 
				
			||||||
 | 
					        cdist require __nginx
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Create file that contains the giving code
 | 
				
			||||||
 | 
					        __file /etc/nginx/conf.d/www.some-domain.ch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        require="__nginx" __file /etc/nginx/conf.d/www.some-domain.ch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__nginx:
 | 
				
			||||||
 | 
					    manifest:
 | 
				
			||||||
 | 
					        __package nginx --state present
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        __file some-custom-files
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    gencode-remote:
 | 
				
			||||||
 | 
					        if first_install or file changed:
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue