Skip to content
Snippets Groups Projects
Commit 151fa307 authored by Balasankar C's avatar Balasankar C Committed by Marin Jankovski
Browse files

Run Rubocop over gitlab-ctl-commands

parent 7c7c7287
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -6,5 +6,5 @@ Knapsack.load_tasks
 
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop) do |t|
t.options = ['-D', 'config', 'lib', 'spec']
t.options = ['-D', 'config', 'lib', 'spec', 'files/gitlab-ctl-commands']
end
Loading
Loading
@@ -32,8 +32,7 @@ add_command 'diff-config', 'Compare the user configuration with package availabl
command = %W( #{base_path}/embedded/bin/git
diff
#{user_config_file}
#{config_template_file}
)
#{config_template_file})
 
status = run_command(command.join(" "))
status.success?
Loading
Loading
Loading
Loading
@@ -76,7 +76,7 @@ add_command_under_category 'pg-upgrade', 'database',
unless progress_message(
'Checking for an omnibus managed postgresql') do
!running_version.nil? && \
get_all_services.member?('postgresql')
get_all_services.member?('postgresql')
end
$stderr.puts 'No currently installed postgresql in the omnibus instance found.'
exit! 0
Loading
Loading
@@ -292,7 +292,7 @@ end
 
def progress_message(message, &block)
$stdout.print "\r#{message}:"
results = block.call
results = yield
if results
$stdout.print "\r#{message}: \e[32mOK\e[0m\n"
else
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@
# limitations under the License.
#
 
add_command_under_category 'registry-garbage-collect', 'container-registry', 'Run Container Registry garbage collection.', 2 do |cmd_name, path|
add_command_under_category 'registry-garbage-collect', 'container-registry', 'Run Container Registry garbage collection.', 2 do |cmd_name, path|
service_name = "registry"
 
unless service_enabled?(service_name)
Loading
Loading
@@ -25,7 +25,7 @@ add_command_under_category 'registry-garbage-collect', 'container-registry', 'R
 
config_file_path = path || '/var/opt/gitlab/registry/config.yml'
 
unless File.exists?(config_file_path)
unless File.exist?(config_file_path)
log "Didn't find #{config_file_path}, please supply the path to registry config.yml file, eg: gitlab-ctl registry-garbage-collect /path/to/config.yml"
exit! 1
end
Loading
Loading
@@ -34,7 +34,7 @@ add_command_under_category 'registry-garbage-collect', 'container-registry', 'R
log "Running garbage-collect using configuration from #{config_file_path}, this might take a while...\n"
status = run_command("/opt/gitlab/embedded/bin/registry garbage-collect #{config_file_path}")
 
if status.exitstatus == 0
if status.exitstatus.zero?
run_sv_command_for_service('start', service_name)
exit! 0
else
Loading
Loading
Loading
Loading
@@ -16,12 +16,10 @@
#
 
add_command "remove-accounts", "Delete *all* users and groups used by this package", 1 do
command = %W( chef-client
-z
-c #{base_path}/embedded/cookbooks/solo.rb
-o recipe[gitlab::remove_accounts]
)
-o recipe[gitlab::remove_accounts])
 
status = run_command(command.join(" "))
remove_old_node_state
Loading
Loading
Loading
Loading
@@ -18,7 +18,7 @@
add_command 'upgrade', 'Run migrations after a package upgrade', 1 do |cmd_name|
service_statuses = `#{base_path}/bin/gitlab-ctl status`
 
if /: runsv not running/.match(service_statuses) || service_statuses.empty? then
if /: runsv not running/ =~ service_statuses || service_statuses.empty?
log 'It looks like GitLab has not been configured yet; skipping the upgrade '\
'script.'
exit! 0
Loading
Loading
@@ -29,8 +29,7 @@ add_command 'upgrade', 'Run migrations after a package upgrade', 1 do |cmd_name|
-z
-c #{base_path}/embedded/cookbooks/solo.rb
-o recipe[gitlab::config]
-o recipe[gitlab::postgresql-bin]
)
-o recipe[gitlab::postgresql-bin])
 
status = run_command(command.join(" "))
status.success?
Loading
Loading
@@ -39,7 +38,7 @@ add_command 'upgrade', 'Run migrations after a package upgrade', 1 do |cmd_name|
end
 
auto_migrations_skip_file = "#{etc_path}/skip-auto-migrations"
if File.exists?(auto_migrations_skip_file)
if File.exist?(auto_migrations_skip_file)
log "Found #{auto_migrations_skip_file}, exiting..."
exit! 0
end
Loading
Loading
@@ -49,7 +48,7 @@ add_command 'upgrade', 'Run migrations after a package upgrade', 1 do |cmd_name|
run_sv_command_for_service('stop', sv_name)
end
 
MIGRATION_SERVICES = %w{postgresql redis}
MIGRATION_SERVICES = [%w(postgresql redis)].freeze
MIGRATION_SERVICES.each do |sv_name|
# If the service is disabled, e.g. because we are using an external
# Postgres server, then this command is a no-op.
Loading
Loading
@@ -103,7 +102,7 @@ add_command 'upgrade', 'Run migrations after a package upgrade', 1 do |cmd_name|
 
log 'Restarting previously running GitLab services'
get_all_services.each do |sv_name|
if /^run: #{sv_name}:/.match(service_statuses)
if /^run: #{sv_name}:/ =~ service_statuses
run_sv_command_for_service('start', sv_name)
end
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