1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

feature #1640: format CLI commands in 80 columns

This commit is contained in:
Javi Fontan 2013-02-26 16:38:35 +01:00
parent 8fc3bbc5fd
commit e3c09095f7
8 changed files with 35 additions and 20 deletions

View File

@ -83,7 +83,8 @@ cmd = CommandParser::CmdParser.new(ARGV) do
order_by[:order_by_1] = 'VM/UID'
order_by[:order_by_2] = 'VM/ID' if options[:split]
acct_hash = pool.accounting(filter_flag, common_opts.merge(order_by))
acct_hash = pool.accounting(filter_flag,
common_opts.merge(order_by))
if OpenNebula.is_error?(acct_hash)
puts acct_hash.message
exit -1

View File

@ -69,7 +69,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
OpenNebulaHelper.rname_to_id(arg, "HOST")
end
set :format, :datastoreid, OpenNebulaHelper.rname_to_id_desc("DATASTORE") do |arg|
set :format, :datastoreid,
OpenNebulaHelper.rname_to_id_desc("DATASTORE") do |arg|
OpenNebulaHelper.rname_to_id(arg, "DATASTORE")
end

View File

@ -62,7 +62,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
helper.list_to_id(arg)
end
set :format, :clusterid, OpenNebulaHelper.rname_to_id_desc("CLUSTER") do |arg|
set :format, :clusterid,
OpenNebulaHelper.rname_to_id_desc("CLUSTER") do |arg|
OpenNebulaHelper.rname_to_id(arg, "CLUSTER")
end
@ -82,7 +83,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
Creates a new Datastore from the given template file
EOT
command :create, create_desc, :file, :options=>[OneClusterHelper::CLUSTER] do
command :create, create_desc, :file,
:options=>[OneClusterHelper::CLUSTER] do
cid = options[:cluster] || ClusterPool::NONE_CLUSTER_ID

View File

@ -103,8 +103,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
quota_desc = <<-EOT.unindent
Set the quota limits for the group. If a path is not provided the editor
will be launched to modify the current quotas.
Set the quota limits for the group. If a path is not provided the
editor will be launched to modify the current quotas.
EOT
command :quota, quota_desc, :groupid, [:file, nil] do
@ -131,7 +131,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
provided the editor will be launched to create new quotas.
EOT
command :batchquota, batchquota_desc, [:range, :groupid_list], [:file, nil] do
command :batchquota, batchquota_desc, [:range, :groupid_list],
[:file, nil] do
batch_str = OneQuotaHelper.get_batch_quota(args[1])
helper.perform_actions(args[0], options, "modified") do |group|

View File

@ -81,7 +81,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
if Image::IMAGE_TYPES.include? type
[0, type]
else
[1, "Image type not supported. Must be #{Image::IMAGE_TYPES.join(", ")}."]
[1, "Image type not supported. Must be "<<
Image::IMAGE_TYPES.join(", ")<<"."]
end
end

View File

@ -94,12 +94,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
- new VM Template named "arch vm" with a disk and a nic:
onetemplate create --name "arch vm" --memory 128 --cpu 1 --disk arch \\
--network private_lan
onetemplate create --name "arch vm" --memory 128 --cpu 1 \\
--disk arch --network private_lan
- using two disks:
onetempate create --name "test vm" --memory 128 --cpu 1 --disk arch,data
onetempate create --name "test vm" --memory 128 --cpu 1 \\
--disk arch,data
EOT
@ -184,7 +185,8 @@ 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|
exit_code=helper.perform_action(args[0], options,
"instantiated") do |t|
name = options[:name]
name = name.gsub("%i",i.to_s) if name

View File

@ -228,7 +228,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
provided the editor will be launched to create new quotas.
EOT
command :batchquota, batchquota_desc, [:range, :userid_list], [:file, nil] do
command :batchquota, batchquota_desc, [:range, :userid_list],
[:file, nil] do
batch_str = OneQuotaHelper.get_batch_quota(args[1])
helper.perform_actions(args[0], options, "modified") do |user|

View File

@ -112,8 +112,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
########################################################################
create_desc = <<-EOT.unindent
Creates a new VM from the given description instead of using a previously
defined template (see 'onetemplate create' and 'onetemplate instantiate').
Creates a new VM from the given description instead of using a
previously defined template (see 'onetemplate create' and
'onetemplate instantiate').
Examples:
@ -189,7 +190,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
command :update, update_desc, :vmid, [:file, nil] do
helper.perform_action(args[0],options,"modified") do |vm|
str = OpenNebulaHelper.update_template(args[0], vm, args[1],'USER_TEMPLATE')
str = OpenNebulaHelper.update_template(args[0], vm, args[1],
'USER_TEMPLATE')
vm.update(str)
end
end
@ -255,7 +257,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
States: ANY
EOT
command :saveas, saveas_desc, :vmid, :diskid, :img_name, :options=>[TYPE] do
command :saveas, saveas_desc, :vmid, :diskid, :img_name,
:options=>[TYPE] do
disk_id = args[1].to_i
image_name = args[2]
image_type = options[:type] || ""
@ -352,7 +355,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
States: PENDING
EOT
command :deploy, deploy_desc, [:range,:vmid_list], :hostid, :options=>[ENFORCE] do
command :deploy, deploy_desc, [:range,:vmid_list], :hostid,
:options=>[ENFORCE] do
host_id = args[1]
verbose = "deploying in host #{host_id}"
@ -371,7 +375,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
States: RUNNING
EOT
command :livemigrate, livemigrate_desc, [:range,:vmid_list], :hostid, :options=>[ENFORCE] do
command :livemigrate, livemigrate_desc, [:range,:vmid_list], :hostid,
:options=>[ENFORCE] do
host_id = args[1]
verbose = "live migrating to #{host_id}"
@ -390,7 +395,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
States: RUNNING
EOT
command :migrate, migrate_desc, [:range,:vmid_list], :hostid, :options=>[ENFORCE] do
command :migrate, migrate_desc, [:range,:vmid_list], :hostid,
:options=>[ENFORCE] do
host_id = args[1]
verbose = "migrating to #{host_id}"