Class: Cloudkeeper::Managers::ImageListManager

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudkeeper/managers/image_list_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeImageListManager

Returns a new instance of ImageListManager.



11
12
13
14
# File 'lib/cloudkeeper/managers/image_list_manager.rb', line 11

def initialize
  @openssl_store = OpenSSL::X509::Store.new
  @openssl_store.add_path Cloudkeeper::Settings[:'ca-dir'] if Cloudkeeper::Settings[:'ca-dir']
end

Instance Attribute Details

#image_listObject (readonly)

Returns the value of attribute image_list.



9
10
11
# File 'lib/cloudkeeper/managers/image_list_manager.rb', line 9

def image_list
  @image_list
end

#openssl_storeObject (readonly)

Returns the value of attribute openssl_store.



9
10
11
# File 'lib/cloudkeeper/managers/image_list_manager.rb', line 9

def openssl_store
  @openssl_store
end

Instance Method Details

#download_image_listObject



16
17
18
19
20
21
22
23
# File 'lib/cloudkeeper/managers/image_list_manager.rb', line 16

def download_image_list
  logger.debug 'Downloading fresh image lists...'
  url = Cloudkeeper::Settings[:'image-list']
  Dir.mktmpdir('cloudkeeper') { |dir| retrieve_image_list url, dir }
rescue Cloudkeeper::Errors::ImageList::DownloadError, Cloudkeeper::Errors::ImageList::VerificationError,
       Cloudkeeper::Errors::Parsing::ParsingError, OpenSSL::PKCS7::PKCS7Error, JSON::ParserError => ex
  raise Cloudkeeper::Errors::ImageList::ImageListError, "Image list #{url.inspect} couldn't be downloaded\n#{ex.message}"
end