use crm --force to ensure start/stop in batch mode
We want to allow a resource X to be created without starting it, and then for a group/clone Y to be created referencing X, which can subsequently be started. This ensures that child resources are only started via their parent, respecting the constraints their parent needs to impose (e.g. ordering if the parent is a group). However in this case, changing target-role on Y causes a "Do you want to override target-role for child resource ..." interactive prompt. When STDIN is not a tty, --force is required to ensure that the target-role on the child resource. This only works with newer versions of crm which are patched according to: https://bugzilla.novell.com/show_bug.cgi?id=868697
This commit is contained in:
@@ -17,11 +17,11 @@ module Pacemaker
|
||||
end
|
||||
|
||||
def crm_start_command
|
||||
"crm resource start '#{name}'"
|
||||
"crm --force resource start '#{name}'"
|
||||
end
|
||||
|
||||
def crm_stop_command
|
||||
"crm resource stop '#{name}'"
|
||||
"crm --force resource stop '#{name}'"
|
||||
end
|
||||
|
||||
# CIB object definitions look something like:
|
||||
|
@@ -47,7 +47,7 @@ shared_examples "a runnable resource" do |fixture|
|
||||
describe ":start action" do
|
||||
it_should_behave_like "action on non-existent resource", \
|
||||
:start,
|
||||
"crm resource start #{fixture.name}", \
|
||||
"crm --force resource start #{fixture.name}", \
|
||||
"Cannot start non-existent #{fixture}"
|
||||
|
||||
it "should do nothing to a started resource" do
|
||||
@@ -56,7 +56,7 @@ shared_examples "a runnable resource" do |fixture|
|
||||
|
||||
provider.run_action :start
|
||||
|
||||
cmd = "crm resource start #{fixture.name}"
|
||||
cmd = "crm --force resource start #{fixture.name}"
|
||||
expect(@chef_run).not_to run_execute(cmd)
|
||||
expect(@resource).not_to be_updated
|
||||
end
|
||||
@@ -68,7 +68,7 @@ shared_examples "a runnable resource" do |fixture|
|
||||
|
||||
provider.run_action :start
|
||||
|
||||
cmd = "crm resource start '#{fixture.name}'"
|
||||
cmd = "crm --force resource start '#{fixture.name}'"
|
||||
expect(@chef_run).to run_execute(cmd)
|
||||
expect(@resource).to be_updated
|
||||
end
|
||||
@@ -77,7 +77,7 @@ shared_examples "a runnable resource" do |fixture|
|
||||
describe ":stop action" do
|
||||
it_should_behave_like "action on non-existent resource", \
|
||||
:stop,
|
||||
"crm resource stop #{fixture.name}", \
|
||||
"crm --force resource stop #{fixture.name}", \
|
||||
"Cannot stop non-existent #{fixture}"
|
||||
|
||||
it "should do nothing to a stopped resource" do
|
||||
@@ -86,7 +86,7 @@ shared_examples "a runnable resource" do |fixture|
|
||||
|
||||
provider.run_action :stop
|
||||
|
||||
cmd = "crm resource start #{fixture.name}"
|
||||
cmd = "crm --force resource start #{fixture.name}"
|
||||
expect(@chef_run).not_to run_execute(cmd)
|
||||
expect(@resource).not_to be_updated
|
||||
end
|
||||
@@ -97,7 +97,7 @@ shared_examples "a runnable resource" do |fixture|
|
||||
|
||||
provider.run_action :stop
|
||||
|
||||
cmd = "crm resource stop '#{fixture.name}'"
|
||||
cmd = "crm --force resource stop '#{fixture.name}'"
|
||||
expect(@chef_run).to run_execute(cmd)
|
||||
expect(@resource).to be_updated
|
||||
end
|
||||
|
Reference in New Issue
Block a user