Skip to content

Instantly share code, notes, and snippets.

@iNecas
Last active January 4, 2016 22:18
Show Gist options
  • Save iNecas/8686461 to your computer and use it in GitHub Desktop.
Save iNecas/8686461 to your computer and use it in GitHub Desktop.
diff --git a/app/models/katello/concerns/organization_extensions.rb b/app/models/katello/concerns/organization_extensions.rb
index 39a6480..294097d 100644
--- a/app/models/katello/concerns/organization_extensions.rb
+++ b/app/models/katello/concerns/organization_extensions.rb
@@ -19,7 +19,11 @@ module Katello
ALLOWED_DEFAULT_INFO_TYPES = %w(system distributor)
- include ForemanTasks::Concerns::ActionSubject
+ # We need this to be able to scratch build in koji
+ # TODO: remove after new dynflow is build in koji
+ if defined? ForemanTasks
+ include ForemanTasks::Concerns::ActionSubject
+ end
include Glue::Candlepin::Owner if Katello.config.use_cp
include Glue if Katello.config.use_cp
diff --git a/app/models/katello/product.rb b/app/models/katello/product.rb
index 5165c31..faf3552 100644
--- a/app/models/katello/product.rb
+++ b/app/models/katello/product.rb
@@ -14,7 +14,11 @@ module Katello
class Product < Katello::Model
self.include_root_in_json = false
- include ForemanTasks::Concerns::ActionSubject
+ # We need this to be able to scratch build in koji
+ # TODO: remove after new dynflow is build in koji
+ if defined? ForemanTasks
+ include ForemanTasks::Concerns::ActionSubject
+ end
include Glue::ElasticSearch::Product if Katello.config.use_elasticsearch
include Glue::Candlepin::Product if Katello.config.use_cp
include Glue::Pulp::Repos if Katello.config.use_pulp
diff --git a/app/models/katello/provider.rb b/app/models/katello/provider.rb
index 29c547c..513584e 100644
--- a/app/models/katello/provider.rb
+++ b/app/models/katello/provider.rb
@@ -14,7 +14,11 @@ module Katello
class Provider < Katello::Model
self.include_root_in_json = false
- include ForemanTasks::Concerns::ActionSubject
+ # We need this to be able to scratch build in koji
+ # TODO: remove after new dynflow is build in koji
+ if defined? ForemanTasks
+ include ForemanTasks::Concerns::ActionSubject
+ end
include Glue::ElasticSearch::Provider if Katello.config.use_elasticsearch
include Glue::Provider
include Glue
diff --git a/app/models/katello/repository.rb b/app/models/katello/repository.rb
index b2bbcbe..a90859f 100644
--- a/app/models/katello/repository.rb
+++ b/app/models/katello/repository.rb
@@ -16,7 +16,11 @@ class Repository < Katello::Model
before_destroy :assert_deletable
- include ForemanTasks::Concerns::ActionSubject
+ # We need this to be able to scratch build in koji
+ # TODO: remove after new dynflow is build in koji
+ if defined? ForemanTasks
+ include ForemanTasks::Concerns::ActionSubject
+ end
include Glue::Candlepin::Content if (Katello.config.use_cp && Katello.config.use_pulp)
include Glue::Pulp::Repo if Katello.config.use_pulp
include Glue::ElasticSearch::Repository if Katello.config.use_elasticsearch
diff --git a/app/models/katello/system.rb b/app/models/katello/system.rb
index 42d32aa..7f996ca 100644
--- a/app/models/katello/system.rb
+++ b/app/models/katello/system.rb
@@ -19,7 +19,11 @@ class System < Katello::Model
define_hooks :add_system_group_hook, :remove_system_group_hook,
:as_json_hook
- include ForemanTasks::Concerns::ActionSubject
+ # We need this to be able to scratch build in koji
+ # TODO: remove after new dynflow is build in koji
+ if defined? ForemanTasks
+ include ForemanTasks::Concerns::ActionSubject
+ end
include Glue::Candlepin::Consumer if Katello.config.use_cp
include Glue::Pulp::Consumer if Katello.config.use_pulp
include Glue if Katello.config.use_cp || Katello.config.use_pulp
diff --git a/katello.gemspec b/katello.gemspec
index 3b0227e..60bb9ea 100644
--- a/katello.gemspec
+++ b/katello.gemspec
@@ -37,7 +37,10 @@ Gem::Specification.new do |gem|
gem.add_dependency "tire", "~> 0.6.0"
gem.add_dependency "logging", ">= 1.8.0"
gem.add_dependency "hooks"
- gem.add_dependency "foreman-tasks", "~> 0.1.0"
+ gem.add_dependency "dynflow"
+ # We need this to be able to scratch build in koji
+ # TODO: uncomment after new dynflow is build in koji
+ # gem.add_dependency "foreman-tasks", "~> 0.1.0"
gem.add_dependency "justified"
gem.add_dependency "strong_parameters", "~> 0.2.1" # remove after we upgrade to Rails 4
diff --git a/lib/katello.rb b/lib/katello.rb
index 53375bf..ff54634 100644
--- a/lib/katello.rb
+++ b/lib/katello.rb
@@ -10,7 +10,13 @@ require "gettext_i18n_rails"
require "i18n_data"
require "hooks"
require "foreigner"
-require "foreman-tasks"
+# We need this to be able to scratch build in koji
+# TODO: remove after new dynflow is build in koji
+require "dynflow"
+require "dynflow/version"
+if Dynflow::VERSION > '0.1.0'
+ require "foreman_tasks"
+end
require "rest_client"
require "i18n_data"
require "justified/standard_error"
diff --git a/lib/katello/engine.rb b/lib/katello/engine.rb
index f19c72d..758a00c 100644
--- a/lib/katello/engine.rb
+++ b/lib/katello/engine.rb
@@ -23,12 +23,17 @@ module Katello
Apipie.configuration.api_controllers_matcher = "#{Katello::Engine.root}/app/controllers/katello/api/v2/*.rb"
end
+
initializer "katello.register_actions", :before => 'foreman_tasks.initialize_dynflow' do |app|
- ForemanTasks.dynflow.require!
- action_paths = %W[#{Katello::Engine.root}/app/lib/actions
+ # We need this to be able to scratch build in koji
+ # TODO: remove after new dynflow is build in koji
+ if defined? ForemanTasks
+ ForemanTasks.dynflow.require!
+ action_paths = %W[#{Katello::Engine.root}/app/lib/actions
#{Katello::Engine.root}/app/lib/headpin/actions
#{Katello::Engine.root}/app/lib/katello/actions]
- ForemanTasks.dynflow.config.eager_load_paths.concat(action_paths)
+ ForemanTasks.dynflow.config.eager_load_paths.concat(action_paths)
+ end
end
initializer "katello.load_app_instance_data" do |app|
diff --git a/rubygem-katello.spec b/rubygem-katello.spec
index b0b804b..43dedd3 100644
--- a/rubygem-katello.spec
+++ b/rubygem-katello.spec
@@ -150,8 +150,10 @@ BuildRequires: %{?scl_prefix}rubygem-sqlite3
BuildRequires: %{?scl_prefix}rubygem-tire => 0.6.0
BuildRequires: %{?scl_prefix}rubygem-tire < 0.7
BuildRequires: %{?scl_prefix}rubygem-logging >= 1.8.0
-BuildRequires: %{?scl_prefix}rubygem-hooks
-BuildRequires: %{?scl_prefix}rubygem-foreman-tasks >= 0.1.0
+BuildRequires: %{?scl_prefix}rubygem-hooks
+# TODO: switch dependency from dynflow to foreman-tasks once new
+# dynflow is in koji build root
+BuildRequires: %{?scl_prefix}rubygem-dynflow >= 0.1.0
BuildRequires: %{?scl_prefix}rubygem-justified
BuildRequires: %{?scl_prefix}rubygem-delayed_job => 3.0.2
BuildRequires: %{?scl_prefix}rubygem-delayed_job < 3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment