1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +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:
catborise 2022-06-30 08:15:11 +03:00 committed by GitHub
commit a272740be6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 3 deletions

View 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),
]

View file

@ -7,7 +7,9 @@
<th scope="col">{% trans "Name" %}<br>{% trans "Description" %}</th> <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" class="d-none d-sm-table-cell">{% trans "User"%}</th>
<th scope="col">{% trans "Status" %}</th> <th scope="col">{% trans "Status" %}</th>
{% if app_settings.VM_DRBD_STATUS == 'True' %}
<th scope="col">{% trans "Role/Disk" %}</th> <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 "VCPU" %}</th>
<th scope="col" class="d-none d-sm-table-cell">{% trans "Memory" %}</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> <th scope="col" style="width:200px;" data-sortable="false">{% trans "Actions" %} & {% trans "Mem Usage" %}</th>
@ -28,7 +30,9 @@
<td> <td>
<span class="text-success">{% trans "Connected" %}</span> <span class="text-success">{% trans "Connected" %}</span>
</td> </td>
{% if app_settings.VM_DRBD_STATUS == 'True' %}
<td class="d-none d-sm-table-cell"></td> <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-center">{{ compute.cpu_count }}</td>
<td class="d-none d-sm-table-cell text-right">{{ compute.ram_size|filesizeformat }}</td> <td class="d-none d-sm-table-cell text-right">{{ compute.ram_size|filesizeformat }}</td>
<td> <td>
@ -64,9 +68,11 @@
<span class="text-warning">{% trans "Suspended" %}</span> <span class="text-warning">{% trans "Suspended" %}</span>
{% endif %} {% endif %}
</td> </td>
{% if app_settings.VM_DRBD_STATUS == 'True' %}
<td> <td>
{% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}<span class="text-success">{% else %}<span class="text-danger">{% endif %}{{ instance.drbd }}</span> {% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}<span class="text-success">{% else %}<span class="text-danger">{% endif %}{{ instance.drbd }}</span>
</td> </td>
{% endif %}
<td>{{ instance.proxy.instance.info.3 }}</td> <td>{{ instance.proxy.instance.info.3 }}</td>
<td>{{ instance.cur_memory }} MB</td> <td>{{ instance.cur_memory }} MB</td>
<td class="text-nowrap"> <td class="text-nowrap">

View file

@ -7,7 +7,9 @@
<th scope="col">{% trans 'Host' %}<br>{% trans 'User' %}</th> <th scope="col">{% trans 'Host' %}<br>{% trans 'User' %}</th>
{% endif %} {% endif %}
<th scope="col">{% trans 'Status' %}</th> <th scope="col">{% trans 'Status' %}</th>
{% if app_settings.VM_DRBD_STATUS == 'True' %}
<th scope="col">{% trans 'Role/Disk' %}</th> <th scope="col">{% trans 'Role/Disk' %}</th>
{% endif %}
<th scope="col">{% trans 'VCPU' %}</th> <th scope="col">{% trans 'VCPU' %}</th>
<th scope="col">{% trans 'Memory' %}</th> <th scope="col">{% trans 'Memory' %}</th>
<th scope="col" data-sortable="false">{% trans 'Actions' %}</th> <th scope="col" data-sortable="false">{% trans 'Actions' %}</th>
@ -45,9 +47,11 @@
{% if instance.proxy.instance.info.0 == 3 %}<span {% if instance.proxy.instance.info.0 == 3 %}<span
class="text-warning">{% trans "Suspended" %}</span>{% endif %} class="text-warning">{% trans "Suspended" %}</span>{% endif %}
</td> </td>
{% if app_settings.VM_DRBD_STATUS == 'True' %}
<td> <td>
{% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}<span class="text-success">{% else %}<span class="text-danger">{% endif %}{{ instance.drbd }}</span> {% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}<span class="text-success">{% else %}<span class="text-danger">{% endif %}{{ instance.drbd }}</span>
</td> </td>
{% endif %}
<td>{{ instance.proxy.instance.info.3 }}</td> <td>{{ instance.proxy.instance.info.3 }}</td>
<td>{{ instance.cur_memory }} MB</td> <td>{{ instance.cur_memory }} MB</td>
<td class="text-nowrap"> <td class="text-nowrap">

View file

@ -128,8 +128,9 @@ def instance(request, pk):
storages_host = sorted(instance.proxy.get_storages(True)) storages_host = sorted(instance.proxy.get_storages(True))
net_models_host = instance.proxy.get_network_models() net_models_host = instance.proxy.get_network_models()
instance.drbd = drbd_status(request, pk) if app_settings.VM_DRBD_STATUS == 'True':
instance.save() instance.drbd = drbd_status(request, pk)
instance.save()
return render(request, "instance.html", locals()) return render(request, "instance.html", locals())

View file

@ -265,7 +265,7 @@ USE_SSL = False
## The user with search rights on ldap. (e.g cn=admin,dc=kendar,dc=org) ## The user with search rights on ldap. (e.g cn=admin,dc=kendar,dc=org)
LDAP_MASTER_DN = '' LDAP_MASTER_DN = ''
LDAP_MASTER_PW_ENC = '' 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) ## The root dn (e.g. dc=kendar,dc=org)
LDAP_ROOT_DN = '' LDAP_ROOT_DN = ''
## Queries to identify the users, i use groupOfUniqueNames on openldap ## Queries to identify the users, i use groupOfUniqueNames on openldap