Skip to content

Commit

Permalink
rescue if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Brandt committed Apr 2, 2018
1 parent e857395 commit 1462f23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 9 additions & 5 deletions lib/fpm/fry/command/cook.rb
Expand Up @@ -153,11 +153,15 @@ def update?
case(update)
when 'auto'
Inspector.for_image(client, image) do |inspector|
inspector.read('/var/lib/apt/lists') do |file|
next if file.header.name == 'lists/'
logger.hint("/var/lib/apt/lists is not empty, you could try to speed up builds with --update=never", documentation: 'https://github.com/xing/fpm-fry/wiki/The-update-parameter')
break
end if inspector.exists?('/var/lib/apt/lists')
begin
inspector.read('/var/lib/apt/lists') do |file|
next if file.header.name == 'lists/'
logger.hint("/var/lib/apt/lists is not empty, you could try to speed up builds with --update=never", documentation: 'https://github.com/xing/fpm-fry/wiki/The-update-parameter')
break
end
rescue FPM::Fry::Client::FileNotFound
logger.hint("/var/lib/apt/lists does not exists, so we will autoupdate")
end
end
return true
when 'always'
Expand Down
3 changes: 1 addition & 2 deletions spec/command/cook_spec.rb
Expand Up @@ -229,7 +229,6 @@
end

context 'debian auto with cache' do

before(:each) do
subject.image = 'ubuntu:precise'
subject.builder = FPM::Fry::Recipe::Builder.new(flavour: 'debian')
Expand Down Expand Up @@ -273,7 +272,7 @@
FPM::Package::Dir
end

before(:each) do
before(:each) do
subject.builder = builder
subject.output_class = output_class
end
Expand Down

0 comments on commit 1462f23

Please sign in to comment.