Page MenuHomeDevCentral

Parse .sls as YAML for nano syntax highlighting
ClosedPublic

Authored by dereckson on Mar 8 2023, 21:27.
Tags
None
Referenced Files
F3779039: D2863.diff
Mon, Nov 25, 07:07
Unknown Object (File)
Mon, Nov 18, 04:15
Unknown Object (File)
Tue, Nov 12, 12:49
Unknown Object (File)
Sat, Nov 9, 04:34
Unknown Object (File)
Thu, Nov 7, 01:29
Unknown Object (File)
Sun, Nov 3, 10:11
Unknown Object (File)
Thu, Oct 31, 12:11
Unknown Object (File)
Oct 25 2024, 04:46
Subscribers
None

Details

Summary

As nano added YAML parsing syntax, it's possible to leverage this
to highlight .sls in addition to .yml and .yaml. Even if Jinja2
templates blocks are ignored, it's a great help, especially compared
to no syntax at all.

Fixes T1759.

Test Plan

Deploy on WindRiver

Diff Detail

Repository
rOPS Nasqueron Operations
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dereckson created this revision.
dereckson edited the test plan for this revision. (Show Details)
dereckson added a reviewer: dereckson.

First run

WindRiver
$ salt-call --local state.sls_id nano_sls_support roles/shellserver/userland-software/base

local:
----------
          ID: nano_sls_support
    Function: file.replace
        Name: /usr/local/share/nano/yaml.nanorc
      Result: True
     Comment: Changes were made
     Started: 21:24:32.750903
    Duration: 9.754 ms
     Changes:
              ----------
              diff:
                  ---
                  +++
                  @@ -3,7 +3,7 @@
                   ## Original author:  Benno Schulenberg
                   ## License:  GPL version 3 or newer

                  -syntax yaml "\.ya?ml$"
                  +syntax yaml "\.(ya?ml|sls)$"
                   header "^%YAML |^---( |$)"

                   tabgives "  "

Summary for local
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time:   9.754 ms

Idempotent test

WindRiver
$ salt-call --local state.sls_id nano_sls_support roles/shellserver/userland-software/base
local:
----------
          ID: nano_sls_support
    Function: file.replace
        Name: /usr/local/share/nano/yaml.nanorc
      Result: True
     Comment: No changes needed to be made
     Started: 21:24:57.605310
    Duration: 7.302 ms
     Changes:

Summary for local
------------
Succeeded: 1
Failed:    0
------------
Total states run:     1
Total run time:   7.302 ms
This revision is now accepted and ready to land.Mar 8 2023, 21:29