Skip to content
Snippets Groups Projects
Commit f416cc35 authored by Balasankar C's avatar Balasankar C
Browse files

Make everything rubocop friendly

parent a47de2dd
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -540,7 +540,7 @@ Style/WordArray:
# branches, and conditions.
Metrics/AbcSize:
Enabled: true
Max: 60
Max: 100
 
# This cop checks if the length of a block exceeds some maximum value.
Metrics/BlockLength:
Loading
Loading
Loading
Loading
@@ -6,7 +6,6 @@ Knapsack.load_tasks
 
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop) do |t|
# This will be removed once everything is made Rubocop friendly.
t.options = ['-D', 'config',
'lib',
Loading
Loading
Loading
Loading
@@ -10,7 +10,7 @@ host = `hostname`.strip
external_url "http://#{host}"
 
# Load custom config from environment variable: GITLAB_OMNIBUS_CONFIG
eval ENV["GITLAB_OMNIBUS_CONFIG"].to_s
eval ENV["GITLAB_OMNIBUS_CONFIG"].to_s # rubocop:disable Security/Eval
 
# Load configuration stored in /etc/gitlab/gitlab.rb
from_file("/etc/gitlab/gitlab.rb")
Loading
Loading
@@ -2,8 +2,8 @@ require_relative 'package/libraries/handlers/gitlab'
require_relative 'package/libraries/formatters/gitlab'
CURRENT_PATH = File.expand_path(File.dirname(__FILE__))
TIME = Time.now.to_i
LOG_PATH = '/var/log/gitlab/reconfigure'
Dir.exists?(LOG_PATH) || FileUtils.mkdir_p(LOG_PATH)
LOG_PATH = '/var/log/gitlab/reconfigure'.freeze
Dir.exist?(LOG_PATH) || FileUtils.mkdir_p(LOG_PATH)
add_formatter :gitlab
file_cache_path "#{CURRENT_PATH}/cache"
cookbook_path CURRENT_PATH
Loading
Loading
@@ -21,36 +21,36 @@ log_level :info
# disable it. For example, ':Groovy,' is uncommented because omnibus-gitlab
# does not care about Groovy.
ohai.disabled_plugins = [
:Azure,
:Cloud,
:CloudV2,
:DMI,
:DigitalOcean,
:EC2,
:Erlang,
:Elixir,
:Eucalyptus,
:GCE,
:Groovy,
:Go,
:Java,
:Joyent,
:Linode,
:Lua,
:Mono,
:NetworkListeners,
:NetworkRoutes,
:Nodejs,
:Openstack,
:Perl,
:PHP,
:Powershell,
:Python,
:Rackspace,
:Rust,
:Virtualbox,
:VMware,
:SystemProfile,
:Zpools,
:Virtualization
:Azure,
:Cloud,
:CloudV2,
:DMI,
:DigitalOcean,
:EC2,
:Erlang,
:Elixir,
:Eucalyptus,
:GCE,
:Groovy,
:Go,
:Java,
:Joyent,
:Linode,
:Lua,
:Mono,
:NetworkListeners,
:NetworkRoutes,
:Nodejs,
:Openstack,
:Perl,
:PHP,
:Powershell,
:Python,
:Rackspace,
:Rust,
:Virtualbox,
:VMware,
:SystemProfile,
:Zpools,
:Virtualization
]
Loading
Loading
@@ -41,9 +41,7 @@ module Geo
 
print '*** Are you sure? (N/y): '.color(:green)
 
unless STDIN.gets.chomp.downcase == 'y'
raise 'Exited because primary node must be down'
end
raise 'Exited because primary node must be down' unless STDIN.gets.chomp.casecmp('y').zero?
end
 
def promote_postgresql_to_primary
Loading
Loading
@@ -61,9 +59,7 @@ module Geo
puts
puts 'SSH keys detected! Remove? See https://docs.gitlab.com/ee/gitlab-geo/disaster-recovery.html#promoting-a-secondary-node for more information [Y/n]'.color(:yellow)
 
if STDIN.gets.chomp.downcase == 'n'
return true
end
return true if STDIN.gets.chomp.casecmp('n').zero?
end
 
[key_path, public_key_path].each do |path|
Loading
Loading
@@ -96,7 +92,7 @@ module Geo
end
 
def public_key_path
@public_key_path ||= File.join(git_user_home ,'.ssh/id_rsa.pub')
@public_key_path ||= File.join(git_user_home, '.ssh/id_rsa.pub')
end
end
end
Loading
Loading
@@ -92,7 +92,7 @@ module Geo
return if @options[:skip_replication_slot]
 
puts "* Checking for replication slot #{@options[:slot_name]}".color(:green)
unless replication_slot_exists?
unless replication_slot_exists? # rubocop:disable Style/GuardClause
puts "* Creating replication slot #{@options[:slot_name]}".color(:green)
create_replication_slot!
end
Loading
Loading
@@ -113,7 +113,7 @@ module Geo
file.write(<<~EOF
#{@options[:host]}:#{@options[:port]}:*:#{@options[:user]}:#{@options[:password]}
EOF
)
)
end
run_command("chown gitlab-psql #{@pgpass}")
end
Loading
Loading
@@ -126,7 +126,7 @@ module Geo
primary_conninfo = 'host=#{@options[:host]} port=#{@options[:port]} user=#{@options[:user]} password=#{@options[:password]} sslmode=#{@options[:sslmode]}'
trigger_file = '/tmp/postgresql.trigger'
EOF
)
)
file.write("primary_slot_name = '#{@options[:slot_name]}'\n") if @options[:slot_name]
end
run_command("chown gitlab-psql #{recovery_file}")
Loading
Loading
Loading
Loading
@@ -92,10 +92,10 @@ class GeoReplicationCommand
 
opts_parser.parse!(arguments)
 
raise OptionParser::MissingArgument.new(:host) unless @options.fetch(:host)
raise OptionParser::MissingArgument.new('--slot-name') unless @options[:skip_replication_slot] || @options.fetch(:slot_name)
raise OptionParser::MissingArgument, :host unless @options.fetch(:host)
raise OptionParser::MissingArgument, '--slot-name' unless @options[:skip_replication_slot] || @options.fetch(:slot_name)
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
puts $!.to_s
puts $ERROR_INFO.to_s
puts opts_parser
exit 1
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment