Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #12288 - disable transactions for plan phase in run host job action #74

Merged
merged 1 commit into from Dec 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/lib/actions/remote_execution/run_host_job.rb
Expand Up @@ -2,6 +2,7 @@ module Actions
module RemoteExecution
class RunHostJob < Actions::EntryAction

middleware.do_not_use Dynflow::Middleware::Common::Transaction
include Actions::RemoteExecution::Helpers::LiveOutput

def resource_locks
Expand All @@ -10,6 +11,9 @@ def resource_locks

def plan(job_invocation, host, template_invocation, proxy, connection_options = {})
action_subject(host, :job_name => job_invocation.job_name)
link!(job_invocation)
link!(template_invocation)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for moving those three lines is to create the links before any error can be raised?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to do that as soon as possible, before any other error occurs, so that one can get to the errors form the linked resource

hostname = find_ip_or_hostname(host)

raise _("Could not use any template used in the job invocation") if template_invocation.blank?
Expand All @@ -24,9 +28,6 @@ def plan(job_invocation, host, template_invocation, proxy, connection_options =
script = renderer.render
raise _("Failed rendering template: %s") % renderer.error_message unless script

link!(job_invocation)
link!(template_invocation)

provider = template_invocation.template.provider_type.to_s
plan_action(RunProxyCommand, proxy, hostname, script, { :connection_options => connection_options }.merge(provider_settings(provider, host)))
plan_self
Expand Down
1 change: 1 addition & 0 deletions foreman_remote_execution.gemspec
Expand Up @@ -20,6 +20,7 @@ Gem::Specification.new do |s|

s.add_dependency "deface"
s.add_dependency "rails", "~> 3.2.8"
s.add_dependency "dynflow", "~> 0.8.8"
s.add_dependency "foreman-tasks", "~> 0.7.6"

s.add_development_dependency 'rubocop'
Expand Down