Skip to content
Snippets Groups Projects
Commit 1abef6ee authored by Attila Farkas's avatar Attila Farkas
Browse files

Merge branch 'master' into '75-update-testing'

# Conflicts:
#   topologies/0-routers-1-network-5-hosts.yml
parents a01a76a9 b3f69eea
No related branches found
No related tags found
No related merge requests found
integer: integer:
memory: memory memory: memory
cpus: cpus cpus: cpus
other:
vb_customize: customize
...@@ -72,6 +72,14 @@ def _delete_dummy_router(definitions): ...@@ -72,6 +72,14 @@ def _delete_dummy_router(definitions):
return return
def _add_usb_passthrough(definitions):
"""Add usb passthrough to devices"""
for host in definitions["hosts"]:
if "extra" in host and host["extra"]:
if "usb_passthrough" in host["extra"]:
host["vb_customize"] = '["modifyvm", :id, "--usb", "on"]'
def _find_windows_boxes(definitions): def _find_windows_boxes(definitions):
"""Find and return list of host names with windows boxes.""" """Find and return list of host names with windows boxes."""
windows_hosts = [] windows_hosts = []
...@@ -147,3 +155,9 @@ def preprocess(definitions, flags): ...@@ -147,3 +155,9 @@ def preprocess(definitions, flags):
except Exception: except Exception:
cleanup_and_exit("Preprocessing not successful: " cleanup_and_exit("Preprocessing not successful: "
"Could not add flavors.") "Could not add flavors.")
try:
_add_usb_passthrough(definitions)
except Exception:
cleanup_and_exit("Preprocessing not successful: "
"Could not add USB passthrough.")
...@@ -24,7 +24,8 @@ def _create_simple_attribute(key, value, attribute_type): ...@@ -24,7 +24,8 @@ def _create_simple_attribute(key, value, attribute_type):
def _create_complex_attribute(key, value): def _create_complex_attribute(key, value):
"""Create complex vagrant attributes that are not string, int or bool.""" """Create complex vagrant attributes that are not string, int or bool."""
separators = {VAGRANT_MAPPING["other"]["synced_folder"]: ""} separators = {VAGRANT_MAPPING["other"]["synced_folder"]: "",
VIRTUALBOX_MAPPING["other"]["vb_customize"]: ""}
attribute = dict() attribute = dict()
attribute["type"] = "other" attribute["type"] = "other"
...@@ -85,6 +86,10 @@ def _create_commands(device_attributes): ...@@ -85,6 +86,10 @@ def _create_commands(device_attributes):
vagrant_attribute = VIRTUALBOX_MAPPING["integer"][attribute] vagrant_attribute = VIRTUALBOX_MAPPING["integer"][attribute]
vb_commands.append(_create_simple_attribute(vagrant_attribute, vb_commands.append(_create_simple_attribute(vagrant_attribute,
value, "integer")) value, "integer"))
elif attribute in VIRTUALBOX_MAPPING["other"]:
vagrant_attribute = VIRTUALBOX_MAPPING["other"][attribute]
vb_commands.append(_create_complex_attribute(vagrant_attribute,
value))
if vb_commands: if vb_commands:
virtual_box_command = dict() virtual_box_command = dict()
......
...@@ -162,6 +162,8 @@ end ...@@ -162,6 +162,8 @@ end
{{ dictionary(item, namespace) -}} {{ dictionary(item, namespace) -}}
{% elif item.type == "groups" %} {% elif item.type == "groups" %}
{{ groups(item, namespace) -}} {{ groups(item, namespace) -}}
{% elif item.type == "other" %}
{{ other(item, namespace) -}}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
end end
......
...@@ -59,4 +59,4 @@ router_mappings: ...@@ -59,4 +59,4 @@ router_mappings:
ip: 10.10.40.1 ip: 10.10.40.1
- router: router2 - router: router2
network: network4 network: network4
ip: 10.10.50.1 ip: 10.10.50.1
\ No newline at end of file
...@@ -2,15 +2,13 @@ name: small-sandbox ...@@ -2,15 +2,13 @@ name: small-sandbox
hosts: hosts:
- name: server - name: server
base_box: base_box:
image: ubuntu/xenial64 image: munikypo/debian-10
flavor: csirtmu.tiny1x4 flavor: csirtmu.tiny1x4
cpus: 2 cpus: 2
- name: home - name: home
base_box: base_box:
image: ubuntu/xenial64 image: munikypo/debian-10
boot_timeout: 1000
box_check_update: false
routers: routers:
- name: router - name: router
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment