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 #5861: service_ensure_stopped_at_boot is missing #146

Conversation

peckpeck
Copy link
Member

#
#####################################################################################

# @name Service check at boot
Copy link
Member

Choose a reason for hiding this comment

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

the name is incomplete

@ncharles
Copy link
Member

there are lots of similarity betwwen service_ensure_stopped_at_boot and service_ensure_started_at_boot
Couldn't there be some dryinfication going there ?

@peckpeck peckpeck force-pushed the bug_5861/service_ensure_stopped_at_boot_is_missing branch from f7638f4 to 2d864f4 Compare November 28, 2014 16:05
@peckpeck
Copy link
Member Author

@ncharles updated

vars:

systemctl_utility_present::
"command_to_check" string => "!${paths.path[systemctl]} is-enabled ${service_name}";
Copy link
Member

Choose a reason for hiding this comment

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

what is this ! doing there ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's for negating the return code, but it seems to be bash specific.

@peckpeck
Copy link
Member Author

@ncharles updated

@jooooooon
Copy link
Member

Your last commit is named xxx. Please rename.

@jooooooon
Copy link
Member

Agreed with @ncharles, this needs to be factorised. We should never duplicate code.

A simple approach would be to add a method called service_ensure_boot_status(service_name, status), and modify service_ensure_{started,stopped}_at_boot to just be wrappers that call this central method with the second argument as "enabled" or "disabled".

@peckpeck
Copy link
Member Author

peckpeck commented Dec 2, 2014

The only common part is the command call part.
Everything else consists of variables that are different and logging which is different

@ncharles
Copy link
Member

so, there is no may to DRY it a bit ?

@peckpeck
Copy link
Member Author

As said, there is almost nothing common between started and stopped at boot except the method structure.
I'm making a new PR to retarget this to v0.x

@peckpeck peckpeck force-pushed the bug_5861/service_ensure_stopped_at_boot_is_missing branch from 5572c9b to cbf0302 Compare January 26, 2016 09:53
@peckpeck
Copy link
Member Author

PR replaced by #310

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants