Verified Commit 560961dc authored by A. Wilcox's avatar A. Wilcox

JSON: Add service support

parent 6209b9c9
Pipeline #680 passed with stages
in 1 minute and 42 seconds
......@@ -26,6 +26,9 @@ module horizon-image {
revision 2020-06-22 {
description "Add PPPoE configuration support."
}
revision 2020-06-23 {
description "Add service enablement."
}
typedef architecture {
type enumeration {
......@@ -238,6 +241,20 @@ module horizon-image {
type boolean;
default false;
}
container services {
list service {
key "service";
leaf service {
type string;
description "The name of the service to enable.";
}
leaf runlevel {
type string;
description "The runlevel to enable the service.";
}
}
}
leaf netconfig {
type netconfigtype;
description
......
......@@ -113,6 +113,18 @@ bool parse_one_desc(json desc, std::ostream &out) {
#undef SIMPLE_PLURAL_KEY
if(desc.find("services") != desc.end()) {
for(const auto &svc : desc["services"]) {
ENSURE_KEY(svc, "service");
std::string service = svc["service"].get<std::string>();
out << "svcenable " << svc;
if(svc.find("runlevel") != svc.end()) {
out << " " << svc["runlevel"].get<std::string>();
}
out << std::endl;
}
}
if(desc.find("users") != desc.end()) {
for(const auto &user : desc["users"]) {
if(user.find("username") == user.end()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment