Commit 65afe7ed authored by Cindy Pallares's avatar Cindy Pallares

Check for force env var when rebuilding auth_keys

parent 08d19660
......@@ -523,7 +523,7 @@ more of the following options:
- `BACKUP=timestamp_of_backup` - Required if more than one backup exists.
Read what the [backup timestamp is about](#backup-timestamp).
- `force=yes` - Does not ask if the authorized_keys file should get regenerated and assumes 'yes' for warning that database tables will be removed.
- `force=yes` - Does not ask if the authorized_keys file should get regenerated and assumes 'yes' for warning that database tables will be removed, enabling the "Write to authorized_keys file" setting, and updating LDAP providers.
If you are restoring into directories that are mountpoints you will need to make
sure these directories are empty before attempting a restore. Otherwise GitLab
......
---
title: Check for force env var when rebuilding auth_keys
merge_request: 7419
author:
type: fixed
......@@ -126,19 +126,16 @@ namespace :gitlab do
puts authorized_keys_is_disabled_warning
answer = prompt('Do you want to permanently enable the "Write to authorized_keys file" setting now (yes/no)? '.color(:blue), %w{yes no})
if answer == 'yes'
puts 'Enabling the "Write to authorized_keys file" setting...'
uncached_settings = ApplicationSetting.last
uncached_settings.authorized_keys_enabled = true
uncached_settings.save!
puts 'Successfully enabled "Write to authorized_keys file"!'
puts ''
else
puts 'Leaving the "Write to authorized_keys file" setting disabled.'
puts 'Failed to rebuild authorized_keys file...'.color(:red)
exit 1
unless ENV['force'] == 'yes'
puts 'Do you want to permanently enable the "Write to authorized_keys file" setting now?'
ask_to_continue
end
puts 'Enabling the "Write to authorized_keys file" setting...'
Gitlab::CurrentSettings.current_application_settings.update!(authorized_keys_enabled: true)
puts 'Successfully enabled "Write to authorized_keys file"!'
puts ''
end
def authorized_keys_is_disabled_warning
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment