feature #4320: Make variable substitution when updating CONTEXT

This commit is contained in:
Ruben S. Montero committed 2016-04-22 14:49:49 +02:00
1 parent c0da2d7f89
commit 41b2196ecc
2 files changed
+12 -3

No files matched your search

+2 -2
View File
@@ -945,7 +945,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
- Change the DNS for ETH0 device and add PASSWORD:
onevm updateconf myvm --context "ETH0_DNS=\\"8.8.8.8\\", PASSWORD=\\"1234\\""
onevm updateconf myvm --context 'ETH0_DNS="8.8.8.8", PASSWORD="$USER[PASSWORD]"'
This command also accepts a template, the full list of configuration
attributes are (not all supported via options):
@@ -954,7 +954,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
INPUT = ["TYPE", "BUS"]
GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
RAW = ["DATA", "DATA_VMX", "TYPE"]
CONTEXT (any value, **no variable substitution will be made**)
CONTEXT (any value, **variable substitution will be made**)
*NOTE* Update will replace or add attributes, to remove an existing one
add an empty value.
+10 -1
View File
@@ -4954,5 +4954,14 @@ int VirtualMachine::updateconf(VirtualMachineTemplate& tmpl, string &err)
// -------------------------------------------------------------------------
replace_vector_values(obj_template, &tmpl, "CONTEXT", 0, -1);
return 0;
VectorAttribute * context = obj_template->get("CONTEXT");
int rc = 0;
if ( context != 0 )
{
rc = parse_context_variables(&context, err);
}
return rc;
}