class UC3::FileSystemClient
browse ingest folder file system
Constants
- DIR
- ROOTDIR
Public Class Methods
Source
# File app/lib/client/uc3_client.rb, line 324 def self.client UC3::UC3Client.clients.fetch(self.class.to_s, FileSystemClient.new) end
Source
# File app/lib/client/uc3_client.rb, line 246 def initialize super `mkdir -p #{FileSystemClient::ROOTDIR}/ingest/queue` `mkdir -p #{FileSystemClient::ROOTDIR}/uploads` `mkdir -p #{FileSystemClient::ROOTDIR}/assemblies` `mkdir -p #{FileSystemClient::ROOTDIR}/zk-snapshots` `mkdir -p #{FileSystemClient::ROOTDIR}/ldap/config` `mkdir -p #{FileSystemClient::ROOTDIR}/ldap/db` end
Calls superclass method
UC3::UC3Client::new
Public Instance Methods
Source
# File app/lib/client/uc3_client.rb, line 328 def cleanup_ingest_folders `find #{FileSystemClient::DIR} -maxdepth 1 -name "bid-*" -mtime +30 | xargs rm -rf` `find #{FileSystemClient::DIR}/FAILED -maxdepth 1 -name "bid-*" -mtime +30 | xargs rm -rf` `find #{FileSystemClient::DIR}/RecycleBin -maxdepth 1 -name "jid-*" -mtime +3 | xargs rm -rf` name = %(-name "latest_snapshot.#{UC3::UC3Client.stack_name}.20*") `find #{FileSystemClient::ROOTDIR}/zk-snapshots -maxdepth 1 #{name} -mtime +3 | xargs rm -rf` end
Source
# File app/lib/client/uc3_client.rb, line 256 def show_folders(root, route, params) path = params.fetch('path', '') path = '' if path =~ /^\.\./ dir = path.empty? ? root : path table = AdminUI::FilterTable.new( columns: [ AdminUI::Column.new(:name, header: 'Name'), AdminUI::Column.new(:created, header: 'Created'), AdminUI::Column.new(:size, header: 'Bytes', cssclass: 'size'), AdminUI::Column.new(:actions, header: 'Actions') ], status: 'PASS' ) count = 0 Dir.entries(dir).sort.each do |folder| next if folder == '.' || (folder == '..' && path.empty?) count += 1 break if count > 1000 data = if File.directory?("#{dir}/#{folder}") if folder == '..' { name: { value: '..', href: "/ops/show-folders/list?path=#{File.dirname(dir)}" }, created: '', size: '', actions: [] } else { name: { value: folder, href: "/ops/show-folders/list?path=#{dir}/#{folder}" }, created: date_format(File.ctime("#{dir}/#{folder}")), size: '', actions: [] } end elsif folder =~ /(Estimate|Provision|Download|Process|Notify)_FAIL$/ { name: folder, created: date_format(File.ctime("#{dir}/#{folder}")), size: File.size("#{dir}/#{folder}"), actions: { value: 'Delete', href: '/ops/show-folders/delete', data: folder, cssclass: 'button', post: true, disabled: false } } else { name: folder, created: date_format(File.ctime("#{dir}/#{folder}")), size: File.size("#{dir}/#{folder}"), actions: [] } end table.add_row(AdminUI::Row.make_row( table.columns, data )) end record_status(route, table.status) table end