extract CIB definition formatting code for reuse
This commit is contained in:
parent
cb0d3adfb0
commit
66daffffbb
@ -116,6 +116,14 @@ module Pacemaker
|
||||
"%s '%s'" % [self.class.description, name]
|
||||
end
|
||||
|
||||
def definition_indent
|
||||
' ' * 9
|
||||
end
|
||||
|
||||
def continuation_line(text)
|
||||
" \\\n#{definition_indent}#{text}"
|
||||
end
|
||||
|
||||
# Returns a single-quoted shell-escaped version of the definition
|
||||
# string, suitable for use in a command like:
|
||||
#
|
||||
|
@ -51,11 +51,10 @@ class Pacemaker::Resource::Primitive < Pacemaker::Resource
|
||||
|
||||
def definition_string
|
||||
str = "#{TYPE} #{name} #{agent}"
|
||||
indent = ' ' * 9
|
||||
%w(params meta op).each do |data_type|
|
||||
unless send(data_type).empty?
|
||||
data_string = send("#{data_type}_string")
|
||||
str << " \\\n#{indent}#{data_string}"
|
||||
str << continuation_line(data_string)
|
||||
else
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user