mirror of
https://github.com/retspen/webvirtcloud
synced 2024-11-01 03:54:15 +00:00
Merge pull request #511 from Info-IIG/develop
Fix LDAP password and added VM DRBD Status to appsettings
This commit is contained in:
commit
a272740be6
5 changed files with 43 additions and 3 deletions
29
appsettings/migrations/0007_auto_20220629_1213.py
Normal file
29
appsettings/migrations/0007_auto_20220629_1213.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
# Generated by Django 3.2.12 on 2022-06-29 12:13
|
||||
|
||||
from django.db import migrations
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
def add_default_settings(apps, schema_editor):
|
||||
setting = apps.get_model("appsettings", "AppSettings")
|
||||
db_alias = schema_editor.connection.alias
|
||||
setting.objects.using(db_alias).bulk_create([
|
||||
setting(31, _("VM DRBD Status"), "VM_DRBD_STATUS", "False", "True,False", _("Show VM DRBD Status")),
|
||||
])
|
||||
|
||||
|
||||
def del_default_settings(apps, schema_editor):
|
||||
setting = apps.get_model("appsettings", "AppSettings")
|
||||
db_alias = schema_editor.connection.alias
|
||||
setting.objects.using(db_alias).filter(key="VM_DRBD_STATUS").delete()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('appsettings', '0006_alter_appsettings_id'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(add_default_settings, del_default_settings),
|
||||
]
|
|
@ -7,7 +7,9 @@
|
|||
<th scope="col">{% trans "Name" %}<br>{% trans "Description" %}</th>
|
||||
<th scope="col" class="d-none d-sm-table-cell">{% trans "User"%}</th>
|
||||
<th scope="col">{% trans "Status" %}</th>
|
||||
{% if app_settings.VM_DRBD_STATUS == 'True' %}
|
||||
<th scope="col">{% trans "Role/Disk" %}</th>
|
||||
{% endif %}
|
||||
<th scope="col" class="d-none d-sm-table-cell">{% trans "VCPU" %}</th>
|
||||
<th scope="col" class="d-none d-sm-table-cell">{% trans "Memory" %}</th>
|
||||
<th scope="col" style="width:200px;" data-sortable="false">{% trans "Actions" %} & {% trans "Mem Usage" %}</th>
|
||||
|
@ -28,7 +30,9 @@
|
|||
<td>
|
||||
<span class="text-success">{% trans "Connected" %}</span>
|
||||
</td>
|
||||
{% if app_settings.VM_DRBD_STATUS == 'True' %}
|
||||
<td class="d-none d-sm-table-cell"></td>
|
||||
{% endif %}
|
||||
<td class="d-none d-sm-table-cell text-center">{{ compute.cpu_count }}</td>
|
||||
<td class="d-none d-sm-table-cell text-right">{{ compute.ram_size|filesizeformat }}</td>
|
||||
<td>
|
||||
|
@ -64,9 +68,11 @@
|
|||
<span class="text-warning">{% trans "Suspended" %}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% if app_settings.VM_DRBD_STATUS == 'True' %}
|
||||
<td>
|
||||
{% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}<span class="text-success">{% else %}<span class="text-danger">{% endif %}{{ instance.drbd }}</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
<td>{{ instance.proxy.instance.info.3 }}</td>
|
||||
<td>{{ instance.cur_memory }} MB</td>
|
||||
<td class="text-nowrap">
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
<th scope="col">{% trans 'Host' %}<br>{% trans 'User' %}</th>
|
||||
{% endif %}
|
||||
<th scope="col">{% trans 'Status' %}</th>
|
||||
{% if app_settings.VM_DRBD_STATUS == 'True' %}
|
||||
<th scope="col">{% trans 'Role/Disk' %}</th>
|
||||
{% endif %}
|
||||
<th scope="col">{% trans 'VCPU' %}</th>
|
||||
<th scope="col">{% trans 'Memory' %}</th>
|
||||
<th scope="col" data-sortable="false">{% trans 'Actions' %}</th>
|
||||
|
@ -45,9 +47,11 @@
|
|||
{% if instance.proxy.instance.info.0 == 3 %}<span
|
||||
class="text-warning">{% trans "Suspended" %}</span>{% endif %}
|
||||
</td>
|
||||
{% if app_settings.VM_DRBD_STATUS == 'True' %}
|
||||
<td>
|
||||
{% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}<span class="text-success">{% else %}<span class="text-danger">{% endif %}{{ instance.drbd }}</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
<td>{{ instance.proxy.instance.info.3 }}</td>
|
||||
<td>{{ instance.cur_memory }} MB</td>
|
||||
<td class="text-nowrap">
|
||||
|
|
|
@ -128,8 +128,9 @@ def instance(request, pk):
|
|||
storages_host = sorted(instance.proxy.get_storages(True))
|
||||
net_models_host = instance.proxy.get_network_models()
|
||||
|
||||
instance.drbd = drbd_status(request, pk)
|
||||
instance.save()
|
||||
if app_settings.VM_DRBD_STATUS == 'True':
|
||||
instance.drbd = drbd_status(request, pk)
|
||||
instance.save()
|
||||
|
||||
return render(request, "instance.html", locals())
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ USE_SSL = False
|
|||
## The user with search rights on ldap. (e.g cn=admin,dc=kendar,dc=org)
|
||||
LDAP_MASTER_DN = ''
|
||||
LDAP_MASTER_PW_ENC = ''
|
||||
LDAP_MASTER_PW = subprocess.Popen(["bash", str(BASE_DIR) + "/webvirtcloud/.dec_ldap_pwd.sh", LDAP_MASTER_PW_ENC],stdout=subprocess.PIPE, text=True).stdout.read().strip('\n')
|
||||
LDAP_MASTER_PW = subprocess.Popen(["bash", str(BASE_DIR) + "/webvirtcloud/.dec_ldap_pwd.sh", LDAP_MASTER_PW_ENC],stdout=subprocess.PIPE, encoding='utf8').stdout.read().strip('\n')
|
||||
## The root dn (e.g. dc=kendar,dc=org)
|
||||
LDAP_ROOT_DN = ''
|
||||
## Queries to identify the users, i use groupOfUniqueNames on openldap
|
||||
|
|
Loading…
Reference in a new issue