-
Notifications
You must be signed in to change notification settings - Fork 30
Added a systemctl class to the linux admin gem #117
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
Conversation
As init has been depricated it is quickly becoming necessary to use systemctl in its place.
@Fryguy please review |
I'd prefer to name the module generically (that way one could write an init subclass and a systemctl subclass and a "whatever-some-other-OS" uses subclass. |
Ah okay, currently the init stuff is in the Service class so I modelled this one after that. Would we want to add just systemctl to the generic module for now so we don't have to find the places that are currently using LinuxAdmin::Service or is there a better way to do that so we don't break things using the current implementation of Service? |
Oh I guess subclassing wouldn't change the namespace right? So we would probably be fine there. Forgive my ruby inexperience. |
@Fryguy is the idea to have an abstract class as a parent of all service management tool classes or something more like a proxy to determine which class to use based on what distro/version we are currently running on? |
I could use the existence of the systemctl command to determine when I would use that over the service command. |
lib/linux_admin/systemctl.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like name instead of id.
Yeah, my thoughts were that we'd be changing the interface of the existing Service class to make it a subclass so let's get this PR in since it's strictly an unbreaking change. We can tag it if need be, then we can do minor rework of the Service management classes to create a proxy base class that instantiates the subclasses under the covers. |
A little bit of both. See how we did Package (which has Rpm and Yum (and potentially Apt or whatver) as subclasses), or how we did RegistrationSystem (which has Rhn or SubscriptionManager as subclasses). Basically, a user could just say something like
Not really. Adding a new class changes the public API, which means at least a minor version release. Then when you change it again to remove it or renamespace it, it's another minor version release. If you guys just want something in for testing, you can use a SHA (no need for a tag), or even just use the reference to the branch on your fork. |
@Fryguy We were planning to continue to support the new class after we add the new generic one. This way can use systemctl directly if someone needed to do that. |
I was more thinking that we may have to rename things to make sense since |
Checked commits carbonin@88a2a3c .. carbonin@6894857 with rubocop 0.32.0 |
Oh I see, it implements the same methods too, so it's good. Even so, we try to not to use the specific subclass directly, instead opting for the generic interface. So, yeah, this is good to merge. Honestly though, creating the matching interface it probably like 30 minutes worth of work. |
Added a systemctl class to the linux admin gem
As init has been deprecated it is quickly becoming necessary
to use systemctl in its place.