This commit is contained in:
matthewalanpenning 2023-05-08 06:15:09 -04:00
parent aaf7192c65
commit 8d18945878
6 changed files with 57 additions and 50 deletions

2
CHANGELOG.md Normal file
View file

@ -0,0 +1,2 @@
# v0.0.1
- Fix an undefind varaible error when loading list of containers without root disk

View file

@ -164,42 +164,44 @@ def api_containers_endpoint(endpoint):
return jsonify(instances)
i = 0
for instance in instances['metadata']:
instances['metadata'][i]['memory'] = ''
instances['metadata'][i]['disk'] = ''
instances['metadata'][i]['ipv4_addresses'] = []
instances['metadata'][i]['ipv6_addresses'] = []
if 'state' in instance.keys():
# Set memory information if exists
if 'memory' in instance['state'].keys():
if 'usage' in instance['state']['memory'].keys():
memory = instance['state']['memory']['usage']
if memory:
instances['metadata'][i]['memory'] = memory
else:
instances['metadata'][i]['memory'] = ""
if memory:
instances['metadata'][i]['memory'] = memory
# Set disk information if exists
if 'disk' in instance['state'].keys():
if 'root' in instance['state']['disk'].keys():
if 'usage' in instance['state']['disk']['root'].keys():
disk = instance['state']['disk']['root']['usage']
if disk:
instances['metadata'][i]['disk'] = disk
else:
instances['metadata'][i]['disk'] = ''
if disk:
instances['metadata'][i]['disk'] = disk
# Set network information if exists
if 'network' in instance['state'].keys():
networks = instance['state']['network']
if networks:
instances['metadata'][i]['ipv4_addresses'] = []
for network in networks.keys():
addresses = networks[network]['addresses']
for address in addresses:
if address['family'] == 'inet' and address['scope'] == 'global':
instances['metadata'][i]['ipv4_addresses'] += [ address['address'] + ' (' + network + ')' ]
instances['metadata'][i]['ipv6_addresses'] = []
for network in networks.keys():
addresses = networks[network]['addresses']
for address in addresses:
if address['family'] == 'inet6' and address['scope'] == 'global':
instances['metadata'][i]['ipv6_addresses'] += [ address['address'] + ' (' + network + ')' ]
else:
instances['metadata'][i]['ipv4_addresses'] = []
instances['metadata'][i]['ipv6_addresses'] = []
if networks:
instances['metadata'][i]['ipv4_addresses'] = []
for network in networks.keys():
addresses = networks[network]['addresses']
for address in addresses:
if address['family'] == 'inet' and address['scope'] == 'global':
instances['metadata'][i]['ipv4_addresses'] += [ address['address'] + ' (' + network + ')' ]
instances['metadata'][i]['ipv6_addresses'] = []
for network in networks.keys():
addresses = networks[network]['addresses']
for address in addresses:
if address['family'] == 'inet6' and address['scope'] == 'global':
instances['metadata'][i]['ipv6_addresses'] += [ address['address'] + ' (' + network + ')' ]
i += 1
return jsonify(instances)

View file

@ -129,42 +129,44 @@ def api_virtual_machines_endpoint(endpoint):
return jsonify(instances)
i = 0
for instance in instances['metadata']:
instances['metadata'][i]['memory'] = ''
instances['metadata'][i]['disk'] = ''
instances['metadata'][i]['ipv4_addresses'] = []
instances['metadata'][i]['ipv6_addresses'] = []
if 'state' in instance.keys():
# Set memory information if exists
if 'memory' in instance['state'].keys():
if 'usage' in instance['state']['memory'].keys():
memory = instance['state']['memory']['usage']
if memory:
instances['metadata'][i]['memory'] = memory
else:
instances['metadata'][i]['memory'] = ""
if memory:
instances['metadata'][i]['memory'] = memory
# Set disk information if exists
if 'disk' in instance['state'].keys():
if 'root' in instance['state']['disk'].keys():
if 'usage' in instance['state']['disk']['root'].keys():
disk = instance['state']['disk']['root']['usage']
if disk:
instances['metadata'][i]['disk'] = disk
else:
instances['metadata'][i]['disk'] = ''
if disk:
instances['metadata'][i]['disk'] = disk
# Set network information if exists
if 'network' in instance['state'].keys():
networks = instance['state']['network']
if networks:
instances['metadata'][i]['ipv4_addresses'] = []
for network in networks.keys():
addresses = networks[network]['addresses']
for address in addresses:
if address['family'] == 'inet' and address['scope'] == 'global':
instances['metadata'][i]['ipv4_addresses'] += [ address['address'] + ' (' + network + ')' ]
instances['metadata'][i]['ipv6_addresses'] = []
for network in networks.keys():
addresses = networks[network]['addresses']
for address in addresses:
if address['family'] == 'inet6' and address['scope'] == 'global':
instances['metadata'][i]['ipv6_addresses'] += [ address['address'] + ' (' + network + ')' ]
else:
instances['metadata'][i]['ipv4_addresses'] = []
instances['metadata'][i]['ipv6_addresses'] = []
if networks:
instances['metadata'][i]['ipv4_addresses'] = []
for network in networks.keys():
addresses = networks[network]['addresses']
for address in addresses:
if address['family'] == 'inet' and address['scope'] == 'global':
instances['metadata'][i]['ipv4_addresses'] += [ address['address'] + ' (' + network + ')' ]
instances['metadata'][i]['ipv6_addresses'] = []
for network in networks.keys():
addresses = networks[network]['addresses']
for address in addresses:
if address['family'] == 'inet6' and address['scope'] == 'global':
instances['metadata'][i]['ipv6_addresses'] += [ address['address'] + ' (' + network + ')' ]
i += 1
return jsonify(instances)

View file

@ -40,7 +40,7 @@
<footer class="main-footer">
<div class="float-right d-none d-sm-block">
Version 0.1.0
Version 0.0.1
</div>
Copyright &copy; 2020-Present <a href="https://penninglabs.com">Penning Labs</a>. All rights reserved.
</footer>

View file

@ -13,7 +13,7 @@
<div class="col-12">
<p>Lxconsole is an open source management console providing a web-based user interface capable of managing multiple LXD servers from a single location.</p>
<p>
<strong>Version</strong>: <span id="versionNumber">v0.0.0</span> <br />
<strong>Version</strong>: <span id="versionNumber">v0.0.1</span> <br />
<strong>License</strong>: AGPL-3.0 <br />
<strong>URL</strong>: https://lxconsole.com <br />
</p>

View file

@ -27,6 +27,7 @@
# 0.7.0
- Add expandable datatables rows where appropriate for additional information
- Include rename tasks in tables with edit form on new tab
# 1.0.0
- Stable release