class UC3::FileSystemClient
browse ingest folder file system
Constants
- DIR
Public Class Methods
Source
# File app/lib/client/uc3_client.rb, line 274 def self.client UC3::UC3Client.clients.fetch(self.class.to_s, FileSystemClient.new) end
Public Instance Methods
Source
# File app/lib/client/uc3_client.rb, line 278 def cleanup_ingest_folders `find #{DIR} -maxdepth 1 -name "bid-*" -mtime +30 | xargs rm -rf` `find #{DIR}/FAILED -maxdepth 1 -name "bid-*" -mtime +30 | xargs rm -rf` `find #{DIR}/RecycleBin -maxdepth 1 -name "jid-*" -mtime +3 | xargs rm -rf` name = '-name "latest_snapshot.#{UC3::UC3Client.stack_name}.20*"' `find #{DIR}/zk-snapshots -maxdepth 1 #{name} -mtime +3 | xargs rm -rf` end
Source
# File app/lib/client/uc3_client.rb, line 206 def ingest_folders(route, params) path = params.fetch('path', '') path = '' if path =~ /^\.\./ dir = path.empty? ? DIR : "#{DIR}/#{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/ingest-folders/list?path=#{File.dirname(path)}" }, created: '', size: '', actions: [] } else { name: { value: folder, href: "/ops/ingest-folders/list?path=#{path}/#{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/ingest-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