Fixed ssh key error, Now an existing user is not ask for his credit card again
This commit is contained in:
parent
5861bec4a6
commit
1f10f04a9d
7 changed files with 155 additions and 17 deletions
|
|
@ -91,6 +91,18 @@ class VirtualMachineType(models.Model):
|
|||
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_vm_templates(self, user):
|
||||
opennebula_client = OpenNebulaManager(
|
||||
email=user.email,
|
||||
password=user.password,
|
||||
)
|
||||
|
||||
templates = opennebula_client.get_vm_templates()
|
||||
for template in templates:
|
||||
print(OpenNebulaManager.parse_vm(template))
|
||||
return templates
|
||||
|
||||
|
||||
class VirtualMachinePlan(AssignPermissionsMixin, models.Model):
|
||||
|
||||
|
|
@ -196,7 +208,7 @@ class VirtualMachinePlan(AssignPermissionsMixin, models.Model):
|
|||
# Get opennebula client
|
||||
opennebula_client = OpenNebulaManager(
|
||||
email=user.email,
|
||||
password=user.password[:20],
|
||||
password=user.password,
|
||||
)
|
||||
|
||||
# Get vm given the id
|
||||
|
|
@ -216,7 +228,7 @@ class VirtualMachinePlan(AssignPermissionsMixin, models.Model):
|
|||
# Get opennebula client
|
||||
opennebula_client = OpenNebulaManager(
|
||||
email=user.email,
|
||||
password=user.password[:20],
|
||||
password=user.password,
|
||||
)
|
||||
|
||||
# Get vm pool
|
||||
|
|
@ -279,6 +291,12 @@ class HostingOrder(AssignPermissionsMixin, models.Model):
|
|||
self.cc_brand = stripe_charge.source.brand
|
||||
self.save()
|
||||
|
||||
def get_cc_data(self):
|
||||
return {
|
||||
'last4': self.last4,
|
||||
'cc_brand': self.cc_brand,
|
||||
} if self.last4 and self.cc_brand else None
|
||||
|
||||
|
||||
class UserHostingKey(models.Model):
|
||||
user = models.ForeignKey(CustomUser)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue