| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  | require "fog" | 
					
						
							| 
									
										
										
										
											2015-04-16 17:54:40 +03:00
										 |  |  | Dir["providers/exceptions/*.rb"].each {|file| require file } | 
					
						
							| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 15:11:47 +04:00
										 |  |  | module Provider | 
					
						
							|  |  |  |   class BaseProvider | 
					
						
							| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-20 15:08:42 +03:00
										 |  |  |     attr_accessor :ssh_key, :certificate_path, :connection_options, :run_list | 
					
						
							| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-02 12:41:29 +03:00
										 |  |  |     def create_default_chef_node_name s | 
					
						
							|  |  |  |       "#{self.ssh_key}-#{s.project}-#{s.deploy_env}-#{Time.now.to_i}" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def create_default_stack_name s | 
					
						
							|  |  |  |       "stack_#{self.ssh_key}-#{s.project}-#{s.deploy_env}-#{Time.now.to_i}" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 15:11:47 +04:00
										 |  |  |     protected | 
					
						
							|  |  |  |     def connection_compute options | 
					
						
							|  |  |  |       Fog::Compute.new( options ) | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 15:11:47 +04:00
										 |  |  |     def connection_network options | 
					
						
							|  |  |  |       Fog::Network.new( options ) | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 15:11:47 +04:00
										 |  |  |     def configured? | 
					
						
							|  |  |  |       !(empty_param?(self.ssh_key) or empty_param?(self.certificate_path)) | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 15:11:47 +04:00
										 |  |  |     def empty_param? param | 
					
						
							|  |  |  |       param.nil? or param.empty? | 
					
						
							| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2014-06-18 15:11:47 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-03 18:01:50 +03:00
										 |  |  |     def set_tags instance_id, tags | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def unset_tags instance_id, tags | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-16 14:07:46 +03:00
										 |  |  |     def set_server_tags server | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-16 17:13:42 +03:00
										 |  |  |     def set_stack_tags stack, out="" | 
					
						
							| 
									
										
										
										
											2015-09-16 14:07:46 +03:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-08 15:34:26 +04:00
										 |  |  |   end | 
					
						
							|  |  |  | end |