Class: Proxy::OpenSCAP::StorageFS
- Inherits:
-
Storage
- Object
- Storage
- Proxy::OpenSCAP::StorageFS
show all
- Defined in:
- lib/smart_proxy_openscap/storage_fs.rb
Instance Method Summary
collapse
Methods inherited from Storage
#get_arf_html, #initialize
Instance Method Details
#delete_arf_file ⇒ Object
30
31
32
33
34
35
|
# File 'lib/smart_proxy_openscap/storage_fs.rb', line 30
def delete_arf_file
path = "#{@path_to_dir}/#{@namespace}/#{@cname}/#{@id}"
raise FileNotFound, "Can't find path #{path}" if !File.directory?(path) || File.zero?(path)
FileUtils.rm_r path
{:id => @id, :deleted => true}.to_json
end
|
#get_arf_file(digest) ⇒ Object
37
38
39
40
|
# File 'lib/smart_proxy_openscap/storage_fs.rb', line 37
def get_arf_file(digest)
file = File.open(get_path digest)
{ :size => File.size(file), :xml => file.read }
end
|
#get_arf_xml(digest) ⇒ Object
26
27
28
|
# File 'lib/smart_proxy_openscap/storage_fs.rb', line 26
def get_arf_xml(digest)
get_arf_file(digest)[:xml]
end
|
#get_path(digest) ⇒ Object
42
43
44
45
46
|
# File 'lib/smart_proxy_openscap/storage_fs.rb', line 42
def get_path(digest)
full_path = @path + digest
raise FileNotFound, "Can't find path #{full_path}" if !File.file?(full_path) || File.zero?(full_path)
full_path
end
|
#move_corrupted(digest) ⇒ Object
21
22
23
24
|
# File 'lib/smart_proxy_openscap/storage_fs.rb', line 21
def move_corrupted(digest)
source = "#{Proxy::OpenSCAP::Plugin.settings.spooldir}/#{@namespace}/#{@cname}/#{@id}/#{@date}"
move "#{source}/#{digest}", StoreCorruptedError
end
|
#store_archive(data) ⇒ Object
5
6
7
|
# File 'lib/smart_proxy_openscap/storage_fs.rb', line 5
def store_archive(data)
store(data, StoreReportError)
end
|
#store_corrupted(data) ⇒ Object
17
18
19
|
# File 'lib/smart_proxy_openscap/storage_fs.rb', line 17
def store_corrupted(data)
store(data, StoreCorruptedError)
end
|
#store_failed(data) ⇒ Object
13
14
15
|
# File 'lib/smart_proxy_openscap/storage_fs.rb', line 13
def store_failed(data)
store(data, StoreFailedError)
end
|
#store_spool(data) ⇒ Object
9
10
11
|
# File 'lib/smart_proxy_openscap/storage_fs.rb', line 9
def store_spool(data)
store(data, StoreSpoolError)
end
|