Giter Site home page Giter Site logo

YAML config about goss HOT 11 CLOSED

goss-org avatar goss-org commented on May 16, 2024
YAML config

from goss.

Comments (11)

aelsabbahy avatar aelsabbahy commented on May 16, 2024

YAML support would be nice. The only concern is comments. They would disapear when a goss add... is run. Would that be an issue?

from goss.

RickyCook avatar RickyCook commented on May 16, 2024

Yeah that's true. That would be a problem. Not sure how to solve that one!

from goss.

mtpereira avatar mtpereira commented on May 16, 2024

Hello!

What if the resource blocks had support for a name or comment field, similar to the name field on Ansbile tasks? It would be optional and, to avoid disrupting the current structure, would be bellow the actual resource name. For example:

command:
  name: Check that redis-cli info is available and executing ok
  redis-cli info:
    exit-status: '0'
    stdout: [redis_version]

This would pretty much kill the need for comments on this files, which I believe is a good workaroud and compromise.

from goss.

aelsabbahy avatar aelsabbahy commented on May 16, 2024

@mtpereira That sounds great! I assume name would be nested under the redis-cli object, right?

---
command:
  redis-cli info:
    name: Check that redis-cli info is available and executing ok
    exit-status: '0'
    stdout: [redis_version]

from goss.

mtpereira avatar mtpereira commented on May 16, 2024

@aelsabbahy Well, yeah, that does make much more sense! 👍 I've placed it outside because I was influenced by Ansible's tasks layout.

from goss.

aelsabbahy avatar aelsabbahy commented on May 16, 2024

I think my next step would be to decouple the storage format (JSON) logic from the core logic and add a name, comment or description attribute. Once that's done it'll be easy to add more formats as needed.

I'm still not 100% sure that YAML can be pulled off without breaking goss add, since it would most likely break references.

  • nice things like references to other places in the YAML

Thoughts?

from goss.

RickyCook avatar RickyCook commented on May 16, 2024

Possibly you could use an _ prefix for metadata fields. In that case, you could just ignore anything you don't understand, so _comment, _todo, _for_service, etc are all equally valid but more descriptive because they're semi structured

from goss.

RickyCook avatar RickyCook commented on May 16, 2024

And yeah, I think you're right @aelsabbahy; regenerating YAML is problematic when you do refs and comments.

Since you know the structure, and it's not complex you could always dump the new element separately and just append it to the file, but that seems like it could be error prone in cases where (for example) the root node is JSON, or the file structure is malformed

from goss.

aelsabbahy avatar aelsabbahy commented on May 16, 2024

Yeah, that's the part I'm mentally struggling with. Refs are cool, but if goss add expands them out, then running it would remove the benefits of having refs in the first place.

Either way.. I'll keep this open and revisit after code de-coupling.

from goss.

aelsabbahy avatar aelsabbahy commented on May 16, 2024

Waiting for the outcome of:
go-yaml/yaml#132

References are still a concern though.

from goss.

aelsabbahy avatar aelsabbahy commented on May 16, 2024

Released in v0.1.0

from goss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.