summaryrefslogtreecommitdiff
path: root/hscript/script.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 19:37:01 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 19:37:01 -0500
commit77ef54d7a1eccacefc615fee178374760a2401a5 (patch)
tree27f1891bfe5e0a47efab39728a43dbd20bf1cb04 /hscript/script.cc
parente80e8ad8578a3426b810363094243c5d822742d5 (diff)
downloadhorizon-77ef54d7a1eccacefc615fee178374760a2401a5.tar.gz
horizon-77ef54d7a1eccacefc615fee178374760a2401a5.tar.bz2
horizon-77ef54d7a1eccacefc615fee178374760a2401a5.tar.xz
horizon-77ef54d7a1eccacefc615fee178374760a2401a5.zip
hscript: Implement Nameserver, add tests
Diffstat (limited to 'hscript/script.cc')
-rw-r--r--hscript/script.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/hscript/script.cc b/hscript/script.cc
index c99abe5..6ede4c4 100644
--- a/hscript/script.cc
+++ b/hscript/script.cc
@@ -98,6 +98,7 @@ struct Script::ScriptPrivate {
/*! Network addressing configuration */
std::vector< std::unique_ptr<NetAddress> > addresses;
+ std::vector< std::unique_ptr<Nameserver> > nses;
std::vector< std::unique_ptr<NetSSID> > ssids;
/*! APK repositories */
@@ -142,6 +143,10 @@ struct Script::ScriptPrivate {
std::unique_ptr<NetAddress> addr(dynamic_cast<NetAddress *>(obj));
this->addresses.push_back(std::move(addr));
return true;
+ } else if(key_name == "nameserver") {
+ std::unique_ptr<Nameserver> ns(dynamic_cast<Nameserver *>(obj));
+ this->nses.push_back(std::move(ns));
+ return true;
} else if(key_name == "netssid") {
std::unique_ptr<NetSSID> ssid(dynamic_cast<NetSSID *>(obj));
this->ssids.push_back(std::move(ssid));
@@ -730,6 +735,13 @@ bool Script::validate() const {
}
}
+ /* REQ: Runner.Validate.nameserver */
+ for(auto &ns : this->internal->nses) {
+ if(!ns->validate(this->opts)) {
+ failures++;
+ }
+ }
+
/* REQ: Runner.Validate.network.netssid */
for(auto &ssid : this->internal->ssids) {
if(!ssid->validate(this->opts)) {