+ {% else %}
+
+ {% endif %}
+ {% endif %}
+
+
+ {% if deploy.enabled == False or deploy.warning == True %}
+
+ {% else %}
+
+ {% endif %}
+
+
+
+
+
+
+ {% if deploy.enabled == True %}
+
+ {% if status[deploy.machine_id] == 'running' %}
+
+
+
+
+
+
+ {% else %}
+
+ {% endif %}
+ {% endif %}
+
+
+
+ {% if deploy.enabled == False %}
+
+ {% else %}
+ {% if deploy.warning == True %}
+
+ {% else %}
+
{{ deploy.daysleft }} day(s) |
+ {% endif %}
+ {% endif %}
+
+
+
+
+
+
+
+
+
+ Processor {{ deploy.machine_cpu }} {% if deploy.machine_cpu > 1 %}cores{% else %}core{% endif %}
+
+
+
+ Allocated memory {{ deploy.machine_mem }} MB
+
+
+
+
+
+ Network traffic
+
+
+
+ IOPS of {{ deploy.machine_hdd }} GB storage
+
+
+
+
+
+
+
+ Unit: {{ deploy.machine_id }}
+ State: {{ status[deploy.machine_id] }}
+ Protected: {{ deploy.protected }}
+
+
+
+
+
+
+
+ {% endfor %}
+
+
diff --git a/manage.py b/manage.py
index fed64d5..5f0be64 100644
--- a/manage.py
+++ b/manage.py
@@ -47,9 +47,9 @@ def autoremove():
daysleft = draft.daysleft
daysleft -= 1
draft.daysleft = daysleft
- print('Draft {} will be autoremoved after {} days.'.format(draft.machine_alias, daysleft))
- email_content = draft.owner + ' draft days left: ' + daysleft
- send_email(app.config['MAIL_USERNAME'], str(email_content), 'email/adm_logger', user=user, content=str(email_content))
+ email_content = 'Draft {} has {} days left.'.format(draft.machine_alias, daysleft)
+ print(str(email_content))
+ send_email(app.config['MAIL_USERNAME'], str(email_content), 'email/adm_logger', user=draft.owner, content=str(email_content))
db.session.commit()
@manager.command
@@ -67,7 +67,9 @@ def autodisable():
lastcharge = deploy.date_last_charge
expiry = lastcharge + relativedelta(lastcharge, months=+(deploy.period))
if today > expiry:
- print('Deployment "' + deploy.machine_alias + '" is past expiration date and will be marked INACTIVE. Last charged: ' + lastcharge.strftime('%c') + ' expiry date: ' + expiry.strftime('%c'))
+ email_content = 'Deployment "' + deploy.machine_alias + '" is past expiration date and will be marked INACTIVE. Last charged: ' + lastcharge.strftime('%c') + ' expiry date: ' + expiry.strftime('%c')
+ print(str(email_content))
+ send_email(app.config['MAIL_USERNAME'], str(email_content), 'email/adm_logger', user=deploy.owner, content=str(email_content))
deploy.warning = False
deploy.enabled = False
deploy.daysleft = 0
@@ -79,7 +81,9 @@ def autodisable():
lastcharge = service.date_last_charge
expiry = lastcharge + relativedelta(lastcharge, months=+(service.period))
if today > expiry:
- print('Service "' + service.description + '" is past expiration date and will be marked INACTIVE. Last charged: ' + lastcharge.strftime('%c') + ' expiry date: ' + expiry.strftime('%c'))
+ email_content = 'Service "' + service.description + '" is past expiration date and will be marked INACTIVE. Last charged: ' + lastcharge.strftime('%c') + ' expiry date: ' + expiry.strftime('%c')
+ print(str(email_content))
+ send_email(app.config['MAIL_USERNAME'], str(email_content), 'email/adm_logger', user=service.owner, content=str(email_content))
service.warning = False
service.enabled = False
service.daysleft = 0
@@ -90,7 +94,9 @@ def autodisable():
for domain in domains_ena:
expiry = domain.date_expire
if today > expiry:
- print('Domain "' + domain.fqdn + '" is past expiration date and will be marked as INACTIVE. Last charged: ' + lastcharge.strftime('%c') + ' expiry date: ' + expiry.strftime('%c'))
+ email_content = 'Domain "' + domain.fqdn + '" is past expiration date and will be marked as INACTIVE. Last charged: ' + lastcharge.strftime('%c') + ' expiry date: ' + expiry.strftime('%c')
+ print(str(email_content))
+ send_email(app.config['MAIL_USERNAME'], str(email_content), 'email/adm_logger', user=domain.owner, content=str(email_content))
domain.warning = False
domain.enabled = False
domain.daysleft = 0
@@ -113,7 +119,9 @@ def autowarn():
db.session.commit()
warndays = deploy.period * 5
if daysleft.days < warndays:
- print('Deployment "' + deploy.machine_alias + '" is ' + str(daysleft.days) + ' days until expiration. Last charged: ' + lastcharge.strftime('%c') + ' expiry date: ' + expiry.strftime('%c'))
+ email_content = 'Deployment "' + deploy.machine_alias + '" is ' + str(daysleft.days) + ' days until expiration. Last charged: ' + lastcharge.strftime('%c') + ' expiry date: ' + expiry.strftime('%c')
+ print(str(email_content))
+ send_email(app.config['MAIL_USERNAME'], str(email_content), 'email/adm_logger', user=deploy.owner, content=str(email_content))
deploy.warning = True
db.session.commit()
@@ -127,7 +135,9 @@ def autowarn():
db.session.commit()
warndays = service.period * 5
if daysleft.days < warndays:
- print('Service "' + service.description + '" is ' + str(daysleft.days) + ' days until expiration. Last charged: ' + lastcharge.strftime('%c') + ' expiry date: ' + expiry.strftime('%c'))
+ email_content = 'Service "' + service.description + '" is ' + str(daysleft.days) + ' days until expiration. Last charged: ' + lastcharge.strftime('%c') + ' expiry date: ' + expiry.strftime('%c')
+ print(str(email_content))
+ send_email(app.config['MAIL_USERNAME'], str(email_content), 'email/adm_logger', user=service.owner, content=str(email_content))
service.warning = True
db.session.commit()
@@ -139,7 +149,9 @@ def autowarn():
db.session.commit()
warndays = domain.period * 5
if daysleft.days < warndays:
- print('Domain "' + domain.fqdn + '" is ' + str(daysleft.days)+ ' days until expiration. Expiry date: ' + expiry.strftime('%c'))
+ email_content = 'Domain "' + domain.fqdn + '" is ' + str(daysleft.days)+ ' days until expiration. Expiry date: ' + expiry.strftime('%c')
+ print(str(email_content))
+ send_email(app.config['MAIL_USERNAME'], str(email_content), 'email/adm_logger', user=domain.owner, content=str(email_content))
domain.warning = True
db.session.commit()