Browse Source

load s3 sample data

Chris Mague 7 years ago
parent
commit
a143c8c418
2 changed files with 20 additions and 1 deletions
  1. 10 1
      tasks/sample_data.rake
  2. 10 0
      tasks/sample_data.yaml

+ 10 - 1
tasks/sample_data.rake

@@ -74,7 +74,16 @@ namespace :sample_data do
 
   task :buckets do
     puts 'loading buckets'
-    j = NeoInfra::Aws.new
+    sample_data['buckets'].each do |b|
+    	next unless Bucket.where(name: b['name']).empty?
+      s = Bucket.new(
+        name: b['name'],
+        size: b['size'],
+      )
+      s.save
+      BucketRegion.create(from_node: s, to_node: Region.where(region: b['region']).first)
+      BucketAccount.create(from_node: s, to_node: AwsAccount.where(name: b['account']).first)
+    end
   end
 
   task :ssh_keys do

+ 10 - 0
tasks/sample_data.yaml

@@ -22,6 +22,16 @@ ssh_keys:
   - name: test-key
     account: testing
 
+buckets:
+  - name: testingbucket
+    size: 10000000
+    account: testing
+    region: us-west-1
+  - name: productionbucket
+    size: 90999000000
+    account: production
+    region: us-east-1
+
 vpcs:
   - vpc_id: vpc-21121
     name: prod-vpc-1