Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 2.0 support broken since 2.2.0: undefined method create for Tempfile:Class #148

Closed
zuazo opened this issue Jul 27, 2015 · 24 comments
Closed

Comments

@zuazo
Copy link

zuazo commented Jul 27, 2015

kitchen-docker gem version 2.2.0 broke Ruby 2.0 support.

Tempfile#create does not exist in Ruby 2.0.0, you need to use Tempfile.new.

This is the error (from here):

Kitchen::ActionFailed: Failed to complete #create action: [undefined method `create' for Tempfile:Class]
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/kitchen-docker-2.3.0/lib/kitchen/driver/docker.rb:252:in `build_image'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/kitchen-docker-2.3.0/lib/kitchen/driver/docker.rb:104:in `create'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:424:in `public_send'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:424:in `block in perform_action'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:488:in `call'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:488:in `synchronize_or_call'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:453:in `block in action'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:452:in `action'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:424:in `perform_action'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:352:in `create_action'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:341:in `block in transition_to'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:340:in `each'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:340:in `transition_to'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:160:in `verify'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:189:in `block in test'
/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:185:in `test'
/home/travis/build/zuazo/kitchen-in-travis/Rakefile:26:in `block (3 levels) in <top (required)>'
/home/travis/build/zuazo/kitchen-in-travis/Rakefile:25:in `block (2 levels) in <top (required)>'
/home/travis/.rvm/gems/ruby-2.0.0-p598/bin/ruby_executable_hooks:15:in `eval'
/home/travis/.rvm/gems/ruby-2.0.0-p598/bin/ruby_executable_hooks:15:in `<main>'

Tasks: TOP => integration:docker
(See full trace by running task with --trace)

The problematic commit: 685ea60 (issue #136)

@coderanger
Copy link
Contributor

To copy from my comment over there, the fix would be:

file = Tempfile.new('Dockerfile-kitchen', Dir.pwd)
begin
  file.write(dockerfile)
  file.close
  docker_command("#{cmd} -f #{file.path} .")
ensure
  file.close unless file.closed?
  file.unlink
end

But OTOH 2.1 is what comes with ChefDK so that is not an unreasonable expectation.

@metmajer
Copy link

+1

2 similar comments
@Filirom1
Copy link

+1

@madhu25
Copy link

madhu25 commented Aug 14, 2015

+1

@matschaffer
Copy link

1.9.3 also exhibits this problem

@proffalken
Copy link

Hi,

Is there a fix for this yet? or should I go back to an older version of the gem?

Cheers,

Matt

@coderanger
Copy link
Contributor

I'll push a fix for this tomorrow, sorry for the delay.

@fabn
Copy link

fabn commented Oct 14, 2015

Any news on this?

@jdrago999
Copy link

Still broken.

@jdrago999
Copy link

#170 addresses this and also adds forward_ssh_agent option

@tanuck
Copy link

tanuck commented Oct 16, 2015

@jdrago999 Why did #170 never get merged?

@bixu
Copy link

bixu commented Oct 22, 2015

I'm assuming this is still broken? I think it's the only think keeping me from using TestKitchen at $job

@DarrellMozingo
Copy link

Yea, still broken. Any word on this or why #170 was closed and not merged?

@bixu
Copy link

bixu commented Oct 28, 2015

another +1 to getting this fixed - would like to have Kitchen as an option - currently using pure rspec/serverspec as an alternative with the docker-api gem

@peco8
Copy link

peco8 commented Oct 30, 2015

same here it doesn't work should I use the older version?
#170 should be merged asap

@peco8
Copy link

peco8 commented Oct 30, 2015

I just updated the ruby version to 2.2.3 (was 2.0.0) with rbenv, and now different error comes out

STDERR: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.20/build?cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile-kitchen-20151030-31260-10xmvl2&memory=0&memswap=0&rm=1&t=&ulimits=null: dial unix /var/run/docker.sock: connect: no such file or directory.
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?

@bixu
Copy link

bixu commented Oct 30, 2015

I think docker or docker toolbox isn't running for you...or maybe your env vars are unset

On 30 Oct 2015, at 11:18, Toshiki Inami [email protected] wrote:

Hey I just updated the ruby version to 2.2.3 (was 2.0.0), and now different error comes out

STDERR: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.20/build?cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile-kitchen-20151030-31260-10xmvl2&memory=0&memswap=0&rm=1&t=&ulimits=null: dial unix /var/run/docker.sock: connect: no such file or directory.

  • Are you trying to connect to a TLS-enabled daemon without TLS?
  • Is your docker daemon up and running?

    Reply to this email directly or view it on GitHub.

@zuazo
Copy link
Author

zuazo commented Nov 2, 2015

Thanks @coderanger 🍻

@dj-wasabi
Copy link

When will there be a new release with this fix, so I won't have to manually edit the docker.rb file?
kitchen-docker (2.3.0) is the version that is installed with gem install kitchen-docker

@furushchev
Copy link

ping

@coderanger
Copy link
Contributor

@furushchev Please don't poke long-since fixed issues.

@furushchev
Copy link

@coderanger I think this problem is not yet solved since this fix is not applied to the version which we can get by gem install as @dj-wasabi says,

@dj-wasabi
Copy link

@coderanger
When I do an gem install kitchen-docker this issue is still there, so In my case it isn't fixed. So please create an release and make it available for gem.

@coderanger
Copy link
Contributor

I don't have permissions to create new releases, and the issue is resolved in master. I am aware there hasn't been a release in a while, I'm working on that separately.

@test-kitchen test-kitchen locked and limited conversation to collaborators Feb 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests