aboutsummaryrefslogtreecommitdiffstats
path: root/src/resource_inventory
diff options
context:
space:
mode:
Diffstat (limited to 'src/resource_inventory')
-rw-r--r--src/resource_inventory/migrations/0016_auto_20201109_1947.py59
-rw-r--r--src/resource_inventory/pdf_templater.py6
-rw-r--r--src/resource_inventory/resource_manager.py7
3 files changed, 68 insertions, 4 deletions
diff --git a/src/resource_inventory/migrations/0016_auto_20201109_1947.py b/src/resource_inventory/migrations/0016_auto_20201109_1947.py
new file mode 100644
index 0000000..d145f06
--- /dev/null
+++ b/src/resource_inventory/migrations/0016_auto_20201109_1947.py
@@ -0,0 +1,59 @@
+# Generated by Django 2.2 on 2020-11-09 19:47
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resource_inventory', '0015_resourcetemplate_copy_of'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='physicalnetwork',
+ name='bundle',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='resource_inventory.ResourceBundle'),
+ ),
+ migrations.AddField(
+ model_name='resourceconfiguration',
+ name='name',
+ field=models.CharField(default='<Hostname>', max_length=3000),
+ ),
+ migrations.AlterField(
+ model_name='cpuprofile',
+ name='cflags',
+ field=models.TextField(blank=True, null=True),
+ ),
+ migrations.AlterField(
+ model_name='interface',
+ name='acts_as',
+ field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='resource_inventory.InterfaceConfiguration'),
+ ),
+ migrations.AlterField(
+ model_name='interfaceconfiguration',
+ name='connections',
+ field=models.ManyToManyField(blank=True, to='resource_inventory.NetworkConnection'),
+ ),
+ migrations.AlterField(
+ model_name='resourcetemplate',
+ name='copy_of',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='resource_inventory.ResourceTemplate'),
+ ),
+ migrations.AlterField(
+ model_name='resourcetemplate',
+ name='name',
+ field=models.CharField(max_length=300),
+ ),
+ migrations.AlterField(
+ model_name='server',
+ name='bundle',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='resource_inventory.ResourceBundle'),
+ ),
+ migrations.AlterField(
+ model_name='server',
+ name='config',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='resource_inventory.ResourceConfiguration'),
+ ),
+ ]
diff --git a/src/resource_inventory/pdf_templater.py b/src/resource_inventory/pdf_templater.py
index 86d84aa..c4b22fe 100644
--- a/src/resource_inventory/pdf_templater.py
+++ b/src/resource_inventory/pdf_templater.py
@@ -22,7 +22,11 @@ class PDFTemplater:
template = "dashboard/pdf.yaml"
info = {}
info['details'] = cls.get_pdf_details(booking.resource)
- info['jumphost'] = cls.get_pdf_jumphost(booking)
+ try:
+ info['jumphost'] = cls.get_pdf_jumphost(booking)
+ except Exception:
+ # filling in jumphost info can be optional in some cases, this shouldn't be a hard error
+ info['jumphost'] = {}
info['nodes'] = cls.get_pdf_nodes(booking)
return render_to_string(template, context=info)
diff --git a/src/resource_inventory/resource_manager.py b/src/resource_inventory/resource_manager.py
index 81f4747..140cc09 100644
--- a/src/resource_inventory/resource_manager.py
+++ b/src/resource_inventory/resource_manager.py
@@ -77,9 +77,10 @@ class ResourceManager:
vlan_manager.reserve_public_vlan(public_net.vlan)
networks[network.name] = public_net.vlan
else:
- vlan = vlan_manager.get_vlan()
- vlan_manager.reserve_vlans(vlan)
- networks[network.name] = vlan
+ # already throws if can't get requested count, so can always index in @ 0
+ vlans = vlan_manager.get_vlans(count=1)
+ vlan_manager.reserve_vlans(vlans[0])
+ networks[network.name] = vlans[0]
return networks
def instantiateTemplate(self, resource_template):