| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  | module Connectors | 
					
						
							|  |  |  |   class Stack < Base | 
					
						
							|  |  |  |     include Helpers::InsertCommand, | 
					
						
							|  |  |  |       Helpers::ShowCommand, | 
					
						
							|  |  |  |       Helpers::ListCommand, | 
					
						
							| 
									
										
										
										
											2015-07-14 16:51:40 +03:00
										 |  |  |       Helpers::DeleteCommand, | 
					
						
							|  |  |  |       Helpers::UpdateCommand | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def initialize(db) | 
					
						
							|  |  |  |       self.collection = db.collection('stacks') | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-22 19:29:42 +03:00
										 |  |  |     def stacks(options={}) | 
					
						
							|  |  |  |       list(options) | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-04 12:36:10 +03:00
										 |  |  |     def set_stack_run_list id, run_list | 
					
						
							|  |  |  |       collection.update({"_id" => id}, {"$set" => {"run_list" => run_list}}) | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  |     private | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def model_from_bson(bson) | 
					
						
							|  |  |  |       provider = bson['provider'] | 
					
						
							| 
									
										
										
										
											2015-03-06 12:20:30 +03:00
										 |  |  |       Devops::Model::StackFactory.get_class(provider).build_from_bson(bson) | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |