opennebula-cli 5.6.2 → 5.7.80.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d1313a09ad69bd8995ea3d0f18e3d2c14fab328
4
- data.tar.gz: a473397450005c9ece8ac0c828112fa283771a27
3
+ metadata.gz: 2ba87b7b6263e5d961a1ad9dc27b968dc0b3bc06
4
+ data.tar.gz: 4ac8190cf143f12a8045468b313fe15c193342ff
5
5
  SHA512:
6
- metadata.gz: 4881c31920ba49fe702a331342edb631b0583d998ed698f39d88ebe2ed4f1cc5d40ef586314c62e24acd4a570cae6dd1c58025720079666619b2a6a0ec42e2e1
7
- data.tar.gz: 962c7bda318cf8597f26af880d292a9f7524fad71198785c040c1b4a4e38e2152ef5e3912b5bb8c63095b9409a9c9392a83a4429c63265ddc8856ba3ae079be4
6
+ metadata.gz: 70e93597b3f7a76f988c4137b9de0f0bdfd49374dd4572156d4de01581adaba6935bc5af600abed448c117f3f35bbcda43fc1c1b6a2ae9ff1e913b1fe414f5ff
7
+ data.tar.gz: cd78e46de0333fe3b769c42a9b3ccfcd0839774f3372693f786ad8f6de14f77d2033dcaf81da0811fb021673d92af6c529e8dbcf73d84070c05537c94607057e
data/bin/oneacct CHANGED
@@ -16,36 +16,36 @@
16
16
  # limitations under the License. #
17
17
  #--------------------------------------------------------------------------- #
18
18
 
19
- ONE_LOCATION=ENV["ONE_LOCATION"]
19
+ ONE_LOCATION = ENV['ONE_LOCATION']
20
20
 
21
21
  if !ONE_LOCATION
22
- RUBY_LIB_LOCATION="/usr/lib/one/ruby"
22
+ RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
23
23
  else
24
- RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
24
+ RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
25
25
  end
26
26
 
27
- $: << RUBY_LIB_LOCATION
28
- $: << RUBY_LIB_LOCATION+"/cli"
27
+ $LOAD_PATH << RUBY_LIB_LOCATION
28
+ $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
29
29
 
30
30
  require 'command_parser'
31
31
  require 'one_helper/oneacct_helper'
32
32
 
33
33
  require 'json'
34
34
 
35
- cmd=CommandParser::CmdParser.new(ARGV) do
36
- usage "`oneacct` [<options>]"
37
- description ""
35
+ CommandParser::CmdParser.new(ARGV) do
36
+ usage '`oneacct` [<options>]'
37
+ description ''
38
38
  version OpenNebulaHelper::ONE_VERSION
39
39
 
40
- helper=OpenNebulaHelper::OneHelper.new
40
+ helper = OpenNebulaHelper::OneHelper.new
41
41
 
42
42
  before_proc do
43
43
  helper.set_client(options)
44
44
  end
45
45
 
46
46
  option AcctHelper::ACCT_OPTIONS + CommandParser::OPTIONS +
47
- [OpenNebulaHelper::DESCRIBE, CLIHelper::LIST, CLIHelper::CSV_OPT] +
48
- OpenNebulaHelper::CLIENT_OPTIONS
47
+ [OpenNebulaHelper::DESCRIBE, CLIHelper::LIST, CLIHelper::CSV_OPT] +
48
+ OpenNebulaHelper::CLIENT_OPTIONS
49
49
 
50
50
  main do
51
51
  if options[:describe]
@@ -54,18 +54,22 @@ cmd=CommandParser::CmdParser.new(ARGV) do
54
54
  end
55
55
 
56
56
  filter_flag = (options[:userfilter] || VirtualMachinePool::INFO_ALL)
57
- start_time = options[:start_time] ? options[:start_time].to_i : -1
57
+ if options[:start_time]
58
+ start_time = options[:start_time].to_i
59
+ else
60
+ start_time = -1
61
+ end
58
62
 
59
63
  end_time = -1
60
64
 
