eliminate "superclass mismatch for class Resource" error
Previously libraries/pacemaker/mixins/resource_meta.rb had: module Pacemaker class Resource module Meta ... but libraries/pacemaker/resource.rb had: module Pacemaker class Resource < Pacemaker::CIBObject ... This would work fine if libraries/pacemaker/resource.rb was loaded before libraries/pacemaker/mixins/resource_meta.rb, because then Pacemaker::Resource would have Pacemaker::CIBObject as its parent class, and the mixin would simply add the Meta module within the existing Pacemaker::Resource class. However, due to Chef's somewhat erratic method of loading libraries, sometimes it could happen the other way around, in which case Pacemaker::Resource would be initially defined by the mixin with no parent class, and then when resource.rb was loaded, it would attempt to redefine Resource to have a parent class, triggering the error.
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
# (priority, target-role, is-managed)
|
# (priority, target-role, is-managed)
|
||||||
|
|
||||||
module Pacemaker
|
module Pacemaker
|
||||||
class Resource
|
module Mixins
|
||||||
|
module Resource
|
||||||
module Meta
|
module Meta
|
||||||
def self.included(base)
|
def self.included(base)
|
||||||
base.extend ClassMethods
|
base.extend ClassMethods
|
||||||
@@ -26,3 +27,4 @@ module Pacemaker
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
@@ -5,7 +5,7 @@ class Pacemaker::Resource::Group < Pacemaker::Resource
|
|||||||
TYPE = 'group'
|
TYPE = 'group'
|
||||||
register_type TYPE
|
register_type TYPE
|
||||||
|
|
||||||
include Pacemaker::Resource::Meta
|
include Pacemaker::Mixins::Resource::Meta
|
||||||
|
|
||||||
attr_accessor :members
|
attr_accessor :members
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ class Pacemaker::Resource::Primitive < Pacemaker::Resource
|
|||||||
TYPE = 'primitive'
|
TYPE = 'primitive'
|
||||||
register_type TYPE
|
register_type TYPE
|
||||||
|
|
||||||
include Pacemaker::Resource::Meta
|
include Pacemaker::Mixins::Resource::Meta
|
||||||
|
|
||||||
attr_accessor :agent, :params, :op
|
attr_accessor :agent, :params, :op
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user