1 #include <boost/algorithm/string/classification.hpp>
2 #include <boost/algorithm/string/join.hpp>
3 #include <boost/algorithm/string/split.hpp>
4 #include <boost/log/trivial.hpp>
6 #include "libaktualizr/config.h"
7 #include "utilities/config_utils.h"
9 void PackageConfig::updateFromPropertyTree(
const boost::property_tree::ptree& pt) {
10 for (
const auto& cp : pt) {
11 if (cp.first ==
"type") {
12 CopyFromConfig(type, cp.first, pt);
13 }
else if (cp.first ==
"os") {
14 CopyFromConfig(os, cp.first, pt);
15 }
else if (cp.first ==
"sysroot") {
16 CopyFromConfig(sysroot, cp.first, pt);
17 }
else if (cp.first ==
"ostree_server") {
18 CopyFromConfig(ostree_server, cp.first, pt);
19 }
else if (cp.first ==
"images_path") {
20 CopyFromConfig(images_path, cp.first, pt);
21 }
else if (cp.first ==
"packages_file") {
22 CopyFromConfig(packages_file, cp.first, pt);
23 }
else if (cp.first ==
"fake_need_reboot") {
24 CopyFromConfig(fake_need_reboot, cp.first, pt);
26 extra[cp.first] = Utils::stripQuotes(cp.second.get_value<std::string>());
31 void PackageConfig::writeToStream(std::ostream& out_stream)
const {
32 writeOption(out_stream, type,
"type");
33 writeOption(out_stream, os,
"os");
34 writeOption(out_stream, sysroot,
"sysroot");
35 writeOption(out_stream, ostree_server,
"ostree_server");
36 writeOption(out_stream, images_path,
"images_path");
37 writeOption(out_stream, packages_file,
"packages_file");
38 writeOption(out_stream, fake_need_reboot,
"fake_need_reboot");
42 for (
const auto& e : extra) {
43 writeOption(out_stream, e.second, e.first);