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 #37319 - Allow setting IDs for outputs #135

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

adamruzicka
Copy link
Contributor

and switch runner output interface to be keyword based.

@@ -37,18 +37,20 @@ def humanize
raw_outputs.map { |output| output['output'] }.join("\n")
end

def add_exception(context, exception, timestamp = Time.now.getlocal)
add_output(context + ": #{exception.class} - #{exception.message}", 'debug', timestamp)
def add_exception(context, exception, timestamp: Time.now.getlocal, id: nil)
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this an API change?

def add_exception(context, exception, timestamp = 'now')
  puts timestamp
end

def add_exception_new(context, exception, timestamp: 'now')
  puts timestamp
end

add_exception('a', 'b')
add_exception('a', 'b', 'explicit')

add_exception_new('a', 'b')
add_exception_new('a', 'b', 'explicit')
$ ruby test2.rb
now
explicit
now
test2.rb:5:in `add_exception_new': wrong number of arguments (given 3, expected 2) (ArgumentError)
	from test2.rb:13:in `<main>'

Or do you accept it since it only appears to be used internally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While this isn't strictly private api, none of the smart proxy plugins which depend on sp-dynflow seem to use this, so I'd be willing to let it slide.

Comment on lines 44 to 45
def add_output(*args, **kwargs)
add_raw_output(self.class.format_output(*args, **kwargs))
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to also just forward the arguments here?

Suggested change
def add_output(*args, **kwargs)
add_raw_output(self.class.format_output(*args, **kwargs))
def add_output(...)
add_raw_output(self.class.format_output(...))

and switch runner output interface to be keyword based.
@adamruzicka adamruzicka merged commit 6d50bbc into theforeman:master Nov 5, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants