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: pcsd_file.rb
require 'base64' require 'pcs.rb' #write_file_lock, read_file_lock require 'settings.rb' require 'pcsd_exchange_format.rb' module PcsdFile class PutFile def initialize(id, file) @id = id @file = file end def validate() PcsdFile::validate_file_key_with_string(@id, @file, :data) end def rewrite_existing() return @file[:rewrite_existing] end def full_file_name() raise NotImplementedError.new( "'#{__method__}' is not implemented in '#{self.class}'" ) end def binary?() return true end def exists?() return @exists if defined? @exists @exists ||= File.file?(self.full_file_name) end def exists_with_same_content() unless self.exists? return false end if self.binary? return Base64.strict_encode64(self.read()) == @file[:data] end return self.read() == @file[:data] end def write() write_file_lock( self.full_file_name, self.permissions, self.binary? ? Base64.decode64(@file[:data]) : @file[:data], self.binary?, self.user, self.group ) end def permissions() return nil end def user() return nil end def group() return nil end def read() return read_file_lock(self.full_file_name, self.binary?) end def process() self.validate() begin unless self.exists? self.write() return PcsdExchangeFormat::result(:written) end if self.rewrite_existing self.write() return PcsdExchangeFormat::result(:rewritten) end if self.exists_with_same_content() return PcsdExchangeFormat::result(:same_content) end return PcsdExchangeFormat::result(:conflict) rescue => e return PcsdExchangeFormat::result(:unexpected, e.message) end end end class PutFileBooth < PutFile def validate() super PcsdFile::validate_file_key_with_string(@id, @file, :name) if @file[:name].empty? raise PcsdExchangeFormat::Error.for_item('file', @id, "'name' is empty") end if @file[:name].include?('/') raise PcsdExchangeFormat::Error.for_item( 'file', @id, "'name' cannot contain '/'" ) end end def dir() return BOOTH_CONFIG_DIR end def full_file_name() @full_file_name ||= File.join(self.dir, @file[:name]) end end class PutFileBoothAuthfile < PutFileBooth def permissions() return 0600 end end class PutFileBoothConfig < PutFileBooth def binary?() return false end end class PutFilePcmkRemoteAuthkey < PutFile def full_file_name #TODO determine the file name from the system @full_file_name ||= PACEMAKER_AUTHKEY end def permissions() return 0400 end def user() return 'hacluster' end def group() return 'haclient' end def write() pacemaker_config_dir = File.dirname(PACEMAKER_AUTHKEY) if not File.directory?(pacemaker_config_dir) Dir.mkdir(pacemaker_config_dir) end super end end class PutFileCorosyncAuthkey < PutFile def full_file_name @full_file_name ||= COROSYNC_AUTHKEY end def permissions() return 0400 end end TYPES = { "booth_authfile" => PutFileBoothAuthfile, "booth_config" => PutFileBoothConfig, "pcmk_remote_authkey" => PutFilePcmkRemoteAuthkey, "corosync_authkey" => PutFileCorosyncAuthkey, } end def PcsdFile.validate_file_key_with_string(id, file_hash, key_name) unless file_hash.has_key?(key_name) raise PcsdExchangeFormat::Error.for_item( 'file', id, "'#{key_name}' is missing" ) end unless file_hash[key_name].is_a? String raise PcsdExchangeFormat::Error.for_item( 'file', id, "'#{key_name}' is not String: '#{file_hash[key_name].class}'" ) end end
Upload File
Create Folder