Page MenuHomeDevCentral

Parse .sls as YAML for nano syntax highlighting
ClosedPublic

Authored by dereckson on Mar 8 2023, 21:27.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Sep 28, 10:05
Unknown Object (File)
Sat, Sep 28, 05:45
Unknown Object (File)
Thu, Sep 12, 04:01
Unknown Object (File)
Thu, Sep 12, 04:01
Unknown Object (File)
Thu, Sep 12, 03:57
Unknown Object (File)
Thu, Sep 12, 03:55
Unknown Object (File)
Tue, Sep 10, 22:13
Unknown Object (File)
Fri, Sep 6, 20:33
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 Passed
Unit
No Test Coverage
Branch
nano-syntax-sls
Build Status
Buildable 4518
Build 4785: arc lint + arc unit

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