diff --git a/src/api/Gemfile b/src/api/Gemfile index 01491d9e102..1c134129798 100644 --- a/src/api/Gemfile +++ b/src/api/Gemfile @@ -60,7 +60,6 @@ gem 'mousetrap-rails' # for issue tracker communication gem 'xmlrpc' # Multiple feature switch -gem 'feature' gem 'flipper' gem 'flipper-active_record' # for profiling diff --git a/src/api/Gemfile.lock b/src/api/Gemfile.lock index 7ab4472c6ac..94fb150e4f9 100644 --- a/src/api/Gemfile.lock +++ b/src/api/Gemfile.lock @@ -151,7 +151,6 @@ GEM railties (>= 4.2.0) faker (1.9.6) i18n (>= 0.7) - feature (1.4.0) ffi (1.11.1) flipper (0.16.2) flipper-active_record (0.16.2) @@ -495,7 +494,6 @@ DEPENDENCIES experimental-influxdb-rails (>= 1.0.0.beta5) factory_bot_rails faker - feature flipper flipper-active_record flot-rails diff --git a/src/api/app/controllers/application_controller.rb b/src/api/app/controllers/application_controller.rb index 2015e3c3d6a..fa3e9758b33 100644 --- a/src/api/app/controllers/application_controller.rb +++ b/src/api/app/controllers/application_controller.rb @@ -90,13 +90,6 @@ def self.validate_action(opt) protected - # TODO: remove when all the migration from Feature to Flipper is finished. - # It'll be replaced by feature_enabled? - def feature_active?(feature) - return if Feature.active?(feature) - render file: Rails.root.join('public/404'), status: :not_found, layout: false - end - def validate_params params.each do |key, value| next if value.nil? diff --git a/src/api/app/controllers/webui/webui_controller.rb b/src/api/app/controllers/webui/webui_controller.rb index 6ebfb252c55..1dc9223051e 100644 --- a/src/api/app/controllers/webui/webui_controller.rb +++ b/src/api/app/controllers/webui/webui_controller.rb @@ -244,13 +244,6 @@ def require_package end end - # TODO: remove when all the migration from Feature to Flipper is finished. - # It'll be replaced by feature_enabled? - def feature_active?(feature) - return if Feature.active?(feature) - render file: Rails.root.join('public/404'), status: :not_found, layout: false - end - private def authenticator diff --git a/src/api/config/initializers/feature.rb b/src/api/config/initializers/feature.rb deleted file mode 100644 index 94bbf0dc7fd..00000000000 --- a/src/api/config/initializers/feature.rb +++ /dev/null @@ -1,3 +0,0 @@ -require_dependency 'feature_switch/obs_repository' -require_dependency 'feature_switch/feature' -Feature.set_repository(Feature::Repository::ObsRepository.new("#{Rails.root}/config/feature.yml", Rails.env)) diff --git a/src/api/lib/feature_switch/feature.rb b/src/api/lib/feature_switch/feature.rb deleted file mode 100644 index ba8a3f7003f..00000000000 --- a/src/api/lib/feature_switch/feature.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Feature - @perform_initial_refresh_for_user = true - - def self.active?(feature) - if User.possibly_nobody.in_beta? - # caching the feature.yml file, this is basically taken from Feature.active_features - if @auto_refresh || @perform_initial_refresh_for_user || (@next_refresh_after && Time.now > @next_refresh_after) - @data = YAML.load_file("#{Rails.root}/config/feature.yml").with_indifferent_access - @perform_initial_refresh_for_user = false - end - - Repository::ObsRepository::DEFAULTS.merge(@data.dig('beta', 'features') || {}).with_indifferent_access.fetch(feature, false) - else - active_features.include?(feature) - end - end -end diff --git a/src/api/lib/feature_switch/obs_repository.rb b/src/api/lib/feature_switch/obs_repository.rb deleted file mode 100644 index 7ea97da4538..00000000000 --- a/src/api/lib/feature_switch/obs_repository.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Feature - module Repository - # ObsRepository for active and inactive features based on YamlRepository having default values for each key in OBS - # - class ObsRepository < YamlRepository - DEFAULTS = {}.freeze - - # Read given file, perform erb evaluation and yaml parsing - # - # @param file_name [String] the file name fo the yaml config - # @return [Hash] - # - def read_file(file_name) - super.with_indifferent_access - end - - # Extracts active features from given hash - # - # @param data [Hash] hash parsed from yaml file - # @param selector [String] uses the value for this key as source of feature data - # - def get_active_features(data, selector) - data[@environment]['features'] = DEFAULTS.merge(data[@environment]['features']) - super - end - end - end -end diff --git a/src/api/spec/rails_helper.rb b/src/api/spec/rails_helper.rb index 42e9c8a20e5..4058ba75d00 100644 --- a/src/api/spec/rails_helper.rb +++ b/src/api/spec/rails_helper.rb @@ -69,9 +69,6 @@ # helper methods for authentication in models tests require 'support/models/models_authentication' -# support feature switch testing -require 'feature/testing' - # support Delayed Jobs require 'support/delayed_job'