Skip to content

Commit

Permalink
T5727: Use native URL validator instead of regex-based validator
Browse files Browse the repository at this point in the history
Replace regex-based URL validator with native validator from vyos-utils.

Also, move `include/url.xml.i` to `include/url-http-https.xml.i` to
reflect the fact that it is used only for HTTP(S) URLs.
  • Loading branch information
indrajitr committed Nov 9, 2023
1 parent 1f4e9bc commit 64322b1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion interface-definitions/dns-dynamic.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<help>Options when using HTTP(S) web request to obtain the IP address</help>
</properties>
<children>
#include <include/url.xml.i>
#include <include/url-http-https.xml.i>
<leafNode name="skip">
<properties>
<help>Pattern to skip from the HTTP(S) respose</help>
Expand Down
15 changes: 15 additions & 0 deletions interface-definitions/include/url-http-https.xml.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- include start from url-http-https.xml.i -->
<leafNode name="url">
<properties>
<help>Remote URL</help>
<valueHelp>
<format>url</format>
<description>Remote HTTP(S) URL</description>
</valueHelp>
<constraint>
<validator name="url" argument="--scheme http --scheme https"/>
</constraint>
<constraintErrorMessage>Invalid HTTP(S) URL format</constraintErrorMessage>
</properties>
</leafNode>
<!-- include end -->
15 changes: 0 additions & 15 deletions interface-definitions/include/url.xml.i

This file was deleted.

6 changes: 3 additions & 3 deletions interface-definitions/service-monitoring-telegraf.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</properties>
<defaultValue>main</defaultValue>
</leafNode>
#include <include/url.xml.i>
#include <include/url-http-https.xml.i>
#include <include/port-number.xml.i>
<leafNode name="port">
<defaultValue>8086</defaultValue>
Expand Down Expand Up @@ -145,7 +145,7 @@
<constraintErrorMessage>Table is limited to alphanumerical characters and can contain hyphen and underscores</constraintErrorMessage>
</properties>
</leafNode>
#include <include/url.xml.i>
#include <include/url-http-https.xml.i>
</children>
</node>
<leafNode name="source">
Expand Down Expand Up @@ -271,7 +271,7 @@
</leafNode>
</children>
</node>
#include <include/url.xml.i>
#include <include/url-http-https.xml.i>
</children>
</node>
#include <include/interface/vrf.xml.i>
Expand Down
2 changes: 1 addition & 1 deletion interface-definitions/system-update-check.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<valueless/>
</properties>
</leafNode>
#include <include/url.xml.i>
#include <include/url-http-https.xml.i>
</children>
</node>
</children>
Expand Down

0 comments on commit 64322b1

Please sign in to comment.