cookbook-pacemaker/spec/fixtures/keystone_primitive.rb
Adam Spiers c0e3907ba0 tidy up requires
It's really ugly to have to keep repeating File.dirname(__FILE__),
so we use a temporary variable, even in the case of a single require.
This minimises long "requires" lines and "requires" statements with
needing line-breaks, and should make search-and-replace a bit easier
if we later want to migrate to __dir__ (Ruby >= 2.0) or require_relative.

  http://stackoverflow.com/questions/4333286/ruby-require-vs-require-relative-best-practice-to-workaround-running-in-both

I've deliberately rejected the pattern:

  require File.expand_path('../relative/path', __FILE__)

because it relies on inconsistent semantics and inconsistent
documentation in File.expand_path:

  http://stackoverflow.com/questions/4333286/ruby-require-vs-require-relative-best-practice-to-workaround-running-in-both#comment34147297_4333552
2014-03-25 18:37:50 +00:00

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