61
- if (!options[:end_time].nil?)
65
+ if !options[:end_time].nil?
62
66
  # Not the safest way to add a day, but since managing date/time
63
67
  # in ruby is... not entirely convenient, this will do
64
68
 
65
69
  t = options[:end_time]
66
70
 
67
- if (t.hour == 0 && t.min == 0 && t.sec == 0)
68
- t += 24*60*60
71
+ if t.hour.zero? && t.min.zero? && t.sec.zero?
72
+ t += 24 * 60 * 60
69
73
  end
70
74
 
71
75
  end_time = t.to_i
@@ -73,19 +77,19 @@ cmd=CommandParser::CmdParser.new(ARGV) do
73
77
 
74
78
  common_opts = {
75
79
  :start_time => start_time,
76
- :end_time => end_time,
77
- :host => options[:host],
78
- :group => options[:group],
79
- :xpath => options[:xpath]
80
+ :end_time => end_time,
81
+ :host => options[:host],
82
+ :group => options[:group],
83
+ :xpath => options[:xpath]
80
84
  }
81
85
 
82
- pool = OpenNebula::VirtualMachinePool.new(helper.client)
86
+ pool = OpenNebula::VirtualMachinePool.new(helper.client)
83
87
 
84
88
  if options[:json] || options[:xml]
85
89
  xml_str = pool.accounting_xml(filter_flag, common_opts)
86
90
  if OpenNebula.is_error?(xml_str)
87
91
  puts xml_str.message
88
- exit -1
92
+ exit(-1)
89
93
  end
90
94
 
91
95
  if options[:json]
@@ -96,10 +100,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
96
100
  elsif options[:xml]
97
101
  puts xml_str
98
102
  end
99
-
100
- exit_code 0
101
103
  else
102
- order_by = Hash.new
104
+ order_by = {}
103
105
  order_by[:order_by_1] = 'VM/UID'
104
106
 
105
107
  if options[:split] && !options[:csv]
@@ -110,48 +112,48 @@ cmd=CommandParser::CmdParser.new(ARGV) do
110
112
  common_opts.merge(order_by))
111
113
  if OpenNebula.is_error?(acct_hash)
112
114
  puts acct_hash.message
113
- exit -1
115
+ exit(-1)
114
116
  end
115
117
 
116
118
  if options[:csv]
117
- a=Array.new
119
+ a = []
118
120
  acct_hash.each do |user_id, value|
119
121
  value['HISTORY_RECORDS']['HISTORY'].each do |l|
120
- l['UID']=user_id
122
+ l['UID'] = user_id
121
123
  a << l
122
124
  end
123
125
  end
124
126
 
125
- cols = [ :UID ] + AcctHelper::ACCT_TABLE.default_columns
127
+ cols = [:UID] + AcctHelper::ACCT_TABLE.default_columns
126
128
  options[:list] ||= cols
127
129
 
128
130
  AcctHelper::ACCT_TABLE.show(a, options)
129
131
  exit(0)
130
132
  end
131
133
 
132
- if ( start_time != -1 or end_time != -1 )
134
+ if start_time != -1 || end_time != -1
133
135
  AcctHelper.print_start_end_time_header(start_time, end_time)
134
136
  end
135
137
 
136
- acct_hash.each { |user_id, value|
138
+ acct_hash.each do |user_id, value|
137
139
  AcctHelper.print_user_header(user_id)
138
140
 
139
141
  if options[:split]
140
142
  # Use one table for each VM
141
- value.each { |vm_id, history_array|
143
+ value.each do |_vm_id, history_array|
142
144
  array = history_array['HISTORY_RECORDS']['HISTORY']
143
145
  AcctHelper::ACCT_TABLE.show(array, options)
144
146
  puts
145
- }
147
+ end
146
148
  else
147
149
  # Use the same table for all the VMs
148
150
  array = value['HISTORY_RECORDS']['HISTORY']
149
151
  AcctHelper::ACCT_TABLE.show(array, options)
150
152
  puts
151
153
  end
152
- }
153
-
154
- exit_code 0
154
+ end
155
155
  end
156
+
157
+ exit_code 0
156
158
  end
157
159
  end
data/bin/oneacl CHANGED
@@ -16,22 +16,22 @@
16
16
  # limitations under the License. #
17
17
  #--------------------------------------------------------------------------- #
18
18
 
19
- ONE_LOCATION=ENV["ONE_LOCATION"]
19
+ ONE_LOCATION = ENV['ONE_LOCATION']
20
20
 
21
21
  if !ONE_LOCATION
22
- RUBY_LIB_LOCATION="/usr/lib/one/ruby"
22
+ RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
23
23
  else
24
- RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
24
+ RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
25
25
  end
26
26
 
27
- $: << RUBY_LIB_LOCATION
28
- $: << RUBY_LIB_LOCATION+"/cli"
27
+ $LOAD_PATH << RUBY_LIB_LOCATION
28
+ $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
29
29
 
30
30
  require 'command_parser'
31
31
  require 'one_helper/oneacl_helper'
32
32
 
33
- cmd=CommandParser::CmdParser.new(ARGV) do
34
- usage "`oneacl` <command> [<args>] [<options>]"
33
+ CommandParser::CmdParser.new(ARGV) do
34
+ usage '`oneacl` <command> [<args>] [<options>]'
35
35
  version OpenNebulaHelper::ONE_VERSION
36
36
 
37
37
  helper = OneAclHelper.new
@@ -43,7 +43,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
43
43
  ########################################################################
44
44
  # Global Options
45
45
  ########################################################################
46
- set :option, CommandParser::OPTIONS+OpenNebulaHelper::CLIENT_OPTIONS
46
+ set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
47
47
 
48
48
  ########################################################################
49
49
  # Formatters for arguments
@@ -60,7 +60,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
60
60
  Adds a new ACL rule
61
61
  EOT
62
62
 
63
- command :create, addrule_desc, [:user,:rulestr], [:resource, nil],
63
+ command :create, addrule_desc, [:user, :rulestr], [:resource, nil],
64
64
  [:rights, nil] do
65
65
  case args.length
66
66
  when 1
@@ -70,9 +70,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
70
70
  next -1, new_args.message
71
71
  end
72
72
  when 3, 4
73
- new_args=args
73
+ new_args = args
74
74
  else
75
- next -1, "Wrong number of arguments, must be 1 or 4"
75
+ next -1, 'Wrong number of arguments, must be 1 or 4'
76
76
  end
77
77
 
78
78
  helper.create_resource(options) do |rule|
@@ -85,7 +85,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
85
85
  EOT
86
86
 
87
87
  command :delete, delrule_desc, [:range] do
88
- helper.perform_actions(args[0],options,"deleted") do |obj|
88
+ helper.perform_actions(args[0], options, 'deleted') do |obj|
89
89
  obj.delete
90
90
  end
91
91
  end
@@ -94,8 +94,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
94
94
  Lists the ACL rule set
95
95
  EOT
96
96
 
97
- command :list, list_desc,:options=>[OpenNebulaHelper::XML,
98
- OpenNebulaHelper::DESCRIBE] do
99
- helper.list_pool( options )
97
+ command :list, list_desc, :options => [OpenNebulaHelper::XML,
98
+ OpenNebulaHelper::DESCRIBE] do
99
+ helper.list_pool(options)
100
100
  end
101
101
  end
data/bin/onecluster CHANGED
@@ -16,22 +16,22 @@
16
16
  # limitations under the License. #
17
17
  #--------------------------------------------------------------------------- #
18
18
 
19
- ONE_LOCATION=ENV["ONE_LOCATION"]
19
+ ONE_LOCATION = ENV['ONE_LOCATION']
20
20
 
21
21
  if !ONE_LOCATION
22
- RUBY_LIB_LOCATION="/usr/lib/one/ruby"
22
+ RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
23
23
  else
24
- RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
24
+ RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
25
25
  end
26
26
 
27
- $: << RUBY_LIB_LOCATION
28
- $: << RUBY_LIB_LOCATION+"/cli"
27
+ $LOAD_PATH << RUBY_LIB_LOCATION
28
+ $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
29
29
 
30
30
  require 'command_parser'
31
31
  require 'one_helper/onecluster_helper'
32
32
 
33
- cmd=CommandParser::CmdParser.new(ARGV) do
34
- usage "`onecluster` <command> [<args>] [<options>]"
33
+ CommandParser::CmdParser.new(ARGV) do
34
+ usage '`onecluster` <command> [<args>] [<options>]'
35
35
  version OpenNebulaHelper::ONE_VERSION
36
36
 
37
37
  helper = OneClusterHelper.new
@@ -43,7 +43,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
43
43
  ########################################################################
44
44
  # Global Options
45
45
  ########################################################################
46
- set :option, CommandParser::OPTIONS+OpenNebulaHelper::CLIENT_OPTIONS
46
+ set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
47
47
 
48
48
  list_options = CLIHelper::OPTIONS
49
49
  list_options << OpenNebulaHelper::XML
@@ -61,17 +61,17 @@ cmd=CommandParser::CmdParser.new(ARGV) do
61
61
  helper.list_to_id(arg)
62
62
  end
63
63
 
64
- set :format, :vnetid, OpenNebulaHelper.rname_to_id_desc("VNET") do |arg|
65
- OpenNebulaHelper.rname_to_id(arg, "VNET")
64
+ set :format, :vnetid, OpenNebulaHelper.rname_to_id_desc('VNET') do |arg|
65
+ OpenNebulaHelper.rname_to_id(arg, 'VNET')
66
66
  end
67
67
 
68
- set :format, :hostid, OpenNebulaHelper.rname_to_id_desc("HOST") do |arg|
69
- OpenNebulaHelper.rname_to_id(arg, "HOST")
68
+ set :format, :hostid, OpenNebulaHelper.rname_to_id_desc('HOST') do |arg|
69
+ OpenNebulaHelper.rname_to_id(arg, 'HOST')
70
70
  end
71
71
 
72
72
  set :format, :datastoreid,
73
- OpenNebulaHelper.rname_to_id_desc("DATASTORE") do |arg|
74
- OpenNebulaHelper.rname_to_id(arg, "DATASTORE")
73
+ OpenNebulaHelper.rname_to_id_desc('DATASTORE') do |arg|
74
+ OpenNebulaHelper.rname_to_id(arg, 'DATASTORE')
75
75
  end
76
76
 
77
77
  ########################################################################
@@ -93,7 +93,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
93
93
  EOT
94
94
 
95
95
  command :delete, delete_desc, [:range, :clusterid_list] do
96
- helper.perform_actions(args[0],options,"deleted") do |obj|
96
+ helper.perform_actions(args[0], options, 'deleted') do |obj|
97
97
  obj.delete
98
98
  end
99
99
  end
@@ -102,7 +102,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
102
102
  Lists Clusters in the pool
103
103
  EOT
104
104
 
105
- command :list, list_desc, :options=>list_options do
105
+ command :list, list_desc, :options => list_options do
106
106
  helper.list_pool(options)
107
107
  end
108
108
 
@@ -110,8 +110,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
110
110
  Shows information for the given Cluster
111
111
  EOT
112
112
 
113
- command :show, show_desc,:clusterid, :options=>OpenNebulaHelper::XML do
114
- helper.show_resource(args[0],options)
113
+ command :show, show_desc, :clusterid, :options => OpenNebulaHelper::XML do
114
+ helper.show_resource(args[0], options)
115
115
  end
116
116
 
117
117
  addhost_desc = <<-EOT.unindent
@@ -119,8 +119,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
119
119
  EOT
120
120
 
121
121
  # TODO: allow the second param to be [:range, :hostid_list]
122
- command :addhost, addhost_desc,:clusterid, :hostid do
123
- helper.perform_action(args[0],options,"updated") do |cluster|
122
+ command :addhost, addhost_desc, :clusterid, :hostid do
123
+ helper.perform_action(args[0], options, 'updated') do |cluster|
124
124
  cluster.addhost(args[1].to_i)
125
125
  end
126
126
  end
@@ -131,7 +131,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
131
131
 
132
132
  # TODO: allow the second param to be [:range, :hostid_list]
133
133
  command :delhost, delhost_desc, :clusterid, :hostid do
134
- helper.perform_action(args[0],options,"updated") do |cluster|
134
+ helper.perform_action(args[0], options, 'updated') do |cluster|
135
135
  cluster.delhost(args[1].to_i)
136
136
  end
137
137
  end
@@ -141,8 +141,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
141
141
  EOT
142
142
 
143
143
  # TODO: allow the second param to be [:range, :datastoreid_list]
144
- command :adddatastore, adddatastore_desc,:clusterid, :datastoreid do
145
- helper.perform_action(args[0],options,"updated") do |cluster|
144
+ command :adddatastore, adddatastore_desc, :clusterid, :datastoreid do
145
+ helper.perform_action(args[0], options, 'updated') do |cluster|
146
146
  cluster.adddatastore(args[1].to_i)
147
147
  end
148
148
  end
@@ -153,7 +153,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
153
153
 
154
154
  # TODO: allow the second param to be [:range, :datastoreid_list]
155
155
  command :deldatastore, deldatastore_desc, :clusterid, :datastoreid do
156
- helper.perform_action(args[0],options,"updated") do |cluster|
156
+ helper.perform_action(args[0], options, 'updated') do |cluster|
157
157
  cluster.deldatastore(args[1].to_i)
158
158
  end
159
159
  end
@@ -163,8 +163,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
163
163
  EOT
164
164
 
165
165
  # TODO: allow the second param to be [:range, :vnetid_list]
166
- command :addvnet, addvnet_desc,:clusterid, :vnetid do
167
- helper.perform_action(args[0],options,"updated") do |cluster|
166
+ command :addvnet, addvnet_desc, :clusterid, :vnetid do
167
+ helper.perform_action(args[0], options, 'updated') do |cluster|
168
168
  cluster.addvnet(args[1].to_i)
169
169
  end
170
170
  end
@@ -174,8 +174,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
174
174
  EOT
175
175
 
176
176
  # TODO: allow the second param to be [:range, :vnetid_list]
177
- command :delvnet, delvnet_desc,:clusterid, :vnetid do
178
- helper.perform_action(args[0],options,"updated") do |cluster|
177
+ command :delvnet, delvnet_desc, :clusterid, :vnetid do
178
+ helper.perform_action(args[0], options, 'updated') do |cluster|
179
179
  cluster.delvnet(args[1].to_i)
180
180
  end
181
181
  end
@@ -186,8 +186,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
186
186
  EOT
187
187
 
188
188
  command :update, update_desc, :clusterid, [:file, nil],
189
- :options=>OpenNebulaHelper::APPEND do
190
- helper.perform_action(args[0],options,"modified") do |obj|
189
+ :options => OpenNebulaHelper::APPEND do
190
+ helper.perform_action(args[0], options, 'modified') do |obj|
191
191
  if options[:append]
192
192
  str = OpenNebulaHelper.append_template(args[0], obj, args[1])
193
193
  else
@@ -206,7 +206,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
206
206
  EOT
207
207
 
208
208
  command :rename, rename_desc, :clusterid, :name do
209
- helper.perform_action(args[0],options,"renamed") do |o|
209
+ helper.perform_action(args[0], options, 'renamed') do |o|
210
210
  o.rename(args[1])
211
211
  end
212
212
  end
data/bin/onedatastore CHANGED
@@ -16,23 +16,23 @@
16
16
  # limitations under the License. #
17
17
  #--------------------------------------------------------------------------- #
18
18
 
19
- ONE_LOCATION=ENV["ONE_LOCATION"]
19
+ ONE_LOCATION = ENV['ONE_LOCATION']
20
20
 
21
21
  if !ONE_LOCATION
22
- RUBY_LIB_LOCATION="/usr/lib/one/ruby"
22
+ RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
23
23
  else
24
- RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
24
+ RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
25
25
  end
26
26
 
27
- $: << RUBY_LIB_LOCATION
28
- $: << RUBY_LIB_LOCATION+"/cli"
27
+ $LOAD_PATH << RUBY_LIB_LOCATION
28
+ $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
29
29
 
30
30
  require 'command_parser'
31
31
  require 'one_helper/onedatastore_helper'
32
32
  require 'one_helper/onecluster_helper'
33
33
 
34
- cmd=CommandParser::CmdParser.new(ARGV) do
35
- usage "`onedatastore` <command> [<args>] [<options>]"
34
+ CommandParser::CmdParser.new(ARGV) do
35
+ usage '`onedatastore` <command> [<args>] [<options>]'
36
36
  version OpenNebulaHelper::ONE_VERSION
37
37
 
38
38
  helper = OneDatastoreHelper.new
@@ -44,7 +44,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
44
44
  ########################################################################
45
45
  # Global Options
46
46
  ########################################################################
47
- set :option, CommandParser::OPTIONS+OpenNebulaHelper::CLIENT_OPTIONS
47
+ set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
48
48
 
49
49
  list_options = CLIHelper::OPTIONS
50
50
  list_options << OpenNebulaHelper::XML
@@ -63,16 +63,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do
63
63
  end
64
64
 
65
65
  set :format, :clusterid,
66
- OpenNebulaHelper.rname_to_id_desc("CLUSTER") do |arg|
67
- OpenNebulaHelper.rname_to_id(arg, "CLUSTER")
66
+ OpenNebulaHelper.rname_to_id_desc('CLUSTER') do |arg|
67
+ OpenNebulaHelper.rname_to_id(arg, 'CLUSTER')
68
68
  end
69
69
 
70
- set :format, :groupid, OpenNebulaHelper.rname_to_id_desc("GROUP") do |arg|
71
- OpenNebulaHelper.rname_to_id(arg, "GROUP")
70
+ set :format, :groupid, OpenNebulaHelper.rname_to_id_desc('GROUP') do |arg|
71
+ OpenNebulaHelper.rname_to_id(arg, 'GROUP')
72
72
  end
73
73
 
74
- set :format, :userid, OpenNebulaHelper.rname_to_id_desc("USER") do |arg|
75
- OpenNebulaHelper.rname_to_id(arg, "USER")
74
+ set :format, :userid, OpenNebulaHelper.rname_to_id_desc('USER') do |arg|
75
+ OpenNebulaHelper.rname_to_id(arg, 'USER')
76
76
  end
77
77
 
78
78
  ########################################################################
@@ -84,17 +84,17 @@ cmd=CommandParser::CmdParser.new(ARGV) do
84
84
  EOT
85
85
 
86
86
  command :create, create_desc, :file,
87
- :options=>[OneClusterHelper::CLUSTER] do
87
+ :options => [OneClusterHelper::CLUSTER] do
88
88
 
89
89
  cid = options[:cluster] || ClusterPool::NONE_CLUSTER_ID
90
90
 
91
91
  helper.create_resource(options) do |datastore|
92
92
  begin
93
- template=File.read(args[0])
93
+ template = File.read(args[0])
94
94
  datastore.allocate(template, cid)
95
- rescue =>e
95
+ rescue StandardError => e
96
96
  STDERR.puts e.message
97
- exit -1
97
+ exit(-1)
98
98
  end
99
99
  end
100
100
  end
@@ -104,7 +104,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
104
104
  EOT
105
105
 
106
106
  command :delete, delete_desc, [:range, :datastoreid_list] do
107
- helper.perform_actions(args[0],options,"deleted") do |obj|
107
+ helper.perform_actions(args[0], options, 'deleted') do |obj|
108
108
  obj.delete
109
109
  end
110
110
  end
@@ -113,8 +113,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
113
113
  Changes the Datastore group
114
114
  EOT
115
115
 
116
- command :chgrp, chgrp_desc,[:range, :datastoreid_list], :groupid do
117
- helper.perform_actions(args[0],options,"Group changed") do |obj|
116
+ command :chgrp, chgrp_desc, [:range, :datastoreid_list], :groupid do
117
+ helper.perform_actions(args[0], options, 'Group changed') do |obj|
118
118
  obj.chown(-1, args[1].to_i)
119
119
  end
120
120
  end
@@ -124,9 +124,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
124
124
  EOT
125
125
 
126
126
  command :chown, chown_desc, [:range, :datastoreid_list], :userid,
127
- [:groupid,nil] do
128
- gid = args[2].nil? ? -1 : args[2].to_i
129
- helper.perform_actions(args[0],options,"Owner/Group changed") do |obj|
127
+ [:groupid, nil] do
128
+ args[2].nil? ? gid = -1 : gid = args[2].to_i
129
+ helper.perform_actions(args[0], options, 'Owner/Group changed') do |obj|
130
130
  obj.chown(args[1].to_i, gid)
131
131
  end
132
132
  end
@@ -136,7 +136,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
136
136
  EOT
137
137
 
138
138
  command :chmod, chmod_desc, [:range, :datastoreid_list], :octet do
139
- helper.perform_actions(args[0],options, "Permissions changed") do |obj|
139
+ helper.perform_actions(args[0], options, 'Permissions changed') do |obj|
140
140
  obj.chmod_octet(args[1])
141
141
  end
142
142
  end
@@ -145,7 +145,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
145
145
  Lists Datastores in the pool
146
146
  EOT
147
147
 
148
- command :list, list_desc, :options=>list_options do
148
+ command :list, list_desc, :options => list_options do
149
149
  helper.list_pool(options)
150
150
  end
151
151
 
@@ -153,8 +153,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
153
153
  Shows information for the given Datastore
154
154
  EOT
155
155
 
156
- command :show, show_desc, :datastoreid, :options=>OpenNebulaHelper::XML do
157
- helper.show_resource(args[0],options)
156
+ command :show, show_desc, :datastoreid, :options => OpenNebulaHelper::XML do
157
+ helper.show_resource(args[0], options)
158
158
  end
159
159
 
160
160
  update_desc = <<-EOT.unindent
@@ -163,8 +163,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
163
163
  EOT
164
164
 
165
165
  command :update, update_desc, :datastoreid, [:file, nil],
166
- :options=>OpenNebulaHelper::APPEND do
167
- helper.perform_action(args[0],options,"modified") do |obj|
166
+ :options => OpenNebulaHelper::APPEND do
167
+ helper.perform_action(args[0], options, 'modified') do |obj|
168
168
  if options[:append]
169
169
  str = OpenNebulaHelper.append_template(args[0], obj, args[1])
170
170
  else
@@ -183,7 +183,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
183
183
  EOT
184
184
 
185
185
  command :rename, rename_desc, :datastoreid, :name do
186
- helper.perform_action(args[0],options,"renamed") do |o|
186
+ helper.perform_action(args[0], options, 'renamed') do |o|
187
187
  o.rename(args[1])
188
188
  end
189
189
  end
@@ -192,8 +192,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
192
192
  Enables the given Datastore. Only available for System Datastores
193
193
  EOT
194
194
 
195
- command :enable, enable_desc, [:range,:datastoreid_list] do
196
- helper.perform_actions(args[0],options,"enabled") do |obj|
195
+ command :enable, enable_desc, [:range, :datastoreid_list] do
196
+ helper.perform_actions(args[0], options, 'enabled') do |obj|
197
197
  obj.enable
198
198
  end
199
199
  end
@@ -202,8 +202,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
202
202
  Disables the given Datastore. Only available for System Datastores
203
203
  EOT
204
204
 
205
- command :disable, disable_desc, [:range,:datastoreid_list] do
206
- helper.perform_actions(args[0],options,"disabled") do |obj|
205
+ command :disable, disable_desc, [:range, :datastoreid_list] do
206
+ helper.perform_actions(args[0], options, 'disabled') do |obj|
207
207
  obj.disable
208
208
  end
209
209
  end