X7ROOT File Manager
Current Path:
/usr/lib/pcsd
usr
/
lib
/
pcsd
/
📁
..
📁
.bundle
📄
Gemfile
(223 B)
📄
Gemfile.lock
(731 B)
📄
Makefile
(1.17 KB)
📄
auth.rb
(4.78 KB)
📄
bootstrap.rb
(3.57 KB)
📄
capabilities.xml
(59.05 KB)
📄
cfgsync.rb
(23.66 KB)
📄
cluster.rb
(413 B)
📄
cluster_entity.rb
(29.81 KB)
📄
config.rb
(6.49 KB)
📄
config.ru
(440 B)
📄
corosyncconf.rb
(3.78 KB)
📄
fenceagent.rb
(1.16 KB)
📄
pcs.rb
(61.88 KB)
📄
pcsd
(695 B)
📄
pcsd-cli.rb
(4.37 KB)
📄
pcsd.8
(3.19 KB)
📄
pcsd.logrotate
(151 B)
📄
pcsd.pam
(154 B)
📄
pcsd.rb
(49.65 KB)
📄
pcsd_action_command.rb
(2.11 KB)
📄
pcsd_exchange_format.rb
(1.35 KB)
📄
pcsd_file.rb
(3.95 KB)
📄
pcsd_remove_file.rb
(595 B)
📄
permissions.rb
(4.24 KB)
📁
public
📄
remote.rb
(94.31 KB)
📄
resource.rb
(12.63 KB)
📄
rfc7919-ffdhe2048.pem
(424 B)
📄
session.rb
(2.01 KB)
📄
settings.rb
(1.15 KB)
📄
ssl.rb
(7.27 KB)
📁
vendor
📁
views
📄
wizard.rb
(418 B)
📁
wizards
Editing: corosyncconf.rb
module CorosyncConf class Section attr_reader :parent, :name def initialize(name) @parent = nil @attr_list = [] @section_list = [] @name = name end def text(indent=' ') lines = [] @attr_list.each { |attrib| lines << "#{attrib[0]}: #{attrib[1]}" } lines << '' if not(@attr_list.empty? or @section_list.empty?) last_section = @section_list.length - 1 @section_list.each_with_index { |section, index| lines += section.text.split("\n") lines.pop if lines[-1].strip.empty? lines << '' if index < last_section } if @parent lines.map! { |item| item.empty? ? item : indent + item } lines.unshift("#{@name} {") lines << '}' end final = lines.join("\n") final << "\n" if not final.empty? return final end def root parent = self parent = parent.parent while parent.parent return parent end def attributes(name=nil) return @attr_list.find_all { |attrib| not name or attrib[0] == name } end def add_attribute(name, value) @attr_list << [name, value] return self end def del_attribute(attribute) @attr_list.delete(attribute) return self end def del_attributes_by_name(name, value=nil) @attr_list.reject! { |attrib| attrib[0] == name and (not value or attrib[1] == value) } return self end def set_attribute(name, value) found = false new_attr_list = [] @attr_list.each { |attrib| if attrib[0] != name new_attr_list << attrib elsif not found found = true attrib[1] = value new_attr_list << attrib end } @attr_list = new_attr_list self.add_attribute(name, value) if not found return self end def sections(name=nil) return @section_list.find_all { |section| not name or section.name == name } end def add_section(section) parent = self while parent raise CircularParentshipException if parent == section parent = parent.parent end section.parent.del_section(section) if section.parent section.parent = self @section_list << section return self end def del_section(section) if @section_list.delete(section) # don't set parent to nil if the section was not found in the list section.parent = nil end return self end protected def parent=(parent) @parent = parent return self end end def CorosyncConf::parse_string(conf_text) root = Section.new('') self.parse_section(conf_text.split("\n"), root) return root end def CorosyncConf::parse_section(lines, section) # parser is trying to work the same way as an original corosync parser while not lines.empty? current_line = lines.shift().strip() next if current_line.empty? or current_line.start_with?('#') if current_line.include?('{') section_name = current_line.rpartition('{').first new_section = Section.new(section_name.strip) section.add_section(new_section) self.parse_section(lines, new_section) elsif current_line.include?('}') if not section.parent raise ParseErrorException, 'Unexpected closing brace' end return elsif current_line.include?(':') section.add_attribute( *current_line.split(':', 2).map { |part| part.strip } ) end end raise ParseErrorException, 'Missing closing brace' if section.parent end class CorosyncConfException < Exception end class CircularParentshipException < CorosyncConfException end class ParseErrorException < CorosyncConfException end end
Upload File
Create Folder