From 07c7a64c5a3da4d5a66d496187f9905f8eb6c00c Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 4 Aug 2018 08:46:00 +0200 Subject: [PATCH 01/62] 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/62] 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/62] 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/62] 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/62] 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/62] 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/62] 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/62] 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/62] 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/62] 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/62] 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 7b8301f143a8b87088bcd6eaa219343057b9886b Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 10 Aug 2018 21:16:53 +0200 Subject: [PATCH 12/62] Send email to admin on dg subscriptionon dg subscription --- digitalglarus/views.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index f99577c5..299327e6 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -492,6 +492,18 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): 'membership_dates': membership.type.first_month_formated_range }) + email_to_admin_data = { + 'subject': "New Digital Glarus subscription: {user}".format( + user=self.request.user.email + ), + 'from_email': 'info@digitalglarus.ch', + 'to': ['info@ungleich.ch'], + 'body': "\n".join( + ["%s=%s" % (k, v) for (k, v) in + order_data.items()]), + } + send_plain_email_task.delay(email_to_admin_data) + context = { 'membership': membership, 'order': membership_order, From e5fc87a971c61c258aba6ac348799dd085f21718 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Mon, 20 Aug 2018 11:51:08 +0200 Subject: [PATCH 13/62] 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 14/62] 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 15/62] 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 16/62] 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 17/62] 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 18/62] 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 19/62] 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 20/62] 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 21/62] 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 22/62] 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 23/62] 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 24/62] 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 25/62] 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 26/62] 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 27/62] 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 28/62] 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 29/62] 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 30/62] 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 929e7ead1c0c9cdc9e9213e572a612ae03caba64 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 22:36:17 +0200 Subject: [PATCH 31/62] Add vm-terminate-warning style --- hosting/static/hosting/css/virtual-machine.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hosting/static/hosting/css/virtual-machine.css b/hosting/static/hosting/css/virtual-machine.css index 1c50776d..5255061c 100644 --- a/hosting/static/hosting/css/virtual-machine.css +++ b/hosting/static/hosting/css/virtual-machine.css @@ -183,6 +183,13 @@ margin-top: 25px; } +.vm-terminate-warning { + letter-spacing: 0.6px; + font-size: 12px; + font-weight: 400; + color: #373636; +} + .vm-contact-us { margin: 25px 0 30px; /* text-align: center; */ From 7e790e702740f25ae66e6ff94316f157918b83e7 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 22:36:29 +0200 Subject: [PATCH 32/62] Add warning div --- hosting/templates/hosting/virtual_machine_detail.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hosting/templates/hosting/virtual_machine_detail.html b/hosting/templates/hosting/virtual_machine_detail.html index 68894851..7ee26211 100644 --- a/hosting/templates/hosting/virtual_machine_detail.html +++ b/hosting/templates/hosting/virtual_machine_detail.html @@ -72,6 +72,10 @@ {% trans "Sorry, there was an unexpected error. Kindly retry." %} {% endif %} +
    +

    {% trans "Attention:" %}

    +

    {% trans "terminating VM can not be reverted." %}

    +
    From 1e5cf082735dfacbc72a9163c10966d4942896e6 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 22:47:49 +0200 Subject: [PATCH 33/62] Move the warning to the bottom --- hosting/templates/hosting/virtual_machine_detail.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hosting/templates/hosting/virtual_machine_detail.html b/hosting/templates/hosting/virtual_machine_detail.html index 7ee26211..6af9fb94 100644 --- a/hosting/templates/hosting/virtual_machine_detail.html +++ b/hosting/templates/hosting/virtual_machine_detail.html @@ -72,12 +72,12 @@ {% trans "Sorry, there was an unexpected error. Kindly retry." %} {% endif %} -
    -

    {% trans "Attention:" %}

    -

    {% trans "terminating VM can not be reverted." %}

    -
    +
    +

    {% trans "Attention:" %}

    +

    {% trans "terminating VM can not be reverted." %}

    +
    From 07837c8752329ab6e7e2854511303b42eb19c84f Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 22:51:22 +0200 Subject: [PATCH 34/62] Reduce bottom padding --- hosting/static/hosting/css/virtual-machine.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/static/hosting/css/virtual-machine.css b/hosting/static/hosting/css/virtual-machine.css index 5255061c..440b38a2 100644 --- a/hosting/static/hosting/css/virtual-machine.css +++ b/hosting/static/hosting/css/virtual-machine.css @@ -142,7 +142,7 @@ } .vm-vmid { - padding: 50px 0 70px; + padding: 50px 0 35px; text-align: center; } From b7ff51962417022339a53c327f5984f7f473880e Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 22:54:49 +0200 Subject: [PATCH 35/62] Reduce bottom padding further by 2px --- hosting/static/hosting/css/virtual-machine.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/static/hosting/css/virtual-machine.css b/hosting/static/hosting/css/virtual-machine.css index 440b38a2..fcbaa301 100644 --- a/hosting/static/hosting/css/virtual-machine.css +++ b/hosting/static/hosting/css/virtual-machine.css @@ -142,7 +142,7 @@ } .vm-vmid { - padding: 50px 0 35px; + padding: 50px 0 33px; text-align: center; } From 4425aa7c88735a3c4b484b321225b527d849a12a Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 22:57:32 +0200 Subject: [PATCH 36/62] Change modal text --- hosting/templates/hosting/virtual_machine_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/templates/hosting/virtual_machine_detail.html b/hosting/templates/hosting/virtual_machine_detail.html index 6af9fb94..0dfc2cbf 100644 --- a/hosting/templates/hosting/virtual_machine_detail.html +++ b/hosting/templates/hosting/virtual_machine_detail.html @@ -109,7 +109,7 @@

    {% trans "Status" %}

    -
    +
    {% trans "Your VM is" %}
    {% if virtual_machine.state == 'PENDING' %} From af78631ec86f1bccf4d7902e3b65d1ca2b4b072a Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Aug 2018 23:13:49 +0200 Subject: [PATCH 38/62] Update hosting's django.po --- hosting/locale/de/LC_MESSAGES/django.po | 32 ++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index 95515355..ac324ccd 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-05 23:15+0000\n" +"POT-Creation-Date: 2018-08-22 21:11+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -290,9 +290,8 @@ msgid "" "You are not making any payment yet. After placing your order, you will be " "taken to the Submit Payment Page." msgstr "" -"Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst " -"ausgelöst, nachdem Du die Bestellung auf der nächsten Seite bestätigt " -"hast." +"Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst ausgelöst, " +"nachdem Du die Bestellung auf der nächsten Seite bestätigt hast." msgid "SUBMIT" msgstr "ABSENDEN" @@ -469,9 +468,9 @@ msgid "" "database." msgstr "" "Bitte wähle eine der zuvor genutzten Kreditkarten oder gib Deine " -"Kreditkartendetails unten an. Die Bezahlung wird über " -"Stripe abgewickelt. " -"Wir speichern Deine Kreditkartendetails nicht in unserer Datenbank." +"Kreditkartendetails unten an. Die Bezahlung wird über Stripe abgewickelt. Wir speichern Deine " +"Kreditkartendetails nicht in unserer Datenbank." msgid "" "Please fill in your credit card information below. We are using Date: Wed, 22 Aug 2018 23:16:26 +0200 Subject: [PATCH 39/62] Remove an unnecessary question mark --- hosting/templates/hosting/virtual_machine_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/templates/hosting/virtual_machine_detail.html b/hosting/templates/hosting/virtual_machine_detail.html index a549aebf..060a21be 100644 --- a/hosting/templates/hosting/virtual_machine_detail.html +++ b/hosting/templates/hosting/virtual_machine_detail.html @@ -109,7 +109,7 @@