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 #8016 - api connection moved to context #227

Merged
merged 1 commit into from
Dec 9, 2016

Conversation

tstrachota
Copy link
Member

@tstrachota tstrachota commented Nov 24, 2016

  • connection moved to context
  • connection is now instance, not class

TODO:

  • fix tests

- connection moved to context
- connection is now instance, not class
- dependency injection for connection and connectors
:defaults => HammerCLI.defaults,
:is_tty? => HammerCLI.tty?
:is_tty? => HammerCLI.tty?,
:api_connection => HammerCLI::Connection.new(Logging.logger['Connection'])
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 move this to command initializer and add just the attributes missing? This way you could provide only part of the context to the command and the rest would be replaced with the defaults. The context would also be accessible with @context?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure I understand. The context is passed to commands' constructors and is accessible as self.context or @context.
I don't think setting a default value for the api connection makes sense in this case, because we need one connection for the whole hammer.

Copy link
Member

Choose a reason for hiding this comment

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

I see, sorry for the confusion.

@mbacovsky
Copy link
Member

The context is not blocker for getting this merged. It just occurred to me that while Clamp allows to provide the context as command parameter. We would not be able to add the api_connection when it is missing there.

I'd like to know if you think it should be fixed in this PR. Otherwise I'm going to merge it.

@mbacovsky
Copy link
Member

👍 Thanks @tstrachota!

@mbacovsky mbacovsky merged commit 49b9d45 into theforeman:master Dec 9, 2016
@tstrachota tstrachota deleted the sessions_8016 branch May 17, 2017 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants