I sent this patch earlier but there were some concerns if
bucket creation is required or not. After running e2e test
(+deleting S3 buckets) I'm sure we don't need this code.
Show replies by date
From: Jan Provaznik <jprovazn(a)redhat.com>
This code is really not used anymore with new imagefactory.
Imagefactory handles bucket creation itself.
---
src/app/models/provider_account_observer.rb | 24 ------------------------
1 files changed, 0 insertions(+), 24 deletions(-)
diff --git a/src/app/models/provider_account_observer.rb
b/src/app/models/provider_account_observer.rb
index e4b8288..087e96c 100644
--- a/src/app/models/provider_account_observer.rb
+++ b/src/app/models/provider_account_observer.rb
@@ -1,31 +1,7 @@
class ProviderAccountObserver < ActiveRecord::Observer
def after_create(account)
- # FIXME: new boxgrinder doesn't create bucket for amis automatically,
- # for now we create bucket from conductor
- # remove this hotfix when fixed on boxgrinder side
- if account.provider.provider_type_id ==
ProviderType.find_by_codename("ec2").id
- create_bucket(account)
- end
account.populate_hardware_profiles
end
-
- private
-
- def create_bucket(account)
- client = account.connect
- bucket_name =
"#{account.credentials_hash['account_id']}-imagefactory-amis"
- # TODO (jprovazn): getting particular bucket takes long time (core fetches all
- # buckets from provider), so we call directly create_bucket, if bucket exists,
- # exception should be thrown (actually existing bucket is returned - this
- # bug should be fixed soon)
- #client.create_bucket(:name => bucket_name) unless client.bucket(bucket_name)
- begin
- client.create_bucket('id' => bucket_name)
- rescue Exception => e
- Rails.logger.error e.message
- Rails.logger.error e.backtrace.join("\n ")
- end
- end
end
ProviderAccountObserver.instance
--
1.7.6