11d1ad7f0bd89734c4455a64b5b38266df72d261
[ccsdk/cds.git] /
1 import { Parser } from './Parser';
2
3 export class JinjaYMLParser implements Parser {
4     variables: Set<string> = new Set();
5     getVariables(fileContent: string): string[] {
6         if (fileContent.includes('{{')) {
7             const xmlSplit = fileContent.split(new RegExp('[{]+[ ]*.[V-v]alues.'));
8             for (const val of xmlSplit) {
9                 const res = val.substring(0, val.indexOf('}}'));
10                 if (res && res.length > 0) {
11                     this.variables.add(res.trim());
12                 }
13
14             }
15         }
16         return [...this.variables];
17     }
18
19 }
20
21 /*
22 vf-module-name: {{ .Values.vpg_name_0 }}
23 <?xml version="1.0" encoding="UTF-8"?>
24 <configuration xmlns:junos="http://xml.juniper.net/junos/17.4R1/junos">
25 <system xmlns="http://yang.juniper.net/junos-qfx/conf/system">
26 <host-name operation="delete" />
27 <host-name operation="create">[hostname]</host-name>
28 </system>
29 </configuration>
30
31 */