| 
														
															@@ -8,20 +8,34 @@ namespace :sample_data do 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     File.join(File.dirname(File.expand_path(__FILE__)), 'sample_data.yaml') 
														 | 
														
														 | 
														
															     File.join(File.dirname(File.expand_path(__FILE__)), 'sample_data.yaml') 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   ) 
														 | 
														
														 | 
														
															   ) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   Neo4j::Session.open(:server_db, 'http://localhost:7474') 
														 | 
														
														 | 
														
															   Neo4j::Session.open(:server_db, 'http://localhost:7474') 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-   
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   task :accounts do 
														 | 
														
														 | 
														
															   task :accounts do 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     puts 'loading accounts' 
														 | 
														
														 | 
														
															     puts 'loading accounts' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      sample_data['accounts'].each do |account|  
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	next unless AwsAccount.where(name: account[:name]).empty? 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	acct = AwsAccount.new( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	  name:       account[:name], 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	  account_id: 90000+rand(20), 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	  user_id:    account[:name], 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	  key_md5:    Digest:: MD5.hexdigest(account[:name]), 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	  secret_md5: Digest:: MD5.hexdigest(account[:name]) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	acct.save 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    sample_data['accounts'].each do |account| 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    	next unless AwsAccount.where(name: account[:name]).empty? 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    	acct = AwsAccount.new( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    	  name:       account[:name], 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    	  account_id: 90000+rand(20), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    	  user_id:    account[:name], 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    	  key_md5:    Digest:: MD5.hexdigest(account[:name]), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    	  secret_md5: Digest:: MD5.hexdigest(account[:name]) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    	) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    acct.save 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    end 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  end 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  task :regions do 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    puts 'loading regions' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    sample_data['regions'].each do |reg| 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    	next unless Region.where(region: reg.keys.first).empty? 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      r = Region.new(region: reg.keys.first) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      r.save 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      reg[reg.keys.first].each do |az| 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        a = Az.new(az: az) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        a.save 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        AzRegion.create(from_node: a, to_node: Region.where(region: reg.keys.first).first) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       end 
														 | 
														
														 | 
														
															       end 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    end 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   end 
														 | 
														
														 | 
														
															   end 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															   task :vpcs do 
														 | 
														
														 | 
														
															   task :vpcs do 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -29,11 +43,6 @@ namespace :sample_data do 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     j = NeoInfra::Vpcs.new 
														 | 
														
														 | 
														
															     j = NeoInfra::Vpcs.new 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   end 
														 | 
														
														 | 
														
															   end 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  task :regions do 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    puts 'loading regions' 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    j = NeoInfra::Aws.new 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  end 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   task :buckets do 
														 | 
														
														 | 
														
															   task :buckets do 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     puts 'loading buckets' 
														 | 
														
														 | 
														
															     puts 'loading buckets' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     j = NeoInfra::Aws.new 
														 | 
														
														 | 
														
															     j = NeoInfra::Aws.new 
														 |