ktmpl icon indicating copy to clipboard operation
ktmpl copied to clipboard

generate wrong format ymal when multiple key/value pairs

Open jenningsloy318 opened this issue 8 years ago • 2 comments

Hi All,

just made a test with the lastest ktml.

example.yaml

---
kind: "Template"
apiVersion: "v1"
metadata:
  name: "mongodb-ephemeral"
  annotations:
    description: "Provides a MongoDB database service"
labels:
  template: "mongodb-ephemeral-template"
objects:
  - kind: "Service"
    apiVersion: "v1"
    metadata:
      name: "$(DATABASE_SERVICE_NAME)"
    spec:
      ports:
        - name: "mongo"
          protocol: "TCP"
          targetPort: 27017
      selector:
        name: "$(DATABASE_SERVICE_NAME)"
parameters:
  - name: "DATABASE_SERVICE_NAME"
    description: "Database service name"
    value: "mongodb"
    required: true
    parameterType: "string"

parameter.yaml

---
DATABASE_SERVICE_NAME: "mongoabc"

will result

---
apiVersion: v1
kind: Service
metadata:
  name: mongoabc
spec:
  ports:
    -
      name: mongo
      protocol: TCP
      targetPort: 27017
  selector:
    name: mongoabc

seems the ports section has some format issue, and I also test the similar ways, found that if we have multiple value start with "-", we will get same format issue. ktml will process the content after "-" as a new line start.

jenningsloy318 avatar Jul 14 '17 07:07 jenningsloy318

I've noticed this too. It's a problem with the YAML parser ktmpl uses, and should be reported upstream. I'm happy to leave this issue open to at least remind us to update our yaml-rust dependency when the bug is fixed.

jimmycuadra avatar Jul 14 '17 08:07 jimmycuadra

This is fixed in the latest release: https://github.com/jimmycuadra/ktmpl/releases/tag/0.8.0

I don't have access to this repo anymore, so please close the issue if it's solved for you. Thanks!

jimmycuadra avatar Mar 03 '18 20:03 jimmycuadra