diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-06-23 21:24:35 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-06-23 21:24:35 -0500 |
commit | 560961dc99322aeedd245764dff41624d4d0eb4a (patch) | |
tree | 84d6b6e0b0976db4ae696a1cf070d8d3eed2f4ad | |
parent | 6209b9c9f77af5f7ca0618a44bfd0b5955d7d678 (diff) | |
download | horizon-560961dc99322aeedd245764dff41624d4d0eb4a.tar.gz horizon-560961dc99322aeedd245764dff41624d4d0eb4a.tar.bz2 horizon-560961dc99322aeedd245764dff41624d4d0eb4a.tar.xz horizon-560961dc99322aeedd245764dff41624d4d0eb4a.zip |
JSON: Add service support
-rw-r--r-- | devel/image.yang | 17 | ||||
-rw-r--r-- | tools/hscript-fromjson/jsonconv.cc | 12 |
2 files changed, 29 insertions, 0 deletions
diff --git a/devel/image.yang b/devel/image.yang index cd0069c..15af9f4 100644 --- a/devel/image.yang +++ b/devel/image.yang @@ -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 diff --git a/tools/hscript-fromjson/jsonconv.cc b/tools/hscript-fromjson/jsonconv.cc index cbe6a60..1343a57 100644 --- a/tools/hscript-fromjson/jsonconv.cc +++ b/tools/hscript-fromjson/jsonconv.cc @@ -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()) { |