nembery / aframe

A minimalistic automation framework designed to create user input forms from various types of APIs and templates.
Apache License 2.0
18 stars 12 forks source link

apply-template cannot match text style config #5

Closed jnpr-raylam closed 6 years ago

jnpr-raylam commented 7 years ago

https://github.com/nembery/aframe/blob/7400dff6ea66d8bd4a165b7d572de3e07924762e/a_frame/utils/action_providers/NetconfAction.py#L118-L127

My template is configure the static route:

routing-options {
  static {
    route {{ prefix }} next-hop {{ nexthop }};
  }
}

The text format regex can't match above template, and therefore fallback to default "set" style and make the apply config failed.

To fix it, suggest to match the "-" also:

re.search(r"^[a-z:-]*\s*\w+\s+{", conf_string, re.I)
nembery commented 6 years ago

applied via commit: https://github.com/nembery/aframe/commit/be1760d541c6f6f9ae50cfd455b0db2986db8462 Thanks for the catch!