Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cyber-sandbox-creator
Manage
Activity
Members
Labels
Plan
Issues
10
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MUNI-KYPO-CSC
cyber-sandbox-creator
Commits
a822bec0
Commit
a822bec0
authored
4 years ago
by
Attila Farkas
Browse files
Options
Downloads
Patches
Plain Diff
Divide provisioning to separate devices in Vagrantfile
parent
3374644e
No related branches found
No related tags found
1 merge request
!22
Resolve "Support Windows boxes"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/vagrant_generator.py
+2
-2
2 additions, 2 deletions
modules/vagrant_generator.py
templates/vagrantfile
+14
-10
14 additions, 10 deletions
templates/vagrantfile
with
16 additions
and
12 deletions
modules/vagrant_generator.py
+
2
−
2
View file @
a822bec0
...
@@ -240,6 +240,7 @@ def _build_vagrant_definitions(input_definitions, flags):
...
@@ -240,6 +240,7 @@ def _build_vagrant_definitions(input_definitions, flags):
device
[
"
type
"
]
=
"
router
"
device
[
"
type
"
]
=
"
router
"
device
[
"
name
"
]
=
router
[
"
name
"
]
device
[
"
name
"
]
=
router
[
"
name
"
]
device
[
"
commands
"
]
=
_create_commands
(
router
)
device
[
"
commands
"
]
=
_create_commands
(
router
)
device
[
"
commands
"
].
extend
(
_call_provisioner
(
input_definitions
,
flags
))
vagrant_definitions
.
append
(
device
)
vagrant_definitions
.
append
(
device
)
for
host
in
input_definitions
[
"
hosts
"
]:
for
host
in
input_definitions
[
"
hosts
"
]:
...
@@ -247,12 +248,11 @@ def _build_vagrant_definitions(input_definitions, flags):
...
@@ -247,12 +248,11 @@ def _build_vagrant_definitions(input_definitions, flags):
device
[
"
type
"
]
=
"
host
"
device
[
"
type
"
]
=
"
host
"
device
[
"
name
"
]
=
host
[
"
name
"
]
device
[
"
name
"
]
=
host
[
"
name
"
]
device
[
"
commands
"
]
=
_create_commands
(
host
)
device
[
"
commands
"
]
=
_create_commands
(
host
)
device
[
"
commands
"
].
extend
(
_call_provisioner
(
input_definitions
,
flags
))
vagrant_definitions
.
append
(
device
)
vagrant_definitions
.
append
(
device
)
_add_all_networks
(
vagrant_definitions
,
input_definitions
,
flags
)
_add_all_networks
(
vagrant_definitions
,
input_definitions
,
flags
)
vagrant_definitions
.
extend
(
_call_provisioner
(
input_definitions
,
flags
))
return
vagrant_definitions
return
vagrant_definitions
...
...
This diff is collapsed.
Click to expand it.
templates/vagrantfile
+
14
−
10
View file @
a822bec0
...
@@ -26,8 +26,8 @@
...
@@ -26,8 +26,8 @@
{# Macro for provision items #}
{# Macro for provision items #}
{
% macro
provision
(
item
,
namespace
)
%
}
{
% macro
provision
(
item
,
namespace
)
%
}
# {{ item.note }}
# {{ item.note }}
{{
namespace
}}.
vm
.
provision
:{{
item
.
provisioner
}}
do
|
provisioner
|
{{
namespace
}}.
vm
.
provision
:{{
item
.
provisioner
}}
do
|
provisioner
|
{{
layer
2
(
item
.
commands
,
"provisioner"
)
}}
{{
layer
3
(
item
.
commands
,
"provisioner"
)
}}
{
% endmacro
-
%}
{
% endmacro
-
%}
{# Macro for string items #}
{# Macro for string items #}
...
@@ -63,12 +63,12 @@
...
@@ -63,12 +63,12 @@
{{
namespace
}}
.
{{
item
.
command
}}
=
{
{{
namespace
}}
.
{{
item
.
command
}}
=
{
{
% for
key
,
value
in
item
.
dictionary
.
items
()
%
}
{
% for
key
,
value
in
item
.
dictionary
.
items
()
%
}
{
% if
loop
.
last
%}
{
% if
loop
.
last
%}
{{ key }
}:
{{
value
}}
{{ key }
}:
{{
value
}}
{
% else
%
}
{
% else
%
}
{{
key
}}:
{{
value
}},
{{
key
}}:
{{
value
}},
{
% endif
%
}
{
% endif
%
}
{
% endfor
%
}
{
% endfor
%
}
}
}
{
% endmacro
-
%}
{
% endmacro
-
%}
{# Macro for dictionaries #}
{# Macro for dictionaries #}
...
@@ -76,12 +76,12 @@
...
@@ -76,12 +76,12 @@
{{
namespace
}}.
groups
=
{
{{
namespace
}}.
groups
=
{
{
% for
key
,
value
in
item
.
groups
.
items
()
%
}
{
% for
key
,
value
in
item
.
groups
.
items
()
%
}
{
% if
loop
.
last
%}
{
% if
loop
.
last
%}
"{{ key }
}
" => {{ value }}
"{{ key }
}
" => {{ value }}
{% else %}
{% else %}
"
{{
key
}}
" => {{ value }},
"
{{
key
}}
" => {{ value }},
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
}
}
{% endmacro -%}
{% endmacro -%}
{# Macro for network items #}
{# Macro for network items #}
...
@@ -102,8 +102,6 @@
...
@@ -102,8 +102,6 @@
{{ router(item, namespace) }}
{{ router(item, namespace) }}
{% elif item.type == "
host
" %}
{% elif item.type == "
host
" %}
{{ host(item, namespace) }}
{{ host(item, namespace) }}
{% elif item.type == "
provision
" %}
{{ provision(item, namespace) }}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
end
end
...
@@ -128,6 +126,8 @@ end
...
@@ -128,6 +126,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 == "
provision
" %}
{{ provision(item, namespace) }}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
end
end
...
@@ -142,6 +142,10 @@ end
...
@@ -142,6 +142,10 @@ end
{{ boolean(item, namespace) -}}
{{ boolean(item, namespace) -}}
{% elif item.type == "
integer
" %}
{% elif item.type == "
integer
" %}
{{ integer(item, namespace) -}}
{{ integer(item, namespace) -}}
{% elif item.type == "
dictionary
" %}
{{ dictionary(item, namespace) -}}
{% elif item.type == "
groups
" %}
{{ groups(item, namespace) -}}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment