Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML Export Templates #12

Open
ambsw-technology opened this issue Apr 28, 2019 · 2 comments
Open

YAML Export Templates #12

ambsw-technology opened this issue Apr 28, 2019 · 2 comments

Comments

@ambsw-technology
Copy link

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.

@ambsw-technology
Copy link
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
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant