use CIB object class description to facilitate code reuse
This commit is contained in:
@@ -55,7 +55,7 @@ end
|
|||||||
action :start do
|
action :start do
|
||||||
name = new_resource.name
|
name = new_resource.name
|
||||||
unless @current_resource
|
unless @current_resource
|
||||||
raise "Cannot start non-existent resource primitive '#{name}'"
|
raise "Cannot start non-existent #{cib_object_class.description} '#{name}'"
|
||||||
end
|
end
|
||||||
rsc = cib_object_class.new(name)
|
rsc = cib_object_class.new(name)
|
||||||
next if rsc.running?
|
next if rsc.running?
|
||||||
@@ -69,7 +69,7 @@ end
|
|||||||
action :stop do
|
action :stop do
|
||||||
name = new_resource.name
|
name = new_resource.name
|
||||||
unless @current_resource
|
unless @current_resource
|
||||||
raise "Cannot stop non-existent resource primitive '#{name}'"
|
raise "Cannot stop non-existent #{cib_object_class.description} '#{name}'"
|
||||||
end
|
end
|
||||||
rsc = cib_object_class.new(name)
|
rsc = cib_object_class.new(name)
|
||||||
next unless rsc.running?
|
next unless rsc.running?
|
||||||
|
@@ -121,7 +121,7 @@ describe "Chef::Provider::PacemakerPrimitive" do
|
|||||||
expect_definition(definition)
|
expect_definition(definition)
|
||||||
|
|
||||||
expected_error = \
|
expected_error = \
|
||||||
"Existing primitive resource '#{fixture.name}' has agent '#{existing_agent}' " \
|
"Existing #{fixture} has agent '#{existing_agent}' " \
|
||||||
"but recipe wanted '#{@resource.agent}'"
|
"but recipe wanted '#{@resource.agent}'"
|
||||||
expect { provider.run_action :create }.to \
|
expect { provider.run_action :create }.to \
|
||||||
raise_error(RuntimeError, expected_error)
|
raise_error(RuntimeError, expected_error)
|
||||||
@@ -138,7 +138,7 @@ describe "Chef::Provider::PacemakerPrimitive" do
|
|||||||
expect_definition(fixture.definition_string)
|
expect_definition(fixture.definition_string)
|
||||||
expect_running(true)
|
expect_running(true)
|
||||||
|
|
||||||
expected_error = "Cannot delete running primitive resource '#{fixture.name}'"
|
expected_error = "Cannot delete running #{fixture}"
|
||||||
expect { provider.run_action :delete }.to \
|
expect { provider.run_action :delete }.to \
|
||||||
raise_error(RuntimeError, expected_error)
|
raise_error(RuntimeError, expected_error)
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ describe "Chef::Provider::PacemakerPrimitive" do
|
|||||||
it_should_behave_like "action on non-existent resource", \
|
it_should_behave_like "action on non-existent resource", \
|
||||||
:start,
|
:start,
|
||||||
"crm resource start #{fixture.name}", \
|
"crm resource start #{fixture.name}", \
|
||||||
"Cannot start non-existent resource primitive '#{fixture.name}'"
|
"Cannot start non-existent #{fixture}"
|
||||||
|
|
||||||
it "should do nothing to a started resource" do
|
it "should do nothing to a started resource" do
|
||||||
expect_definition(fixture.definition_string)
|
expect_definition(fixture.definition_string)
|
||||||
@@ -193,7 +193,7 @@ describe "Chef::Provider::PacemakerPrimitive" do
|
|||||||
it_should_behave_like "action on non-existent resource", \
|
it_should_behave_like "action on non-existent resource", \
|
||||||
:stop,
|
:stop,
|
||||||
"crm resource stop #{fixture.name}", \
|
"crm resource stop #{fixture.name}", \
|
||||||
"Cannot stop non-existent resource primitive '#{fixture.name}'"
|
"Cannot stop non-existent #{fixture}"
|
||||||
|
|
||||||
it "should do nothing to a stopped resource" do
|
it "should do nothing to a stopped resource" do
|
||||||
expect_definition(fixture.definition_string)
|
expect_definition(fixture.definition_string)
|
||||||
|
Reference in New Issue
Block a user