context: Interpret legacy-style context as read context only

This provides a better migration path than surprising users with the
write context functionality out of the blue.

Closes #2620.
This commit is contained in:
Tomas Babej 2021-10-14 22:34:37 -04:00
parent 1d4baca0d9
commit d5a026d91a
No known key found for this signature in database
GPG key ID: B0747C6578F7D2F5

View file

@ -966,14 +966,14 @@ std::string Context::getTaskContext (const std::string& kind, std::string name,
}
// Figure out the context string for this kind (read/write)
std::string contextString;
std::string contextString = "";
if (! config.has ("context." + name + "." + kind))
if (! config.has ("context." + name + "." + kind) && kind == "read")
{
debug ("Specific " + kind + " context for '" + name + "' not defined. ");
if (fallback)
{
debug ("Falling back on generic.");
debug ("Trying to interpret old-style context definition as read context.");
contextString = config.get ("context." + name);
}
}