Skip to content

YAML Export Templates #12

Open
Open
@ambsw-technology

Description

@ambsw-technology

Our legacy YAML files include inline documentation, e.g.

client:
  # The client name is:
  #  - exposed to the algorithm/process engine through the ENV directive for selecting configurations
  #  - used to set Django's sites value
  #  - used to configure the Mirth server name
  name: demo
  # Release determines which "tags" may be uploaded to the machine.  Accepted values are `dev`, `alpha`, `beta`, and
  # `production`. For example, a production system will not accept a tag like `1.x.x-dev`.
  release: beta

When extracting configurations from SSM, it'd be great to be able to preserve/leverage similar documentation. I'm not sure if any of the YAML parsers can preserve comments, but it would be nice if I could select a YAML file as a "template" and have it overwrite (or append) key-value pairs, preserving whatever documentation already exist.

Obviously, this would need to be combined with path-specific exports or adding new clients/services would be a mess. There would definitely be some edge cases (e.g. whether to repeat templates in lists), but it'd be useful to address the simplest/most general case and refine as-needed.

Activity

ambsw-technology

ambsw-technology commented on Apr 28, 2019

@ambsw-technology
Author

Obviously, this request would not work as well with the -p behavior (if that even works on init). You'd need to be able to select a specific path (e.g. /service/<service>/dev or /service/<service>/prod or the template would need to include sections for dev and prod containing all of the same text.

ambsw-technology

ambsw-technology commented on Apr 29, 2019

@ambsw-technology
Author

Did some digging. Per this SO answer, PyYAML discards comments when parsing. There are several other projects (some likely drop-in replacements) that could be used to support this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ambsw-technology

        Issue actions

          YAML Export Templates · Issue #12 · runtheops/ssm-diff