diff --git a/Changelog b/Changelog index 6c48e4b5..8906d48b 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,24 @@ +2.2: 2018-09-06 + * bugfix: Include price in the Stripe plan name to make it distinct and to correct pricing since version 1.9 +2.1.2: 2018-08-30 + * bugfix: [blog, comic] Set blog rss feed for all blog templates +2.1.1: 2018-08-24 + * #5487: [hosting] Add explicit warning message for teminating VM (PR #656) + * bugfix: [dg] Send email to admin on dg subscription and increase cc_brand field to 128 characters (PR #652) + * #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 + * 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 + * 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) + * #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 diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py index 281d5f45..2779f79b 100644 --- a/datacenterlight/tasks.py +++ b/datacenterlight/tasks.py @@ -8,13 +8,16 @@ 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 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 @@ -203,12 +206,45 @@ 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 - manager.manage_public_key( - keys, hosts=[vm_ipv6], countdown=75 - ) + # 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): + logger.debug( + "{} is pingable. Doing a " + "manage_public_key".format(vm_ipv6) + ) + sleep(10) + 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: + 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: 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/datacenterlight/tests.py b/datacenterlight/tests.py index c755cc6f..ca1bb930 100644 --- a/datacenterlight/tests.py +++ b/datacenterlight/tests.py @@ -105,7 +105,8 @@ class CeleryTaskTestCase(TestCase): disk_size=disk_size) plan_name = StripeUtils.get_stripe_plan_name(cpu=cpu, memory=memory, - disk_size=disk_size) + disk_size=disk_size, + price=amount_to_be_charged) stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu, ram=memory, ssd=disk_size, diff --git a/datacenterlight/utils.py b/datacenterlight/utils.py index 1c54148e..8da408a0 100644 --- a/datacenterlight/utils.py +++ b/datacenterlight/utils.py @@ -1,3 +1,4 @@ +import logging from django.contrib.sites.models import Site from datacenterlight.tasks import create_vm_task @@ -8,6 +9,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() diff --git a/datacenterlight/views.py b/datacenterlight/views.py index bf87d9b9..be4e5700 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -508,14 +508,20 @@ class OrderConfirmationView(DetailView): memory = specs.get('memory') disk_size = specs.get('disk_size') amount_to_be_charged = specs.get('total_price') - plan_name = StripeUtils.get_stripe_plan_name(cpu=cpu, - memory=memory, - disk_size=disk_size) - stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu, - ram=memory, - ssd=disk_size, - version=1, - app='dcl') + plan_name = StripeUtils.get_stripe_plan_name( + cpu=cpu, + memory=memory, + disk_size=disk_size, + price=amount_to_be_charged + ) + stripe_plan_id = StripeUtils.get_stripe_plan_id( + cpu=cpu, + ram=memory, + ssd=disk_size, + version=1, + app='dcl', + price=amount_to_be_charged + ) stripe_plan = stripe_utils.get_or_create_stripe_plan( amount=amount_to_be_charged, name=plan_name, diff --git a/digitalglarus/migrations/0026_auto_20180824_0739.py b/digitalglarus/migrations/0026_auto_20180824_0739.py new file mode 100644 index 00000000..6ebad14f --- /dev/null +++ b/digitalglarus/migrations/0026_auto_20180824_0739.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-08-24 07:39 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('digitalglarus', '0025_membershiporder_stripe_subscription_id'), + ] + + operations = [ + migrations.AlterField( + model_name='bookingorder', + name='cc_brand', + field=models.CharField(blank=True, max_length=128), + ), + migrations.AlterField( + model_name='membershiporder', + name='cc_brand', + field=models.CharField(blank=True, max_length=128), + ), + ] diff --git a/digitalglarus/mixins.py b/digitalglarus/mixins.py index 7c214e14..18a02239 100644 --- a/digitalglarus/mixins.py +++ b/digitalglarus/mixins.py @@ -39,7 +39,7 @@ class Ordereable(models.Model): created_at = models.DateTimeField(auto_now_add=True) approved = models.BooleanField(default=False) last4 = models.CharField(max_length=4, blank=True) - cc_brand = models.CharField(max_length=10, blank=True) + cc_brand = models.CharField(max_length=128, blank=True) stripe_charge_id = models.CharField(max_length=100, null=True) class Meta: 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, 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': { diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index 95515355..a9e33644 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-24 09:56+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 - + {{ domain }} - {{ hosting }} hosting as easy as possible diff --git a/hosting/templates/hosting/virtual_machine_detail.html b/hosting/templates/hosting/virtual_machine_detail.html index 68894851..ce02036f 100644 --- a/hosting/templates/hosting/virtual_machine_detail.html +++ b/hosting/templates/hosting/virtual_machine_detail.html @@ -51,7 +51,7 @@

{% trans "Status" %}

-
+
{% trans "Your VM is" %}
{% if virtual_machine.state == 'PENDING' %} @@ -74,6 +74,10 @@ {% endif %}
+
+

{% trans "Attention:" %}

+

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

+
@@ -105,7 +109,7 @@