From a3bd9a96b2a181e55139916fbdcdfe1b76504234 Mon Sep 17 00:00:00 2001
From: Attila Farkas <x394097@fi.muni.cz>
Date: Tue, 1 Oct 2019 15:30:19 +0200
Subject: [PATCH] add names to router machines

---
 modules/device_creator.py | 4 ++--
 modules/provider.py       | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/device_creator.py b/modules/device_creator.py
index a389a89..d91bf53 100644
--- a/modules/device_creator.py
+++ b/modules/device_creator.py
@@ -22,9 +22,9 @@ def open_file(file_name):
 def _add_provisioning(hostname, host_definitions):
     """ Adds provisioning to the device if the file exists. """
     try:
-        provision_file = open("provision/" + str(hostname) + ".yaml")
+        provision_file = open("provision/" + str(hostname) + ".yml")
         host_definitions[hostname].append("device.vm.provision \"ansible\" do |ansible|")
-        host_definitions[hostname].append("  ansible.playbook = \"provision/" + hostname + ".yaml\"")
+        host_definitions[hostname].append("  ansible.playbook = \"provision/" + hostname + ".yml\"")
         host_definitions[hostname].append("end")
     except IOError:
         pass
diff --git a/modules/provider.py b/modules/provider.py
index a8f180b..c4b6941 100644
--- a/modules/provider.py
+++ b/modules/provider.py
@@ -54,6 +54,8 @@ def add_router_specification(router, definitions):
     router_box = "generic/debian10"
     router_memory = 256
 
+    definitions[router['name']].append(
+        "device.vm.hostname = \"" + router['name'] + "\"")
     definitions[router['name']].append(
         "device.vm.box = \"" + router_box + "\"")
     definitions[router['name']].append(
-- 
GitLab