does `getvs` in confd work with yaml list?

289 Views Asked by At

I have set a yml file as confd backend. I have a yaml list to process something as below.

otherargs:
- "-Xmx256m"
- "-Xmn128m"

and trying to read the value from the list below. As this is a list I am using getvs to get all values in string[] and join those with ',' . Referring join.

values : [ {{$args := getvs "/otherargs"}}
                 {{join $args ","}}]

Output I received is as below

values : []

Here I am not getting the values from the yaml list via getvs . As it is a list, the data should be collected via getvs but why I am receiving empty string I am not even getting single value here. so Does getvs work with yaml list? If yest then what am I missing here?

I also tried range functionality to get values received via getvs as below referring getvs

values :  [{{range getvs "/otherargs"}}
                  {{.}},
                  {{end}}]

but received same empty array as result. :(

any help would be appreciated ?

1

There are 1 best solutions below

0
pmunshi On

I found the solution from here I was trying to use getvs but the solution to this issue was ls command. Now I am able to populate this list from yml with below code.

 values :  [{{ $otherargs := ls "/otherargs" }}
             "{{join $otherargs "\",\""}}"]

so final result, I received as below

 values : ["-Xmx256m", "-Xmn128m"]