From e5fc87a971c61c258aba6ac348799dd085f21718 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Mon, 20 Aug 2018 11:51:08 +0200 Subject: [PATCH 01/22] Add description page_attribute for ungleich cms page template --- ungleich_page/templates/ungleich_page/ungleich_cms_page.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ungleich_page/templates/ungleich_page/ungleich_cms_page.html b/ungleich_page/templates/ungleich_page/ungleich_cms_page.html index 42293b04..113568e6 100644 --- a/ungleich_page/templates/ungleich_page/ungleich_cms_page.html +++ b/ungleich_page/templates/ungleich_page/ungleich_cms_page.html @@ -7,8 +7,9 @@ - - + + + {% page_attribute "page_title" %} From 9381327a12f632718469d2940a5ffa53c757a67b Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Mon, 20 Aug 2018 11:52:22 +0200 Subject: [PATCH 02/22] Change author of various cms pages to ungleich glarus ag (Being consistent) --- datacenterlight/templates/datacenterlight/cms/base.html | 2 +- hosting/templates/hosting/base.html | 2 +- ungleich_page/templates/ungleich_page/glasfaser_cms_page.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/cms/base.html b/datacenterlight/templates/datacenterlight/cms/base.html index a614db67..5202fb90 100644 --- a/datacenterlight/templates/datacenterlight/cms/base.html +++ b/datacenterlight/templates/datacenterlight/cms/base.html @@ -8,8 +8,8 @@ - + {% page_attribute "page_title" %} diff --git a/hosting/templates/hosting/base.html b/hosting/templates/hosting/base.html index cbf0874f..b8169de4 100644 --- a/hosting/templates/hosting/base.html +++ b/hosting/templates/hosting/base.html @@ -9,7 +9,7 @@ - + {{ domain }} - {{ hosting }} hosting as easy as possible diff --git a/ungleich_page/templates/ungleich_page/glasfaser_cms_page.html b/ungleich_page/templates/ungleich_page/glasfaser_cms_page.html index 03c1ed12..5be0658e 100644 --- a/ungleich_page/templates/ungleich_page/glasfaser_cms_page.html +++ b/ungleich_page/templates/ungleich_page/glasfaser_cms_page.html @@ -7,7 +7,7 @@ - + {% page_attribute "page_title" %} From 770b5e080bc6605e6365353177db2bb6aeda12c5 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 21 Aug 2018 13:24:54 +0200 Subject: [PATCH 03/22] Make UserCardDetail brand field 35 chars long --- hosting/migrations/0047_auto_20180821_1124.py | 20 +++++++++++++++++++ hosting/models.py | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 hosting/migrations/0047_auto_20180821_1124.py diff --git a/hosting/migrations/0047_auto_20180821_1124.py b/hosting/migrations/0047_auto_20180821_1124.py new file mode 100644 index 00000000..b74a8870 --- /dev/null +++ b/hosting/migrations/0047_auto_20180821_1124.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-08-21 11:24 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hosting', '0046_usercarddetail'), + ] + + operations = [ + migrations.AlterField( + model_name='usercarddetail', + name='brand', + field=models.CharField(max_length=35), + ), + ] diff --git a/hosting/models.py b/hosting/models.py index 3ae3b0a5..338d6052 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -212,7 +212,7 @@ class UserCardDetail(AssignPermissionsMixin, models.Model): permissions = ('view_usercarddetail',) stripe_customer = models.ForeignKey(StripeCustomer) last4 = models.CharField(max_length=4) - brand = models.CharField(max_length=10) + brand = models.CharField(max_length=35) card_id = models.CharField(max_length=100, blank=True, default='') fingerprint = models.CharField(max_length=100) exp_month = models.IntegerField(null=False) From 768b8ca8209886fc7459b1f65bf7078c63bd41fd Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 21 Aug 2018 14:06:58 +0200 Subject: [PATCH 04/22] Change HostingOrder cc_brand field size to 35 chars --- hosting/migrations/0048_auto_20180821_1206.py | 20 +++++++++++++++++++ hosting/models.py | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 hosting/migrations/0048_auto_20180821_1206.py diff --git a/hosting/migrations/0048_auto_20180821_1206.py b/hosting/migrations/0048_auto_20180821_1206.py new file mode 100644 index 00000000..6939f63c --- /dev/null +++ b/hosting/migrations/0048_auto_20180821_1206.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-08-21 12:06 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hosting', '0047_auto_20180821_1124'), + ] + + operations = [ + migrations.AlterField( + model_name='hostingorder', + name='cc_brand', + field=models.CharField(max_length=35), + ), + ] diff --git a/hosting/models.py b/hosting/models.py index 338d6052..a15cdaa4 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -69,7 +69,7 @@ class HostingOrder(AssignPermissionsMixin, models.Model): created_at = models.DateTimeField(auto_now_add=True) approved = models.BooleanField(default=False) last4 = models.CharField(max_length=4) - cc_brand = models.CharField(max_length=10) + cc_brand = models.CharField(max_length=35) stripe_charge_id = models.CharField(max_length=100, null=True) price = models.FloatField() subscription_id = models.CharField(max_length=100, null=True) From 8bf6440110f9a545a53a62438ad3d5a45fb44f3a Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 21 Aug 2018 14:41:16 +0200 Subject: [PATCH 05/22] Delete old migrations --- hosting/migrations/0047_auto_20180821_1124.py | 20 ------------------- hosting/migrations/0048_auto_20180821_1206.py | 20 ------------------- 2 files changed, 40 deletions(-) delete mode 100644 hosting/migrations/0047_auto_20180821_1124.py delete mode 100644 hosting/migrations/0048_auto_20180821_1206.py diff --git a/hosting/migrations/0047_auto_20180821_1124.py b/hosting/migrations/0047_auto_20180821_1124.py deleted file mode 100644 index b74a8870..00000000 --- a/hosting/migrations/0047_auto_20180821_1124.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.4 on 2018-08-21 11:24 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('hosting', '0046_usercarddetail'), - ] - - operations = [ - migrations.AlterField( - model_name='usercarddetail', - name='brand', - field=models.CharField(max_length=35), - ), - ] diff --git a/hosting/migrations/0048_auto_20180821_1206.py b/hosting/migrations/0048_auto_20180821_1206.py deleted file mode 100644 index 6939f63c..00000000 --- a/hosting/migrations/0048_auto_20180821_1206.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.4 on 2018-08-21 12:06 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('hosting', '0047_auto_20180821_1124'), - ] - - operations = [ - migrations.AlterField( - model_name='hostingorder', - name='cc_brand', - field=models.CharField(max_length=35), - ), - ] From b69abf3eddc001ad50b9b4c32897f32789a01ad0 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 21 Aug 2018 14:42:01 +0200 Subject: [PATCH 06/22] Make CC brand 128 characters long --- hosting/migrations/0047_auto_20180821_1240.py | 25 +++++++++++++++++++ hosting/models.py | 4 +-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 hosting/migrations/0047_auto_20180821_1240.py diff --git a/hosting/migrations/0047_auto_20180821_1240.py b/hosting/migrations/0047_auto_20180821_1240.py new file mode 100644 index 00000000..7976c58d --- /dev/null +++ b/hosting/migrations/0047_auto_20180821_1240.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-08-21 12:40 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hosting', '0046_usercarddetail'), + ] + + operations = [ + migrations.AlterField( + model_name='hostingorder', + name='cc_brand', + field=models.CharField(max_length=128), + ), + migrations.AlterField( + model_name='usercarddetail', + name='brand', + field=models.CharField(max_length=128), + ), + ] diff --git a/hosting/models.py b/hosting/models.py index a15cdaa4..e9fcdc7e 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -69,7 +69,7 @@ class HostingOrder(AssignPermissionsMixin, models.Model): created_at = models.DateTimeField(auto_now_add=True) approved = models.BooleanField(default=False) last4 = models.CharField(max_length=4) - cc_brand = models.CharField(max_length=35) + cc_brand = models.CharField(max_length=128) stripe_charge_id = models.CharField(max_length=100, null=True) price = models.FloatField() subscription_id = models.CharField(max_length=100, null=True) @@ -212,7 +212,7 @@ class UserCardDetail(AssignPermissionsMixin, models.Model): permissions = ('view_usercarddetail',) stripe_customer = models.ForeignKey(StripeCustomer) last4 = models.CharField(max_length=4) - brand = models.CharField(max_length=35) + brand = models.CharField(max_length=128) card_id = models.CharField(max_length=100, blank=True, default='') fingerprint = models.CharField(max_length=100) exp_month = models.IntegerField(null=False) From cda6c60e026411c31c2b7380f7f2809d46677df7 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 21 Aug 2018 15:09:02 +0200 Subject: [PATCH 07/22] Update Changelog for 2.1 --- Changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog b/Changelog index bc6a51dc..bd3873c4 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +2.1: 2018-08-21 + * Bugfix: Increase CC brand name fields from 10 to 128 characters 2.0.5: 2018-08-08 * Fix IPv6 VM name in the billing invoice 2.0.4: 2018-08-07 From 91021d761273db7230ae995faa595fd8b3043b5a Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 21 Aug 2018 23:24:40 +0200 Subject: [PATCH 08/22] Add ping_ok utility method --- datacenterlight/utils.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/datacenterlight/utils.py b/datacenterlight/utils.py index 1c54148e..7734703b 100644 --- a/datacenterlight/utils.py +++ b/datacenterlight/utils.py @@ -1,3 +1,5 @@ +import logging +import subprocess from django.contrib.sites.models import Site from datacenterlight.tasks import create_vm_task @@ -8,6 +10,8 @@ from utils.models import BillingAddress from .cms_models import CMSIntegration from .models import VMPricing, VMTemplate +logger = logging.getLogger(__name__) + def get_cms_integration(name): current_site = Site.objects.get_current() @@ -91,3 +95,21 @@ def create_vm(billing_address_data, stripe_customer_id, specs, 'token', 'customer']: if session_var in request.session: del request.session[session_var] + + +def ping_ok(host_ipv6): + """ + A utility method to check if a host responds to ping requests. Note: the + function relies on `ping6` utility of debian to check. + + :param host_ipv6 str type parameter that represets the ipv6 of the host to + checked + :return True if the host responds to ping else returns False + """ + try: + output = subprocess.check_output("ping6 -c 1 -w 2 " + host_ipv6, + shell=True) + except Exception as ex: + logger.debug(host_ipv6 + " not reachable via ping. Error = " + str(ex)) + return False + return True From a55587dbf3024dacd673de34aeb0320e01660dc7 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 21 Aug 2018 23:49:47 +0200 Subject: [PATCH 09/22] Wait for VM to be pingable before doing a manage_public_key --- datacenterlight/tasks.py | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py index 281d5f45..76216c16 100644 --- a/datacenterlight/tasks.py +++ b/datacenterlight/tasks.py @@ -8,6 +8,7 @@ from django.core.mail import EmailMessage from django.core.urlresolvers import reverse from django.utils import translation from django.utils.translation import ugettext_lazy as _ +from time import sleep from dynamicweb.celery import app from hosting.models import HostingOrder @@ -18,6 +19,7 @@ from utils.hosting_utils import get_all_public_keys, get_or_create_vm_detail from utils.mailer import BaseEmail from utils.stripe_utils import StripeUtils from .models import VMPricing +from .utils import ping_ok logger = get_task_logger(__name__) @@ -206,9 +208,32 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id): # Let's delay the task by 75 seconds to be sure # that we run the cdist configure after the host # is up - manager.manage_public_key( - keys, hosts=[vm_ipv6], countdown=75 - ) + did_manage_public_key = False + for i in range(0, 15): + if ping_ok(vm_ipv6): + logger.debug( + "{} is pingable. Doing a " + "manage_public_key".format(vm_ipv6) + ) + manager.manage_public_key( + keys, hosts=[vm_ipv6] + ) + did_manage_public_key = True + break + else: + logger.debug( + "Can't ping {}. Wait 5 secs".format( + vm_ipv6 + ) + ) + sleep(5) + if not did_manage_public_key: + logger.error( + "Waited for over 75 seconds for {} to be " + "pingable. But the VM was not reachable. So," + "gave up manage_public_key. Do this " + "manually".format(vm_ipv6) + ) except Exception as e: logger.error(str(e)) try: From 3b07687d3eb6e61e9182450f8b16ae9f4b4baaf8 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 00:12:14 +0200 Subject: [PATCH 10/22] Refactor ping_ok from datacenterlight.utils to utils.hosting_utils --- datacenterlight/utils.py | 19 ------------------- utils/hosting_utils.py | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/datacenterlight/utils.py b/datacenterlight/utils.py index 7734703b..8da408a0 100644 --- a/datacenterlight/utils.py +++ b/datacenterlight/utils.py @@ -1,5 +1,4 @@ import logging -import subprocess from django.contrib.sites.models import Site from datacenterlight.tasks import create_vm_task @@ -95,21 +94,3 @@ def create_vm(billing_address_data, stripe_customer_id, specs, 'token', 'customer']: if session_var in request.session: del request.session[session_var] - - -def ping_ok(host_ipv6): - """ - A utility method to check if a host responds to ping requests. Note: the - function relies on `ping6` utility of debian to check. - - :param host_ipv6 str type parameter that represets the ipv6 of the host to - checked - :return True if the host responds to ping else returns False - """ - try: - output = subprocess.check_output("ping6 -c 1 -w 2 " + host_ipv6, - shell=True) - except Exception as ex: - logger.debug(host_ipv6 + " not reachable via ping. Error = " + str(ex)) - return False - return True diff --git a/utils/hosting_utils.py b/utils/hosting_utils.py index c0494b90..438dbc62 100644 --- a/utils/hosting_utils.py +++ b/utils/hosting_utils.py @@ -1,5 +1,6 @@ import decimal import logging +import subprocess from oca.pool import WrongIdError from datacenterlight.models import VMPricing @@ -130,6 +131,24 @@ def get_vm_price_with_vat(cpu, memory, ssd_size, hdd_size=0, return float(price), float(vat), float(vat_percent), discount +def ping_ok(host_ipv6): + """ + A utility method to check if a host responds to ping requests. Note: the + function relies on `ping6` utility of debian to check. + + :param host_ipv6 str type parameter that represets the ipv6 of the host to + checked + :return True if the host responds to ping else returns False + """ + try: + output = subprocess.check_output("ping6 -c 1 -w 2 " + host_ipv6, + shell=True) + except Exception as ex: + logger.debug(host_ipv6 + " not reachable via ping. Error = " + str(ex)) + return False + return True + + class HostingUtils: @staticmethod def clear_items_from_list(from_list, items_list): From 893c8ed08b1c5513b05ae37af1c5f3e37b4ee507 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 00:14:17 +0200 Subject: [PATCH 11/22] Fix imports --- datacenterlight/tasks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py index 76216c16..c233f522 100644 --- a/datacenterlight/tasks.py +++ b/datacenterlight/tasks.py @@ -15,11 +15,12 @@ from hosting.models import HostingOrder from membership.models import CustomUser from opennebula_api.models import OpenNebulaManager from opennebula_api.serializers import VirtualMachineSerializer -from utils.hosting_utils import get_all_public_keys, get_or_create_vm_detail +from utils.hosting_utils import ( + get_all_public_keys, get_or_create_vm_detail, ping_ok +) from utils.mailer import BaseEmail from utils.stripe_utils import StripeUtils from .models import VMPricing -from .utils import ping_ok logger = get_task_logger(__name__) From 2ff7eaea65b6592e20785d89b093a578243f30a9 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 00:25:59 +0200 Subject: [PATCH 12/22] Sleep additional 10 seconds before running manage_public_key --- datacenterlight/tasks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py index c233f522..b7834343 100644 --- a/datacenterlight/tasks.py +++ b/datacenterlight/tasks.py @@ -216,6 +216,7 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id): "{} is pingable. Doing a " "manage_public_key".format(vm_ipv6) ) + sleep(10) manager.manage_public_key( keys, hosts=[vm_ipv6] ) From f56933021fdd189550f4d0fbaee53cdfb2938dbe Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 00:37:40 +0200 Subject: [PATCH 13/22] Also send an email if manage_ssh_key does not complete in time --- datacenterlight/tasks.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py index b7834343..5f2390bb 100644 --- a/datacenterlight/tasks.py +++ b/datacenterlight/tasks.py @@ -230,12 +230,22 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id): ) sleep(5) if not did_manage_public_key: - logger.error( - "Waited for over 75 seconds for {} to be " - "pingable. But the VM was not reachable. So," - "gave up manage_public_key. Do this " - "manually".format(vm_ipv6) - ) + emsg = ("Waited for over 75 seconds for {} to be " + "pingable. But the VM was not reachable. " + "So, gave up manage_public_key. Please do " + "this manually".format(vm_ipv6)) + logger.error(emsg) + email_data = { + 'subject': '{} CELERY TASK INCOMPLETE: {} not ' + 'pingable for 75 seconds'.format( + settings.DCL_TEXT, vm_ipv6 + ), + 'from_email': current_task.request.hostname, + 'to': settings.DCL_ERROR_EMAILS_TO_LIST, + 'body': emsg + } + email = EmailMessage(**email_data) + email.send() except Exception as e: logger.error(str(e)) try: From 13876c24c178bf4eaaf4aabeaaaccee21287645a Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 00:42:50 +0200 Subject: [PATCH 14/22] Update doc --- datacenterlight/tasks.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py index 5f2390bb..2779f79b 100644 --- a/datacenterlight/tasks.py +++ b/datacenterlight/tasks.py @@ -206,9 +206,8 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id): host=vm_ipv6, num_keys=len(keys) ) ) - # Let's delay the task by 75 seconds to be sure - # that we run the cdist configure after the host - # is up + # Let's wait until the IP responds to ping before we + # run the cdist configure on the host did_manage_public_key = False for i in range(0, 15): if ping_ok(vm_ipv6): From e66e8202db773a0935f694f7f1776c4e02773d34 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 19:56:56 +0200 Subject: [PATCH 15/22] Remove unused variable --- utils/hosting_utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/hosting_utils.py b/utils/hosting_utils.py index 438dbc62..a69af8f5 100644 --- a/utils/hosting_utils.py +++ b/utils/hosting_utils.py @@ -141,8 +141,7 @@ def ping_ok(host_ipv6): :return True if the host responds to ping else returns False """ try: - output = subprocess.check_output("ping6 -c 1 -w 2 " + host_ipv6, - shell=True) + subprocess.check_output("ping6 -c 1 -w 2 " + host_ipv6, shell=True) except Exception as ex: logger.debug(host_ipv6 + " not reachable via ping. Error = " + str(ex)) return False From 432b54a86d6c1f7f47b14272a4ee217e3b7e0a09 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 20:27:19 +0200 Subject: [PATCH 16/22] Remove timeout parameter in ping6 request --- utils/hosting_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/hosting_utils.py b/utils/hosting_utils.py index a69af8f5..1859a82c 100644 --- a/utils/hosting_utils.py +++ b/utils/hosting_utils.py @@ -141,7 +141,7 @@ def ping_ok(host_ipv6): :return True if the host responds to ping else returns False """ try: - subprocess.check_output("ping6 -c 1 -w 2 " + host_ipv6, shell=True) + subprocess.check_output("ping6 -c 1 " + host_ipv6, shell=True) except Exception as ex: logger.debug(host_ipv6 + " not reachable via ping. Error = " + str(ex)) return False From fb4591ef6ae1298c7e5961a90d05c75dbf04a763 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 20:51:32 +0200 Subject: [PATCH 17/22] Update Changelog --- Changelog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index bd3873c4..2538c802 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ +Next: + * 5473: Ping a VM before saving ssh key of the user (PR #655) 2.1: 2018-08-21 - * Bugfix: Increase CC brand name fields from 10 to 128 characters + * Bugfix: Increase CC brand name fields from 10 to 128 characters (PR #654) 2.0.5: 2018-08-08 * Fix IPv6 VM name in the billing invoice 2.0.4: 2018-08-07 From ab074d9bc28411988e8f0b912c4df0a0c6f370a8 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 22:00:43 +0200 Subject: [PATCH 18/22] Update Changelog --- Changelog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 2538c802..e76db610 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,6 @@ Next: - * 5473: Ping a VM before saving ssh key of the user (PR #655) + * bugfix: [CMS templates] Set description meta field of ungleich template (was missing before) and set ungleich glarus ag uniformly as author of various CMS pages (PR #653) + * #5473: Ping a VM before saving ssh key of the user (PR #655) 2.1: 2018-08-21 * Bugfix: Increase CC brand name fields from 10 to 128 characters (PR #654) 2.0.5: 2018-08-08 From f9584b4c829a47586366d1f541cb87dfd896eff5 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 23 Aug 2018 09:06:31 +0200 Subject: [PATCH 19/22] Fix a bug when vm_template is None --- hosting/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hosting/models.py b/hosting/models.py index e9fcdc7e..601568c5 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -53,9 +53,11 @@ class OrderDetail(AssignPermissionsMixin, models.Model): ssd_size = models.IntegerField(default=0) def __str__(self): - return "%s - %s, %s cores, %s GB RAM, %s GB SSD" % ( - self.vm_template.name, self.vm_template.vm_type, self.cores, - self.memory, self.ssd_size + return "Not available" if self.vm_template is None else ( + "%s - %s, %s cores, %s GB RAM, %s GB SSD" % ( + self.vm_template.name, self.vm_template.vm_type, self.cores, + self.memory, self.ssd_size + ) ) From 4a1434c514db700a5b7e25d733429ba5f9abc86a Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 23 Aug 2018 09:07:07 +0200 Subject: [PATCH 20/22] Make string representation of HostingOrder more readable --- hosting/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hosting/models.py b/hosting/models.py index 601568c5..c4de453f 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -89,7 +89,9 @@ class HostingOrder(AssignPermissionsMixin, models.Model): ) def __str__(self): - return "%s" % (self.id) + return "Order Nr: #{} - VM_ID: {} - {} - {}".format( + self.id, self.vm_id, self.customer.user.email, self.created_at + ) @cached_property def status(self): From 4baa3a709543bc72fd00741a27315b1db9004488 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 23 Aug 2018 09:18:55 +0200 Subject: [PATCH 21/22] Improve HostingOrder str representation --- hosting/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hosting/models.py b/hosting/models.py index c4de453f..abc4c428 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -89,8 +89,10 @@ class HostingOrder(AssignPermissionsMixin, models.Model): ) def __str__(self): - return "Order Nr: #{} - VM_ID: {} - {} - {}".format( - self.id, self.vm_id, self.customer.user.email, self.created_at + return ("Order Nr: #{} - VM_ID: {} - {} - {} - " + "Specs: {} - Price: {}").format( + self.id, self.vm_id, self.customer.user.email, self.created_at, + self.order_detail, self.price ) @cached_property From feceb14aec336fc3da459352c8271dda66e10612 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 23 Aug 2018 19:55:30 +0200 Subject: [PATCH 22/22] Update Changelog --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index e76db610..2ebefaa3 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ Next: + * #5458: [admin] Make hostingorder more readable (PR #657) * bugfix: [CMS templates] Set description meta field of ungleich template (was missing before) and set ungleich glarus ag uniformly as author of various CMS pages (PR #653) * #5473: Ping a VM before saving ssh key of the user (PR #655) 2.1: 2018-08-21