lib/kameleon/persistent_cache.rb in kameleon-builder-2.1.0 vs lib/kameleon/persistent_cache.rb in kameleon-builder-2.1.1
- old
+ new
@@ -5,12 +5,18 @@
module Kameleon
#This ruby class will control the execution of Polipo web proxy
class Persistent_cache
include Singleton
- attr_reader :polipo_env, :cache_dir,:polipo_port
- attr_writer :activated, :cwd, :polipo_path, :name
+ attr_reader :polipo_env
+ attr_reader :cache_dir
+ attr_reader :polipo_port
+ attr_writer :activated
+ attr_reader :cwd
+ attr_reader :polipo_path
+ attr_reader :name
+
def initialize()
@logger = Log4r::Logger.new("kameleon::[kameleon]")
## we must configure Polipo to be execute for the in and out context
## we have to start polipo in the out context for debootstrap step
@@ -23,11 +29,10 @@
@polipo_cmd_options = {:diskCacheRoot => "",
:idleTime => "5",
:chunkHighMark => "425165824",
:proxyPort => @polipo_port,
- #:proxyOffline => "true"
:relaxTransparency =>"true"
}
@activated = false
@@ -59,11 +64,11 @@
@polipo_path ||= which("polipo")
if @polipo_path.nil? then
@logger.error("Polipo binary not found, make sure it is in your current PATH")
- @logger.error("or use the option --proxy_path")
+ @logger.error("or use the option --proxy-path")
raise BuildError, "Failed to use persistent cache"
end
end
def activated?
@@ -75,20 +80,20 @@
@cwd = dir
@cache_dir = @cwd + "/cache/"
end
def create_cache_directory(step_name)
- @logger.notice("Creating cache directory #{step_name} for Polipo")
+ @logger.notice("Creating cache directory #{step_name} for Polipo")
directory_name = @cache_dir + "/#{step_name}"
FileUtils.mkdir_p directory_name
directory_name
end
def start_web_proxy_in(directory)
## This function assumes that the cache directory has already been created by the engine
## Stopping first the previous proxy
## have to check if polipo is running
- @logger.notice("Starting web proxy Polipo in directory #{directory} using port: #{@polipo_port}")
+ @logger.debug("Starting web proxy Polipo in directory #{directory} using port: #{@polipo_port}")
@polipo_process.stop unless @polipo_process.nil?
command = ["#{@polipo_path}/polipo"]
@polipo_cmd_options[:diskCacheRoot] = directory
@polipo_cmd_options.each{ |v,k| command.push("#{v}=#{k}") }
ChildProcess.posix_spawn = true