mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-17 18:33:32 +09:00
feature #1570: add user, password and endpoint to oneacct
This commit is contained in:
1 parent
bd3178e922
commit
eb9a54a930
2 files changed
+13
-8
No files matched your search
@@ -33,10 +33,10 @@ class AcctHelper < OpenNebulaHelper::OneHelper
|
||||
:format => String # TODO Time
|
||||
}
|
||||
|
||||
USER = {
|
||||
:name => "user",
|
||||
USERFILTER = {
|
||||
:name => "userfilter",
|
||||
:short => "-u user",
|
||||
:large => "--user user" ,
|
||||
:large => "--userfilter user" ,
|
||||
:description => "User name or id to filter the results",
|
||||
:format => String,
|
||||
:proc => lambda { |o, options|
|
||||
@@ -95,7 +95,7 @@ class AcctHelper < OpenNebulaHelper::OneHelper
|
||||
:description => "Split the output in a table for each VM"
|
||||
}
|
||||
|
||||
ACCT_OPTIONS = [START_TIME, END_TIME, USER, GROUP, HOST, XPATH, XML, JSON, SPLIT]
|
||||
ACCT_OPTIONS = [START_TIME, END_TIME, USERFILTER, GROUP, HOST, XPATH, XML, JSON, SPLIT]
|
||||
|
||||
|
||||
ACCT_TABLE = CLIHelper::ShowTable.new("oneacct.yaml", nil) do
|
||||
|
||||
+9
-4
@@ -37,12 +37,17 @@ cmd = CommandParser::CmdParser.new(ARGV) do
|
||||
description ""
|
||||
version OpenNebulaHelper::ONE_VERSION
|
||||
|
||||
client = OpenNebulaHelper::OneHelper.get_client({})
|
||||
helper=OpenNebulaHelper::OneHelper.new
|
||||
|
||||
option AcctHelper::ACCT_OPTIONS + CommandParser::OPTIONS
|
||||
before_proc do
|
||||
helper.set_client(options)
|
||||
end
|
||||
|
||||
option AcctHelper::ACCT_OPTIONS + CommandParser::OPTIONS +
|
||||
OpenNebulaHelper::CLIENT_OPTIONS
|
||||
|
||||
main do
|
||||
filter_flag = (options[:user] || VirtualMachinePool::INFO_ALL)
|
||||
filter_flag = (options[:userfilter] || VirtualMachinePool::INFO_ALL)
|
||||
start_time = options[:start] ? options[:start].to_i : -1
|
||||
end_time = options[:end] ? options[:end].to_i : -1
|
||||
|
||||
@@ -54,7 +59,7 @@ cmd = CommandParser::CmdParser.new(ARGV) do
|
||||
:xpath => options[:xpath]
|
||||
}
|
||||
|
||||
pool = OpenNebula::VirtualMachinePool.new(client)
|
||||
pool = OpenNebula::VirtualMachinePool.new(helper.client)
|
||||
|
||||
if options[:json] || options[:xml]
|
||||
xml_str = pool.accounting_xml(filter_flag, common_opts)
|
||||
|
||||
Reference in new issue
Block a user