From 07c7a64c5a3da4d5a66d496187f9905f8eb6c00c Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 4 Aug 2018 08:46:00 +0200 Subject: [PATCH 01/29] Leave 'ipv6only' as a part of the VM name if it starts with it --- opennebula_api/serializers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opennebula_api/serializers.py b/opennebula_api/serializers.py index 79f37ecd..f63f2eb0 100644 --- a/opennebula_api/serializers.py +++ b/opennebula_api/serializers.py @@ -162,7 +162,10 @@ class VirtualMachineSerializer(serializers.Serializer): return '-' def get_name(self, obj): - return obj.name.lstrip('public-') + if obj.name.startswith('public-'): + return obj.name.lstrip('public-') + else: + return obj.name class VMTemplateSerializer(serializers.Serializer): From 6546814d622d32db90e11de266e0e7d9d734a832 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 4 Aug 2018 09:52:15 +0200 Subject: [PATCH 02/29] Change VM terminate action from terminate to terminate hard --- opennebula_api/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opennebula_api/models.py b/opennebula_api/models.py index 29632009..3682c5da 100644 --- a/opennebula_api/models.py +++ b/opennebula_api/models.py @@ -315,7 +315,7 @@ class OpenNebulaManager(): return vm_id def delete_vm(self, vm_id): - TERMINATE_ACTION = 'terminate' + TERMINATE_ACTION = 'terminate-hard' vm_terminated = False try: self.oneadmin_client.call( From 93d489334f449ff7336bdd92514beb207e3dfcf5 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 7 Aug 2018 21:44:51 +0200 Subject: [PATCH 03/29] Load cms_templates later These templates are/were used in digitalglarus and hence are obsolete now. Later can be removed after testing. --- dynamicweb/settings/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 7d333a2f..7d62ceb5 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -179,9 +179,7 @@ ROOT_URLCONF = 'dynamicweb.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(PROJECT_DIR, 'cms_templates/'), - os.path.join(PROJECT_DIR, 'cms_templates/djangocms_blog/'), - os.path.join(PROJECT_DIR, 'membership'), + 'DIRS': [os.path.join(PROJECT_DIR, 'membership'), os.path.join(PROJECT_DIR, 'hosting/templates/'), os.path.join(PROJECT_DIR, 'nosystemd/templates/'), os.path.join(PROJECT_DIR, @@ -192,6 +190,8 @@ TEMPLATES = [ os.path.join(PROJECT_DIR, 'ungleich_page/templates/ungleich_page'), os.path.join(PROJECT_DIR, 'templates/analytics'), + os.path.join(PROJECT_DIR, 'cms_templates/'), + os.path.join(PROJECT_DIR, 'cms_templates/djangocms_blog/'), ], 'APP_DIRS': True, 'OPTIONS': { From 0ddbdb045f669f1dae6f60898481e8941bf27eb2 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 7 Aug 2018 21:48:25 +0200 Subject: [PATCH 04/29] Remove unused CMS templates --- dynamicweb/settings/base.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 7d62ceb5..f5cff4fe 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -215,18 +215,18 @@ TEMPLATES = [ WSGI_APPLICATION = 'dynamicweb.wsgi.application' CMS_TEMPLATES = ( - ('base_glarus.html', gettext('default')), - ('one_column.html', gettext('2 Column')), - ('two_columns.html', gettext('3 Column')), - ('about.html', gettext('DG.About')), - ('contact.html', gettext('DG.Contact')), - ('home_digitalglarus.html', gettext('DG.Home')), - ('letscowork.html', gettext('DG.CoWork')), - # ('detail.html', gettext('DG.Detail')), - ('one_column.html', gettext('DG.OneColumn')), + # ('base_glarus.html', gettext('default')), + # ('one_column.html', gettext('2 Column')), + # ('two_columns.html', gettext('3 Column')), + # ('about.html', gettext('DG.About')), + # ('contact.html', gettext('DG.Contact')), + # ('home_digitalglarus.html', gettext('DG.Home')), + # ('letscowork.html', gettext('DG.CoWork')), + # # ('detail.html', gettext('DG.Detail')), + # ('one_column.html', gettext('DG.OneColumn')), # ungleich ('blog_ungleich.html', gettext('Blog')), - ('page.html', gettext('Page')), + # ('page.html', gettext('Page')), # dcl ('datacenterlight/cms/base.html', gettext('Data Center Light')), ('ungleich_page/glasfaser_cms_page.html', gettext('Glasfaser')), From 0a3f51361f04ce2e0dd14a90a264b4d0d1f5c096 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 7 Aug 2018 21:58:50 +0200 Subject: [PATCH 05/29] Add RSS feed icon and link --- ungleich/templates/cms/ungleichch/_header_base.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ungleich/templates/cms/ungleichch/_header_base.html b/ungleich/templates/cms/ungleichch/_header_base.html index d32f72e6..3dcb689f 100644 --- a/ungleich/templates/cms/ungleichch/_header_base.html +++ b/ungleich/templates/cms/ungleichch/_header_base.html @@ -31,6 +31,9 @@

{% page_attribute 'page_title' %}


{% page_attribute 'meta_description' %} +
+ +
From 48936ace5196ed78af78f8b2c7e708616b16d544 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 7 Aug 2018 21:59:44 +0200 Subject: [PATCH 06/29] Revert back commenting out unwanted templates Todo in another pull request --- dynamicweb/settings/base.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index f5cff4fe..7d62ceb5 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -215,18 +215,18 @@ TEMPLATES = [ WSGI_APPLICATION = 'dynamicweb.wsgi.application' CMS_TEMPLATES = ( - # ('base_glarus.html', gettext('default')), - # ('one_column.html', gettext('2 Column')), - # ('two_columns.html', gettext('3 Column')), - # ('about.html', gettext('DG.About')), - # ('contact.html', gettext('DG.Contact')), - # ('home_digitalglarus.html', gettext('DG.Home')), - # ('letscowork.html', gettext('DG.CoWork')), - # # ('detail.html', gettext('DG.Detail')), - # ('one_column.html', gettext('DG.OneColumn')), + ('base_glarus.html', gettext('default')), + ('one_column.html', gettext('2 Column')), + ('two_columns.html', gettext('3 Column')), + ('about.html', gettext('DG.About')), + ('contact.html', gettext('DG.Contact')), + ('home_digitalglarus.html', gettext('DG.Home')), + ('letscowork.html', gettext('DG.CoWork')), + # ('detail.html', gettext('DG.Detail')), + ('one_column.html', gettext('DG.OneColumn')), # ungleich ('blog_ungleich.html', gettext('Blog')), - # ('page.html', gettext('Page')), + ('page.html', gettext('Page')), # dcl ('datacenterlight/cms/base.html', gettext('Data Center Light')), ('ungleich_page/glasfaser_cms_page.html', gettext('Glasfaser')), From 53667451889ecd6e55e37821ef3296aec285ae30 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 7 Aug 2018 22:39:43 +0200 Subject: [PATCH 07/29] Update Changelog --- Changelog | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 6c48e4b5..95dace16 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,9 @@ +Next: + * #5308: [ipv6only] Fix - when creating a VM, the name begins with v6only + * #5293: Use `terminate-hard` action instead of `terminate` in the opennebula call to terminate a vm 2.0.3: 2018-07-18 * Remove unused /comic url (PR #644) - * 5126: Allow dynamicweb sites to be iframed on other by setting `X_FRAME_OPTIONS_ALLOW_FROM_URI` (PR #645) + * #5126: Allow dynamicweb sites to be iframed on other by setting `X_FRAME_OPTIONS_ALLOW_FROM_URI` (PR #645) 2.0.2: 2018-07-14 * bugfix: [blog] Add missing content block in the blog_ungleich.html template file 2.0.1: 2018-07-14 From e27317aeab5fdf8ed16562a95a9fae77f85e932a Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 7 Aug 2018 23:24:02 +0200 Subject: [PATCH 08/29] Move rss icon from the header to the footer --- ungleich/templates/cms/ungleichch/_footer.html | 8 ++++++++ ungleich/templates/cms/ungleichch/_header_base.html | 3 --- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ungleich/templates/cms/ungleichch/_footer.html b/ungleich/templates/cms/ungleichch/_footer.html index 81194f69..94832ed4 100644 --- a/ungleich/templates/cms/ungleichch/_footer.html +++ b/ungleich/templates/cms/ungleichch/_footer.html @@ -30,6 +30,14 @@ +
  • + + + + + + +
  • {% page_attribute 'page_title' %}


    {% page_attribute 'meta_description' %} -
    - -
    From 895961868bbdcbd45f38cab57c86314f2e01c1c3 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 7 Aug 2018 23:39:43 +0200 Subject: [PATCH 09/29] Update Changelog for 2.0.4 --- Changelog | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index 95dace16..661d7978 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,7 @@ -Next: - * #5308: [ipv6only] Fix - when creating a VM, the name begins with v6only - * #5293: Use `terminate-hard` action instead of `terminate` in the opennebula call to terminate a vm +2.0.4: 2018-08-07 + * Add RSS feed link to the footer of the blog template (PR #651) + * #5308: [ipv6only] Fix - when creating a VM, the name begins with v6only (PR #649) + * #5293: Use `terminate-hard` action instead of `terminate` in the opennebula call to terminate a vm (PR #650) 2.0.3: 2018-07-18 * Remove unused /comic url (PR #644) * #5126: Allow dynamicweb sites to be iframed on other by setting `X_FRAME_OPTIONS_ALLOW_FROM_URI` (PR #645) From 29c4cc44547992ec5216bec4d80477027d5d846d Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 8 Aug 2018 00:10:03 +0200 Subject: [PATCH 10/29] Correct IPv6 VM name in serializer --- opennebula_api/serializers.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/opennebula_api/serializers.py b/opennebula_api/serializers.py index f63f2eb0..c7418aa5 100644 --- a/opennebula_api/serializers.py +++ b/opennebula_api/serializers.py @@ -36,7 +36,10 @@ class VirtualMachineTemplateSerializer(serializers.Serializer): return int(obj.template.memory) / 1024 def get_name(self, obj): - return obj.name.lstrip('public-') + if obj.name.startswith('public-'): + return obj.name.lstrip('public-') + else: + return obj.name class VirtualMachineSerializer(serializers.Serializer): @@ -133,7 +136,10 @@ class VirtualMachineSerializer(serializers.Serializer): def get_configuration(self, obj): template_id = obj.template.template_id template = OpenNebulaManager().get_template(template_id) - return template.name.lstrip('public-') + if template.name.startswith('public-'): + return template.name.lstrip('public-') + else: + return template.name def get_ipv4(self, obj): """ From 051408e1340b071a44ae66ef463b5b81c48ccb0f Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 8 Aug 2018 00:26:00 +0200 Subject: [PATCH 11/29] Update Changelog for 2.0.5 --- Changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog b/Changelog index 661d7978..bc6a51dc 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +2.0.5: 2018-08-08 + * Fix IPv6 VM name in the billing invoice 2.0.4: 2018-08-07 * Add RSS feed link to the footer of the blog template (PR #651) * #5308: [ipv6only] Fix - when creating a VM, the name begins with v6only (PR #649) From e5fc87a971c61c258aba6ac348799dd085f21718 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Mon, 20 Aug 2018 11:51:08 +0200 Subject: [PATCH 12/29] 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 13/29] 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 14/29] 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 15/29] 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 16/29] 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 17/29] 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 18/29] 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 19/29] 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 20/29] 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 21/29] 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 22/29] 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 23/29] 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 24/29] 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 25/29] 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 26/29] 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 27/29] 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 28/29] 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 29/29] 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