netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.77k stars 2.54k forks source link

Device Type Export YAML indenting behaviour #9101

Closed ekrichbaum closed 2 years ago

ekrichbaum commented 2 years ago

NetBox version

v3.2.0

Python version

3.10

Steps to Reproduce

  1. From Device Type List, Select Export, All Data (YAML)

Expected Behavior

console-ports:
  - name: Con0
    type: rj-45
    label: ''
    description: ''

Additional indent of 2 spaces for each sub element. (allow for direct paste for devicetype library item without edit of each line)

Potentially, also drop blank items out (also for allow to direct paste for devicetype library without removal).

Observed Behavior

console-ports:
- name: Con0
  type: rj-45
  label: ''
  description: ''

Those don't format well here.

DanSheps commented 2 years ago

So, the observed behaviour is actually valid YAML. Not sure why the devicetype library needs the two spaces before the sub-item in the array. Perhaps it is a problem with the linter.

jeremystretch commented 2 years ago

Yeah I believe that's all it is: The linter check in the device type library requires further indentation, which introduces friction when trying to generate new definitions for the library from NetBox.

jeremystretch commented 2 years ago

Relevant: https://stackoverflow.com/questions/25108581/python-yaml-dump-bad-indentation

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

github-actions[bot] commented 2 years ago

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.