Skip to content
Snippets Groups Projects
Unverified Commit 5d51cf5a authored by Doug Stull's avatar Doug Stull
Browse files

Add rake task for excluding namespaces from free user cap

- to be ran with input file supplied by business

Changelog: added
EE: true
parent c8653e93
No related merge requests found
# frozen_string_literal: true
namespace :gitlab do
namespace :free_user_cap do
task exclude_namespaces: :environment do
logger = Logger.new($stdout)
logger.info('Starting modifying of exclusions for free user cap')
namespace_file = Settings.source.dirname + 'namespaces_to_exclude.txt'
if File.file?(namespace_file)
File.read(namespace_file).each_line do |namespace_id|
namespace_id.chomp!
namespace = Namespace.find_by_id(namespace_id)
if namespace
unless namespace.root?
logger.error("Namespace with id of #{namespace_id} is not a top level namespace, skipping.")
next
end
if namespace.update(exclude_from_free_user_cap: true)
logger.info("Success: namespace with id of #{namespace_id} updated.")
else
logger.error("Namespace with id of #{namespace_id} failed to update.")
end
else
logger.error("No namespace found with id of #{namespace_id}.")
end
end
else
logger.error("No file found. Ensure #{namespace_file} exists with one namespace id per line.")
end
logger.info('Finished modifying of exclusions for free user cap')
end
end
end
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