libstore/machines: add name attribute
Change-Id: Ie0f246dee219ffb3cade7e8b9a9596eb2a06f2dd
This commit is contained in:
@@ -167,6 +167,7 @@ static Machine parseBuilderLine(const std::string & line)
|
||||
}
|
||||
|
||||
return {
|
||||
storeUri,
|
||||
storeUri,
|
||||
systemTypes,
|
||||
sshKey,
|
||||
@@ -262,7 +263,8 @@ static toml::result<float, std::string> getSpeedFactor(const toml::value & data)
|
||||
return toml::success(1.0f);
|
||||
}
|
||||
|
||||
static toml::result<Machine, std::vector<std::string>> parseMachine(const toml::value & data)
|
||||
static toml::result<Machine, std::vector<std::string>>
|
||||
parseMachine(const std::string name, const toml::value & data)
|
||||
{
|
||||
std::vector<std::string> errs;
|
||||
|
||||
@@ -339,6 +341,7 @@ static toml::result<Machine, std::vector<std::string>> parseMachine(const toml::
|
||||
return toml::failure(errs);
|
||||
}
|
||||
return toml::success<Machine>({
|
||||
name,
|
||||
storeUri.unwrap(),
|
||||
std::set(systemTypes.unwrap().begin(), systemTypes.unwrap().end()),
|
||||
sshKey.unwrap(),
|
||||
@@ -404,7 +407,7 @@ static toml::result<Machines, std::vector<std::string>> parseToml(const toml::va
|
||||
}
|
||||
|
||||
for (const auto & [name, machine] : data.at(array_name).as_table()) {
|
||||
auto const res = parseMachine(machine);
|
||||
auto const res = parseMachine(name, machine);
|
||||
if (res.is_err()) {
|
||||
auto err = res.as_err();
|
||||
parserErrors.push_back(fmt("for machine %s:", name));
|
||||
|
||||
@@ -14,6 +14,7 @@ class Store;
|
||||
|
||||
struct Machine {
|
||||
|
||||
const std::string name;
|
||||
const std::string storeUri;
|
||||
const std::set<std::string> systemTypes;
|
||||
const std::string sshKey;
|
||||
|
||||
Reference in New Issue
Block a user