mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-12 09:17:41 +03:00
bug #1543: merge both name parameters in onetemplate
This commit is contained in:
parent
4e6c01b460
commit
8f89affe5d
@ -68,14 +68,15 @@ EOT
|
||||
}
|
||||
|
||||
# Command line VM template options
|
||||
TEMPLATE_NAME_VM={
|
||||
:name => 'name',
|
||||
:large => '--name name',
|
||||
:description =>
|
||||
'Name for the new VM',
|
||||
:format => String
|
||||
}
|
||||
|
||||
TEMPLATE_OPTIONS=[
|
||||
{
|
||||
:name => 'name',
|
||||
:large => '--name name',
|
||||
:description =>
|
||||
'Name for the VM',
|
||||
:format => String
|
||||
},
|
||||
{
|
||||
:name => 'cpu',
|
||||
:large => '--cpu cpu',
|
||||
@ -134,6 +135,8 @@ EOT
|
||||
}
|
||||
]
|
||||
|
||||
TEMPLATE_OPTIONS_VM=[TEMPLATE_NAME_VM]+TEMPLATE_OPTIONS
|
||||
|
||||
OPTIONS = XML, NUMERIC, KILOBYTES
|
||||
|
||||
class OneHelper
|
||||
|
@ -18,11 +18,11 @@ require 'one_helper'
|
||||
|
||||
class OneTemplateHelper < OpenNebulaHelper::OneHelper
|
||||
VM_NAME={
|
||||
:name => "vm_name",
|
||||
:large => "--name vm_name",
|
||||
:name => "name",
|
||||
:large => "--name name",
|
||||
:format => String,
|
||||
:description => <<-EOT
|
||||
Name of the new Virtual Machine. When instantiating
|
||||
Name of the new VM or TEMPLATE. When instantiating
|
||||
multiple VMs you can use the\"%i\" wildcard to produce
|
||||
different names such as vm-0, vm-1...
|
||||
EOT
|
||||
|
@ -98,7 +98,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
EOT
|
||||
|
||||
command :create, create_desc, [:file, nil], :options =>
|
||||
OpenNebulaHelper::TEMPLATE_OPTIONS do
|
||||
[OneTemplateHelper::VM_NAME]+OpenNebulaHelper::TEMPLATE_OPTIONS do
|
||||
|
||||
if args[0] && OpenNebulaHelper.create_template_options_used?(options)
|
||||
STDERR.puts "You can not use both template file and template"<<
|
||||
@ -167,7 +167,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
number = options[:multiple] || 1
|
||||
number.times do |i|
|
||||
exit_code=helper.perform_action(args[0],options,"instantiated") do |t|
|
||||
name = options[:vm_name]
|
||||
name = options[:name]
|
||||
name = name.gsub("%i",i.to_s) if name
|
||||
res = t.instantiate(name)
|
||||
|
||||
|
@ -115,7 +115,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
EOT
|
||||
|
||||
command :create, create_desc, [:file, nil], :options =>
|
||||
[OneVMHelper::MULTIPLE] + OpenNebulaHelper::TEMPLATE_OPTIONS do
|
||||
[OneVMHelper::MULTIPLE]+OpenNebulaHelper::TEMPLATE_OPTIONS_VM do
|
||||
|
||||
number = options[:multiple] || 1
|
||||
exit_code = nil
|
||||
|
Loading…
Reference in New Issue
Block a user