Handle errors and enable to create api_keys even without fflag

pull/13541/head
Alex Martín 7 years ago committed by Alex Martín
parent db91729710
commit 2b257f4c1b

@ -326,7 +326,7 @@ class User < Sequel::Model
save_metadata
self.load_avatar
db.after_commit { create_api_keys }
db.after_commit { create_api_keys } if has_feature_flag?('auth_api')
db_service.monitor_user_notification
sleep 1
@ -1705,7 +1705,6 @@ class User < Sequel::Model
end
def create_api_keys
return unless has_feature_flag?('auth_api')
carto_user = Carto::User.find(id)
carto_user.api_keys.create_master_key!

@ -80,7 +80,11 @@ namespace :user do
if user.nil?
puts "WARN: User #{email} not found"
else
begin
user.create_api_keys
rescue => e
"WARN: Unable to create api keys for user with email #{email}: #{e}"
end
end
end
end

Loading…
Cancel
Save