From 26ed3d557050e1bc52c0b0378db9056855939d99 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Mon, 3 Jun 2019 13:36:24 +0200 Subject: [PATCH] L #-: Fix extra space after initial block def In accordance to new default rules in rubocop 0.71.0 --- src/cli/onedatastore | 1 - src/cli/oneflow | 1 - src/cli/onegroup | 1 - src/cli/oneimage | 1 - src/cli/onemarketapp | 2 -- src/cli/oneshowback | 2 -- src/cli/onetemplate | 5 ----- src/cli/oneuser | 6 ------ src/cli/onevdc | 4 ---- src/cli/onevm | 10 ---------- src/cli/onevntemplate | 2 -- src/cli/onevrouter | 2 -- src/cli/onezone | 1 - 13 files changed, 38 deletions(-) diff --git a/src/cli/onedatastore b/src/cli/onedatastore index 381dfaa916..a038291a4a 100755 --- a/src/cli/onedatastore +++ b/src/cli/onedatastore @@ -85,7 +85,6 @@ CommandParser::CmdParser.new(ARGV) do command :create, create_desc, :file, :options => [OneClusterHelper::CLUSTER] do - cid = options[:cluster] || ClusterPool::NONE_CLUSTER_ID helper.create_resource(options) do |datastore| diff --git a/src/cli/oneflow b/src/cli/oneflow index c44d94c631..eed1a1615c 100755 --- a/src/cli/oneflow +++ b/src/cli/oneflow @@ -717,7 +717,6 @@ CommandParser::CmdParser.new(ARGV) do command :action, action_desc, :service_id, :role_name, :vm_action, :options => [Service::PERIOD, Service::NUMBER] do - client = Service::Client.new( :username => options[:username], :password => options[:password], diff --git a/src/cli/onegroup b/src/cli/onegroup index 42ba01bccc..af51e97db1 100755 --- a/src/cli/onegroup +++ b/src/cli/onegroup @@ -86,7 +86,6 @@ CommandParser::CmdParser.new(ARGV) do command :create, create_desc, [:group_name, nil], :options => OpenNebulaHelper::GROUP_OPTIONS do - if options && options[:admin_user] if !options[:admin_password] STDERR.puts 'Admin user needs password' diff --git a/src/cli/oneimage b/src/cli/oneimage index 804a1e9c86..0ed89f6f40 100755 --- a/src/cli/oneimage +++ b/src/cli/oneimage @@ -142,7 +142,6 @@ CommandParser::CmdParser.new(ARGV) do create_desc, [:file, nil], :options => CREATE_OPTIONS + OneImageHelper::TEMPLATE_OPTIONS do - if options[:datastore].nil? && !options[:dry] STDERR.puts 'Datastore to save the image is mandatory: ' STDERR.puts '\t -d datastore_id' diff --git a/src/cli/onemarketapp b/src/cli/onemarketapp index 2e920c539d..2d080afed3 100755 --- a/src/cli/onemarketapp +++ b/src/cli/onemarketapp @@ -117,7 +117,6 @@ CommandParser::CmdParser.new(ARGV) do command :create, create_desc, [:file, nil], :options => CREATE_OPTIONS + OneMarketPlaceAppHelper::TEMPLATE_OPTIONS do - if options[:marketplace].nil? STDERR.puts 'Marketplace to save the app is mandatory: ' STDERR.puts '\t -m marketplace_id' @@ -216,7 +215,6 @@ CommandParser::CmdParser.new(ARGV) do command :update, update_desc, :appid, [:file, nil], :options => OpenNebulaHelper::APPEND do - helper.perform_action(args[0], options, 'modified') do |obj| if options[:append] str = OpenNebulaHelper.append_template(args[0], obj, args[1]) diff --git a/src/cli/oneshowback b/src/cli/oneshowback index 3dfc2ab4ef..ac70a1f611 100755 --- a/src/cli/oneshowback +++ b/src/cli/oneshowback @@ -50,7 +50,6 @@ CommandParser::CmdParser.new(ARGV) do AcctHelper::SHOWBACK_OPTIONS + CommandParser::OPTIONS + [OpenNebulaHelper::DESCRIBE, CLIHelper::LIST, CLIHelper::CSV_OPT] + OpenNebulaHelper::CLIENT_OPTIONS do - if options[:describe] AcctHelper::SHOWBACK_TABLE.describe_columns exit(0) @@ -142,7 +141,6 @@ CommandParser::CmdParser.new(ARGV) do command :calculate, 'Calculates the showback records', :options => [AcctHelper::START_TIME_SHOWBACK, AcctHelper::END_TIME_SHOWBACK] do - start_month = -1 start_year = -1 diff --git a/src/cli/onetemplate b/src/cli/onetemplate index 2f5031705b..e6c14cf32c 100755 --- a/src/cli/onetemplate +++ b/src/cli/onetemplate @@ -133,7 +133,6 @@ CommandParser::CmdParser.new(ARGV) do command :create, create_desc, [:file, nil], :options => [OneTemplateHelper::VM_NAME] + OpenNebulaHelper::TEMPLATE_OPTIONS + [OpenNebulaHelper::DRY] do - if args[0] && OpenNebulaHelper.create_template_options_used?(options) STDERR.puts 'You can not use both template file and template' \ ' creation options.' @@ -174,7 +173,6 @@ CommandParser::CmdParser.new(ARGV) do command :clone, clone_desc, :templateid, :name, :options => OneTemplateHelper::RECURSIVE do - recursive = (options[:recursive] == true) helper.perform_action(args[0], options, 'cloned') do |t| @@ -194,7 +192,6 @@ CommandParser::CmdParser.new(ARGV) do command :delete, delete_desc, [:range, :templateid_list], :options => OneTemplateHelper::RECURSIVE do - recursive = (options[:recursive] == true) helper.perform_actions(args[0], options, 'deleted') do |t| @@ -306,7 +303,6 @@ CommandParser::CmdParser.new(ARGV) do command :chmod, chmod_desc, [:range, :templateid_list], :octet, :options => OneTemplateHelper::RECURSIVE do - recursive = (options[:recursive] == true) helper.perform_actions(args[0], options, 'Permissions changed') do |t| @@ -359,7 +355,6 @@ CommandParser::CmdParser.new(ARGV) do command :show, show_desc, :templateid, :options => [OpenNebulaHelper::XML, OneTemplateHelper::EXTENDED] do - helper.show_resource(args[0], options) end diff --git a/src/cli/oneuser b/src/cli/oneuser index d6d85754c4..11bfe7687d 100755 --- a/src/cli/oneuser +++ b/src/cli/oneuser @@ -386,7 +386,6 @@ CommandParser::CmdParser.new(ARGV) do command :umask, umask_desc, [:range, :userid_list], [:mask, nil] do helper.perform_actions(args[0], options, 'umask changed') do |user| - rc = user.info if OpenNebula.is_error?(rc) @@ -582,7 +581,6 @@ CommandParser::CmdParser.new(ARGV) do command :passwdsearch, passwdsearch_desc, :driver, :password, :options => [CLIHelper::CSV_OPT, OpenNebulaHelper::XML] do - options[:list] = %w[ID NAME AUTH PASSWORD] options[:filter] = ["AUTH=#{args[0]}", "PASSWORD=#{args[1]}"] @@ -618,7 +616,6 @@ CommandParser::CmdParser.new(ARGV) do command :"token-create", token_add_desc, [:username, nil], :options => login_options do - helper.token_create(args, options) end @@ -648,7 +645,6 @@ CommandParser::CmdParser.new(ARGV) do command :"token-set", token_set_desc, [:username, nil], :options => login_options + set_options do - username = args[0] if username @@ -731,7 +727,6 @@ CommandParser::CmdParser.new(ARGV) do command :"token-delete", token_delete_desc, [:username, nil], :token, :options => login_options do - if args.length == 1 token_hint = args[0] else @@ -793,7 +788,6 @@ CommandParser::CmdParser.new(ARGV) do command :"token-delete-all", token_delete_all, :username, :options => login_options do - username = args[0] if username =~ /^\d+$/ diff --git a/src/cli/onevdc b/src/cli/onevdc index 26d16862af..4af6fd395d 100755 --- a/src/cli/onevdc +++ b/src/cli/onevdc @@ -72,7 +72,6 @@ CommandParser::CmdParser.new(ARGV) do set :format, :clusterid, "#{OpenNebulaHelper.rname_to_id_desc('CLUSTER')}. "\ 'Can be set to ALL' do |arg| - if !arg.nil? && arg.class != Integer && arg.casecmp('ALL').zero? @@ -85,7 +84,6 @@ CommandParser::CmdParser.new(ARGV) do set :format, :hostid, "#{OpenNebulaHelper.rname_to_id_desc('HOST')}. "\ 'Can be set to ALL' do |arg| - if !arg.nil? && arg.class != Integer && arg.casecmp('ALL').zero? @@ -98,7 +96,6 @@ CommandParser::CmdParser.new(ARGV) do set :format, :datastoreid, "#{OpenNebulaHelper.rname_to_id_desc('DATASTORE')}. "\ 'Can be set to ALL' do |arg| - if !arg.nil? && arg.class != Integer && arg.casecmp('ALL').zero? @@ -111,7 +108,6 @@ CommandParser::CmdParser.new(ARGV) do set :format, :vnetid, "#{OpenNebulaHelper.rname_to_id_desc('VNET')}. "\ 'Can be set to ALL' do |arg| - if !arg.nil? && arg.class != Integer && arg.casecmp('ALL').zero? diff --git a/src/cli/onevm b/src/cli/onevm index 3611e40449..d02b85a213 100755 --- a/src/cli/onevm +++ b/src/cli/onevm @@ -249,7 +249,6 @@ CommandParser::CmdParser.new(ARGV) do command :create, create_desc, [:file, nil], :options => [OneVMHelper::MULTIPLE, OneVMHelper::HOLD] + OpenNebulaHelper::TEMPLATE_OPTIONS_VM do - number = options[:multiple] || 1 exit_code = nil @@ -373,7 +372,6 @@ CommandParser::CmdParser.new(ARGV) do command :"disk-saveas", disk_saveas_desc, :vmid, :diskid, :img_name, :options => [TYPE, SNAP] do - disk_id = args[1].to_i image_name = args[2] image_type = options[:type] || '' @@ -418,7 +416,6 @@ CommandParser::CmdParser.new(ARGV) do OneVMHelper::HOURLY, OneVMHelper::END_TIME, OneVMHelper::HARD] do - command_name = 'terminate' command_name << '-hard' if options[:hard] @@ -447,7 +444,6 @@ CommandParser::CmdParser.new(ARGV) do OneVMHelper::HOURLY, OneVMHelper::END_TIME, OneVMHelper::HARD] do - command_name = 'undeploy' command_name << '-hard' if options[:hard] @@ -475,7 +471,6 @@ CommandParser::CmdParser.new(ARGV) do OneVMHelper::HOURLY, OneVMHelper::END_TIME, OneVMHelper::HARD] do - command_name = 'poweroff' command_name << '-hard' if options[:hard] @@ -505,7 +500,6 @@ CommandParser::CmdParser.new(ARGV) do OneVMHelper::HOURLY, OneVMHelper::END_TIME, OneVMHelper::HARD] do - command_name = 'reboot' command_name << '-hard' if options[:hard] @@ -711,7 +705,6 @@ CommandParser::CmdParser.new(ARGV) do command :"disk-attach", disk_attach_desc, :vmid, :options => [OneVMHelper::FILE, OneVMHelper::IMAGE, TARGET, CACHE, DISCARD, PREFIX] do - if options[:file].nil? && options[:image].nil? STDERR.puts 'Provide a template file or an image:' STDERR.puts '\t--file ' @@ -779,7 +772,6 @@ CommandParser::CmdParser.new(ARGV) do OneVMHelper::IP, OneVMHelper::ALIAS, OneVMHelper::NIC_NAME] do - if options[:file].nil? && options[:network].nil? STDERR.puts 'Provide a template file or a network:' STDERR.puts "\t--file " @@ -924,7 +916,6 @@ CommandParser::CmdParser.new(ARGV) do OneVMHelper::YEARLY, OneVMHelper::HOURLY, OneVMHelper::END_TIME] do - if !options[:schedule].nil? helper.schedule_actions(args[0], options, @comm_name) else @@ -1099,7 +1090,6 @@ CommandParser::CmdParser.new(ARGV) do command :resize, resize_desc, :vmid, :options => OpenNebulaHelper::CAPACITY_OPTIONS_VM + [ENFORCE, OneVMHelper::FILE] do - if options[:file] template = File.read(options[:file]) else diff --git a/src/cli/onevntemplate b/src/cli/onevntemplate index 647320d78e..7ef4a08041 100755 --- a/src/cli/onevntemplate +++ b/src/cli/onevntemplate @@ -122,7 +122,6 @@ CommandParser::CmdParser.new(ARGV) do command :create, create_desc, [:file, nil], :options => [OpenNebulaHelper::DRY] do - helper.create_resource(options) do |tmpl| begin if args[0] @@ -307,7 +306,6 @@ CommandParser::CmdParser.new(ARGV) do command :show, show_desc, :templateid, :options => [OpenNebulaHelper::XML, OneTemplateHelper::EXTENDED] do - helper.show_resource(args[0], options) end diff --git a/src/cli/onevrouter b/src/cli/onevrouter index 32017fcfca..bb099d5f68 100755 --- a/src/cli/onevrouter +++ b/src/cli/onevrouter @@ -146,7 +146,6 @@ CommandParser::CmdParser.new(ARGV) do :vrouterid, :templateid, [:file, nil], :options => instantiate_options + OpenNebulaHelper::TEMPLATE_OPTIONS do - if args[2] && OpenNebulaHelper.create_template_options_used?(options) STDERR.puts 'You cannot use both template file and template' \ ' creation options.' @@ -275,7 +274,6 @@ CommandParser::CmdParser.new(ARGV) do OneVMHelper::NETWORK, OneVMHelper::IP, OneVirtualRouterHelper::FLOAT] do - if options[:file].nil? && options[:network].nil? STDERR.puts 'Provide a template file or a network:' STDERR.puts "\t--file " diff --git a/src/cli/onezone b/src/cli/onezone index dc84c2a2ff..568531b7e4 100755 --- a/src/cli/onezone +++ b/src/cli/onezone @@ -106,7 +106,6 @@ CommandParser::CmdParser.new(ARGV) do command :"server-add", addserver_desc, :zoneid, :options => [OneZoneHelper::SERVER_NAME, OneZoneHelper::SERVER_ENDPOINT] do - if options[:server_name].nil? || options[:server_rpc].nil? STDERR.puts 'To add a server set:' STDERR.puts "\t-n "