-
Notifications
You must be signed in to change notification settings - Fork 38
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 #7192: Rewrite the service_* methods #544
Conversation
Still being tested, but the implementation should be complete now. |
classes: | ||
# This method can be called as a substitution if service_ensure_running is called directly, with service_path=service_name | ||
# In this case, we don't need to call service_check_running_ps but can use better OS-specific methods if available | ||
"real_path" not => strcmp("${service_name}", "${service_path}"); |
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.
This is an incompatible change, but I see previous behavior like a bug more than a feature...
ecceed9
to
f8082a1
Compare
Commit modified |
1 similar comment
Commit modified |
f8082a1
to
ee82423
Compare
debian_8:: | ||
# This is to workaround a bug in Debian Jessie, that makes systemctl is-enabled | ||
# fail if run against a service that still uses SysV style scripts | ||
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=760616 |
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.
This bug was marked as fixed on 29/05/2015, is it still relevant to keep this exception ?
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.
It seems it was only fixed in unstable, and not in stable (by a systemd upgrade).
@@ -62,14 +63,17 @@ bundle agent service_ensure_stopped(service_name) | |||
usebundle => _classes_copy("${class_prefix}_stop_if_running", "${class_prefix}"), | |||
ifvarclass => "has_promiser_stack.${class_prefix}_check_running_kept"; | |||
|
|||
windows:: | |||
"action" usebundle => service_stop("${service_name}"); |
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.
why not keeping the windows service code there ?
Commit modified |
ee82423
to
40b05e8
Compare
Replaced command_execution and commands promise by returnszero. Allows:
|
tree/20_cfe_basics/ncf_lib.cf
Outdated
# Set variables with the error | ||
# Test behavior with unkown action | ||
# is-active not implemented for service/init.d | ||
bundle agent ncf_services(service, action) |
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.
If i understand correctly, it will mostly return "repair" outcome, am I right ?
"${configuration.error} The ${action} action is not supported on Windows (use 'start', 'stop' or 'restart')"; | ||
|
||
pass3.info.method_found.(!windows|is_valid_action):: | ||
"${configuration.info} Executing ${action} on ${service} using the ${method} method"; |
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.
great
@@ -75,14 +67,17 @@ bundle agent service_ensure_running_path(service_name, service_path) | |||
usebundle => _classes_success("${old_class_prefix}"), | |||
ifvarclass => "(real_path.service_check_running_${canonified_service_path}_kept)|(!real_path.service_check_running_${canonified_service_name}_kept)"; | |||
|
|||
windows:: |
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.
Why not keeping this as a servies: promise type ?
ifvarclass => "service_check_started_at_boot_${canonified_service_name}_not_ok"; | ||
|
||
"copy classes" | ||
usebundle => _classes_copy("${class_prefix}_define_at_boot", "${class_prefix}"), | ||
ifvarclass => "${class_prefix}_check_at_boot_not_ok"; | ||
|
||
windows:: |
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.
why not keeping this one also ?
Commit modified |
cf762a1
to
8633500
Compare
Commit modified |
1 similar comment
Commit modified |
8633500
to
c9cda8f
Compare
Commit modified |
c9cda8f
to
7aafd2d
Compare
Commit modified |
7aafd2d
to
6f01242
Compare
Commit modified |
5a65e0a
to
bc9de88
Compare
Commit modified |
##### | ||
pass2.is_check_action.!windows.!is_process_action.method_found.action_ok:: | ||
"force_success_class" usebundle => _classes_success("${old_class_prefix}"); | ||
"force_success_class" usebundle => _classes_success("${class_prefix}"); |
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.
we should have _classes_success_two (or equivalent) (this is not the place of this PR thought)
Commit modified |
bd7e014
to
d8cf46e
Compare
Changed the way to handle |
Commit modified |
d8cf46e
to
f18cb97
Compare
Failing tests:
|
Commit modified |
f18cb97
to
a148e98
Compare
TODO:
|
Also missing proper upstart support. |
Commit modified |
a148e98
to
166364e
Compare
Commit modified |
166364e
to
76c2673
Compare
Currently failing on Ubuntu 14.04:
|
I'd like to point out that on master branch, the tests
|
Commit modified |
76c2673
to
bd57e32
Compare
Added upstart support! |
bd57e32
to
3fbda7e
Compare
Commit modified |
tree/20_cfe_basics/ncf_lib.cf
Outdated
"upstart_action_cmd[reload]" string => "/sbin/initctl reload ${service}"; | ||
"upstart_action_cmd[is-active]" string => "/sbin/initctl status ${service} | grep -q ' start/'"; | ||
# boot | ||
"upstart_action_cmd[enable]" string => "${paths.path[sed]} -i '/manual/d' /etc/init/${service}.override"; |
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.
this sed is not anchored, would it be an issue ?
Commit modified |
3fbda7e
to
56ee829
Compare
Commit modified |
56ee829
to
86c2e96
Compare
OK, merging this PR |
https://www.rudder-project.org/redmine/issues/7192