Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ICS Control System Infrastructure
Netbox
Commits
fee94ac2
Commit
fee94ac2
authored
Dec 01, 2022
by
Arthur
Browse files
11000 add commenting
parent
c07b0f7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
netbox/utilities/forms/forms.py
View file @
fee94ac2
...
...
@@ -220,22 +220,20 @@ class ImportForm(BootstrapMixin, forms.Form):
records
=
[]
try
:
for
data
in
yaml
.
load_all
(
data
,
Loader
=
yaml
.
SafeLoader
):
"""
checks here are to support both arrays and multiple documents in
yaml data and return as a consistent list for processing (array):
- address: 10.0.1.0/24
status: active
- address: 10.0.1.1/24
status: active
vs (multi-document):
- address: 10.0.1.0/24
status: active
---
- address: 10.0.1.1/24
status: active
device_type output uses multi-document format, but array format
is more common output from other tools.
"""
# checks here are to support both arrays and multiple documents in
# yaml data and return as a consistent list for processing (array):
# - address: 10.0.1.0/24
# status: active
# - address: 10.0.1.1/24
# status: active
# vs (multi-document):
# - address: 10.0.1.0/24
# status: active
# ---
# - address: 10.0.1.1/24
# status: active
# device_type output uses multi-document format, but array format
# is more common output from other tools.
if
type
(
data
)
==
list
:
records
.
extend
(
data
)
elif
type
(
data
)
==
dict
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment