Permalink
Browse files

Merge pull request #567 from kacfengine/issue-2468

Issue 2468
  • Loading branch information...
dottedmag committed Apr 24, 2013
2 parents 37d6301 + e5d66eb commit 50e3900f7a56985ab8718a4dec473b4c5e5fae00
@@ -75,6 +75,8 @@ static int ServicesSanityChecks(Attributes a, Promise *pp)
case SERVICE_POLICY_STOP:
case SERVICE_POLICY_DISABLE:
+ case SERVICE_POLICY_RESTART:
+ case SERVICE_POLICY_RELOAD:
if (strcmp(a.service.service_autostart_policy, "none") != 0)
{
CfOut(OUTPUT_LEVEL_ERROR, "",
@@ -209,7 +211,7 @@ static void DoVerifyServices(EvalContext *ctx, Attributes a, Promise *pp)
case SERVICE_POLICY_RELOAD:
RlistAppendScalar(&args, pp->promiser);
- RlistAppendScalar(&args, "restart");
+ RlistAppendScalar(&args, "reload");
break;
case SERVICE_POLICY_STOP:
View
@@ -651,7 +651,7 @@ AclInheritance AclInheritanceFromString(const char *string)
ServicePolicy ServicePolicyFromString(const char *string)
{
- static const char *SERVICE_POLICY_TYPES[5] = { "start", "stop", "disable", "restart", NULL };
+ static const char *SERVICE_POLICY_TYPES[5] = { "start", "stop", "disable", "restart", "reload", NULL };
return FindTypeInArray(SERVICE_POLICY_TYPES, string, SERVICE_POLICY_START, SERVICE_POLICY_START);
}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,55 @@
+#######################################################
+#
+# Test services reload keyword
+#
+#######################################################
+
+body common control
+{
+ inputs => { "../default.cf.sub" };
+ bundlesequence => { default("$(this.promise_filename)") };
+ version => "1.0";
+}
+
+#######################################################
+
+bundle agent init
+{
+ vars:
+ "dummy" string => "dummy";
+}
+
+#######################################################
+
+bundle agent test
+{
+ services:
+ "myservice"
+ service_policy => "reload",
+ service_method => service_test;
+}
+
+body service_method service_test {
+ service_bundle => test_services("$(this.promiser)","$(this.service_policy)");
+}
+
+bundle agent test_services(service, state) {
+ vars:
+ "service_state" string => "$(state)";
+}
+
+
+#######################################################
+
+bundle agent check
+{
+ classes:
+ "ok" expression => strcmp("reload", "$(test_services.service_state)");
+
+ reports:
+ ok::
+ "$(this.promise_filename) Pass";
+ !ok::
+ "$(this.promise_filename) FAIL";
+}
+
@@ -0,0 +1,55 @@
+#######################################################
+#
+# Test services restart keyword
+#
+#######################################################
+
+body common control
+{
+ inputs => { "../default.cf.sub" };
+ bundlesequence => { default("$(this.promise_filename)") };
+ version => "1.0";
+}
+
+#######################################################
+
+bundle agent init
+{
+ vars:
+ "dummy" string => "dummy";
+}
+
+#######################################################
+
+bundle agent test
+{
+ services:
+ "myservice"
+ service_policy => "restart",
+ service_method => service_test;
+}
+
+body service_method service_test {
+ service_bundle => test_services("$(this.promiser)","$(this.service_policy)");
+}
+
+bundle agent test_services(service, state) {
+ vars:
+ "service_state" string => "$(state)";
+}
+
+
+#######################################################
+
+bundle agent check
+{
+ classes:
+ "ok" expression => strcmp("restart", "$(test_services.service_state)");
+
+ reports:
+ ok::
+ "$(this.promise_filename) Pass";
+ !ok::
+ "$(this.promise_filename) FAIL";
+}
+
@@ -0,0 +1,55 @@
+#######################################################
+#
+# Test services start keyword
+#
+#######################################################
+
+body common control
+{
+ inputs => { "../default.cf.sub" };
+ bundlesequence => { default("$(this.promise_filename)") };
+ version => "1.0";
+}
+
+#######################################################
+
+bundle agent init
+{
+ vars:
+ "dummy" string => "dummy";
+}
+
+#######################################################
+
+bundle agent test
+{
+ services:
+ "myservice"
+ service_policy => "start",
+ service_method => service_test;
+}
+
+body service_method service_test {
+ service_bundle => test_services("$(this.promiser)","$(this.service_policy)");
+}
+
+bundle agent test_services(service, state) {
+ vars:
+ "service_state" string => "$(state)";
+}
+
+
+#######################################################
+
+bundle agent check
+{
+ classes:
+ "ok" expression => strcmp("start", "$(test_services.service_state)");
+
+ reports:
+ ok::
+ "$(this.promise_filename) Pass";
+ !ok::
+ "$(this.promise_filename) FAIL";
+}
+
@@ -0,0 +1,55 @@
+#######################################################
+#
+# Test services stop keyword
+#
+#######################################################
+
+body common control
+{
+ inputs => { "../default.cf.sub" };
+ bundlesequence => { default("$(this.promise_filename)") };
+ version => "1.0";
+}
+
+#######################################################
+
+bundle agent init
+{
+ vars:
+ "dummy" string => "dummy";
+}
+
+#######################################################
+
+bundle agent test
+{
+ services:
+ "myservice"
+ service_policy => "stop",
+ service_method => service_test;
+}
+
+body service_method service_test {
+ service_bundle => test_services("$(this.promiser)","$(this.service_policy)");
+}
+
+bundle agent test_services(service, state) {
+ vars:
+ "service_state" string => "$(state)";
+}
+
+
+#######################################################
+
+bundle agent check
+{
+ classes:
+ "ok" expression => strcmp("stop", "$(test_services.service_state)");
+
+ reports:
+ ok::
+ "$(this.promise_filename) Pass";
+ !ok::
+ "$(this.promise_filename) FAIL";
+}
+

0 comments on commit 50e3900

Please sign in to comment.