
The previous use of require caused File.join on several occasions to calculate different paths to the same library, depending on which __FILE__ the library was being calculated as relative to; e.g. /some/path/prefix/spec/one/bar.rb would do the equivalent of: require '/some/path/prefix/spec/one/../../libraries/foo/mylib.rb' and /some/path/prefix/spec/two/baz.rb would do the equivalent of: require '/some/path/prefix/spec/two/../../libraries/foo/mylib.rb' This would result in mylib.rb being loaded multiple times, causing warnings from constants being redefined, and worse, multiple objects representing the same class hierarchy (@@foo) variables. The latter actually broke the @@subclasses registration mechanism in Pacemaker::CIBObject. By switching to File.expand_path, we ensure we always refer to each library using a single absolute path, which means Ruby's require mechanism works as it should, only loading the code the first time round.
33 lines
1.3 KiB
Ruby
33 lines
1.3 KiB
Ruby
require ::File.expand_path('../../libraries/pacemaker/resource/primitive',
|
|
::File.dirname(__FILE__))
|
|
|
|
module Chef::RSpec
|
|
module Pacemaker
|
|
module Config
|
|
KEYSTONE_PRIMITIVE = ::Pacemaker::Resource::Primitive.new('keystone')
|
|
KEYSTONE_PRIMITIVE.agent = "ocf:openstack:keystone"
|
|
KEYSTONE_PRIMITIVE.params = [
|
|
[ "os_password", "adminpw" ],
|
|
[ "os_auth_url", "http://node1:5000/v2.0" ],
|
|
[ "os_username", "admin" ],
|
|
[ "os_tenant_name", "openstack" ],
|
|
[ "user", "openstack-keystone" ],
|
|
]
|
|
KEYSTONE_PRIMITIVE.meta = [
|
|
[ "target-role", "Started" ],
|
|
[ "is-managed", "true" ]
|
|
]
|
|
KEYSTONE_PRIMITIVE.op = [
|
|
[ "monitor", { "timeout" => "60", "interval" => "10s" } ],
|
|
[ "start", { "timeout" => "240", "interval" => "10s" } ]
|
|
]
|
|
KEYSTONE_PRIMITIVE_DEFINITION = <<'EOF'.chomp
|
|
primitive keystone ocf:openstack:keystone \
|
|
params os_auth_url="http://node1:5000/v2.0" os_password="adminpw" os_tenant_name="openstack" os_username="admin" user="openstack-keystone" \
|
|
meta is-managed="true" target-role="Started" \
|
|
op monitor interval="10s" timeout="60" op start interval="10s" timeout="240"
|
|
EOF
|
|
end
|
|
end
|
|
end
|