Passing pass as parameter to celery task
This commit is contained in:
parent
085786907c
commit
d96d2907bc
2 changed files with 9 additions and 8 deletions
|
@ -54,15 +54,15 @@ def create_vm_task(self, vm_template_id, user, specs, template,
|
|||
id=billing_address_id).first()
|
||||
customer = StripeCustomer.objects.filter(id=stripe_customer_id).first()
|
||||
# Create OpenNebulaManager
|
||||
if self.request.user is None:
|
||||
if 'pass' in user:
|
||||
manager = OpenNebulaManager(email=user.get('email'),
|
||||
password=user.get('pass'))
|
||||
logger.debug("Using user {user} to create VM".format(
|
||||
user=user.get('email')))
|
||||
else:
|
||||
manager = OpenNebulaManager(email=settings.OPENNEBULA_USERNAME,
|
||||
password=settings.OPENNEBULA_PASSWORD)
|
||||
logger.debug("Using OpenNebula admin user to create VM")
|
||||
else:
|
||||
manager = OpenNebulaManager(email=self.request.user.email,
|
||||
password=self.request.user.password)
|
||||
logger.debug("Using user {user} to create VM".format(
|
||||
user=self.request.user.email))
|
||||
|
||||
vm_id = manager.create_vm(
|
||||
template_id=vm_template_id,
|
||||
|
|
|
@ -574,7 +574,7 @@ class PaymentVMView(LoginRequiredMixin, FormView):
|
|||
return self.form_invalid(form)
|
||||
|
||||
|
||||
class OrdersHostingDetailView(PermissionRequiredMixin, LoginRequiredMixin,
|
||||
class OrdersHostingDetailView(LoginRequiredMixin,
|
||||
DetailView):
|
||||
template_name = "hosting/order_detail.html"
|
||||
context_object_name = "order"
|
||||
|
@ -693,7 +693,8 @@ class OrdersHostingDetailView(PermissionRequiredMixin, LoginRequiredMixin,
|
|||
reverse('hosting:payment') + '#payment_error')
|
||||
user = {
|
||||
'name': self.request.user.name,
|
||||
'email': self.request.user.email
|
||||
'email': self.request.user.email,
|
||||
'pass': self.request.user.password
|
||||
}
|
||||
create_vm_task.delay(vm_template_id, user, specs, template,
|
||||
stripe_customer_id, billing_address_data,
|
||||
|
|
Loading…
Reference in a new issue