ggiamarchi / vagrant-openstack-provider

Use Vagrant to manage OpenStack Cloud instances.
MIT License
247 stars 101 forks source link

Upgrade json version to latest #267

Closed dandunckelman closed 8 years ago

dandunckelman commented 8 years ago

I wanted to install this plugin with the latest Vagrant (v.1.8.1 when I went to https://www.vagrantup.com/downloads.html) but received errors when bundle tries installing the json gem v1.7.7. So, I figured I'd try getting the install to work with the latest JSON gem.

To do this, I performed the following on an Ubuntu v14.04 VM with Ruby v2.2.2 (via RVM):

Then the install worked as expected. I assume that this would fix the following issues: https://github.com/ggiamarchi/vagrant-openstack-provider/issues/265 & https://github.com/ggiamarchi/vagrant-openstack-provider/issues/266

dandunckelman commented 8 years ago

@ggiamarchi should I update the .travis.yml to do the following?

or something similar?

dandunckelman commented 8 years ago

@ggiamarchi my bad! I just saw this PR: https://github.com/ggiamarchi/vagrant-openstack-provider/pull/237

Closing...

shubhamrajvanshi commented 8 years ago

I get below error while following your steps. Sorry never worked on ruby

bundle Your Gemfile lists the gem vagrant-openstack-provider (>= 0) more than once. You should probably keep only one of them. While it's not a problem now, it could cause errors if you change the version of just one of them later. Fetching https://github.com/mitchellh/vagrant.git Fetching gem metadata from https://rubygems.org/............ Fetching version metadata from https://rubygems.org/... Fetching dependency metadata from https://rubygems.org/.. Resolving dependencies... Bundler could not find compatible versions for gem "bundler": In Gemfile: vagrant was resolved to 1.7.4, which depends on bundler (<= 1.10.5, >= 1.5.2)

Current Bundler version: bundler (1.11.2) This Gemfile requires a different version of Bundler. Perhaps you need to update Bundler by running gem install bundler?

Could not find gem 'bundler (<= 1.10.5, >= 1.5.2)', which is required by gem 'vagrant', in any of the sources. Shubhams-MacBook-Pro:source shubham$ bundle exec rake The git source https://github.com/mitchellh/vagrant.git is not yet checked out. Please run bundle install before trying to start your application Shubhams-MacBook-Pro:source shubham$

dandunckelman commented 8 years ago

@shubhamrajvanshi The response tells you 2 important things:

1.

Your Gemfile lists the gem vagrant-openstack-provider (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.

Check the content of your Gemfile and ensure there is only one instance of gem "vagrant-openstack-provider"

2.

Bundler could not find compatible versions for gem "bundler":
In Gemfile:
vagrant was resolved to 1.7.4, which depends on
bundler (<= 1.10.5, >= 1.5.2)

Current Bundler version:
bundler (1.11.2)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running gem install bundler?

Could not find gem 'bundler (<= 1.10.5, >= 1.5.2)', which is required by gem 'vagrant', in any of the sources.

Your current version of bundler is 1.11.2, which is the latest. The vagrant gem requires any version between 1.5.2 and 1.10.5. So, ensure you have installed the correct version of bundler:

gem install bundler -v 1.10.5
v1k0d3n commented 8 years ago

it seems like users are still having issues perhaps? this is leading down a dependency headache on multiple systems; at least from what i've tested so far, which is CentOS/Fedora and OSX. i've been looking at this over this for a couple of days, but like eparis mentioned in one his posts (referenced below), I'm not familiar enough with vagrant/ruby enough to contribute anything of value.

there are similar dependency issues referenced in #236 #237 #265 #266. as i mentioned in one of the other issues, i don't know if ditching system package managers is really the right approach. is there possibly another solution that could better solve this issue? i'm running into problems on OS X, Fedora, and CentOS so far, and none of the recommendations seemed to work (referring to #236), they just seem to hit on other, more complicated dependency problems.

Are there specific instructions for vagrant 1.8 and higher, or was 1.8 the version that seemed to break everything?

as i mentioned in #266 going to 1.7.4 seemed to resolve the dependency issue for OS X (but not for CentOS or Fedora), but then i ran into an issue with the plugin couldn't determine the Network ID declared in a Vagrantfile for another repository.

https://github.com/kubernetes/contrib/issues/349#issuecomment-170397624

these issues seem a little more complicated to resolve, when compared to other Vagrant plugins i've used in the past (especially for non-ruby users like myself).

Installing json 1.7.7 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby -r ./siteconf20160110-22964-1x7z0ca.rb extconf.rb
creating Makefile

make "DESTDIR=" clean
rm -f
rm -f generator.so  *.o  *.bak mkmf.log .*.time

make "DESTDIR="
gcc -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -DJSON_GENERATOR    -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic -fPIC -O3 -Wall -O0 -ggdb -m64 -o generator.o -c generator.c
In file included from /usr/include/stdio.h:27:0,
                 from /usr/include/ruby/defines.h:26,
                 from /usr/include/ruby/ruby.h:29,
                 from /usr/include/ruby.h:33,
                 from ../fbuffer/fbuffer.h:5,
                 from generator.c:1:
/usr/include/features.h:328:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function 'fbuffer_to_s':
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                               ^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                    ^
Makefile:238: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/share/gems/gems/json-1.7.7 for inspection.
Results logged to /usr/local/lib64/gems/ruby/json-1.7.7/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.
dandunckelman commented 8 years ago

@v1k0d3n are you trying to use a Ruby version newer than 2.0.0? If so, please try using v2.0.0 since Vagrant is only supporting that version and not newer ones. Because of that, this plugin also doesn't support a newer Ruby version.

v1k0d3n commented 8 years ago

@dandunckelman On OSX (system error as shown above):

$ ruby --version
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
$ 
v1k0d3n commented 8 years ago

and this is kind of what i'm referring to, no matter what solution...this takes users down a crazy road of dependency issues. i wish i knew more about ruby and vagrant, so i could even help out...but i just don't.

and just to give some background...i blew away everything vagrant related (including some licenses i had) to try and start clean, but it's still failing.

OSX01:WORKING user$ cd ~/WORKING/

OSX01:WORKING user$ git clone https://github.com/dandunckelman/vagrant-openstack-provider.git
Cloning into 'vagrant-openstack-provider'...
remote: Counting objects: 4220, done.
remote: Total 4220 (delta 0), reused 0 (delta 0), pack-reused 4220
Receiving objects: 100% (4220/4220), 883.65 KiB | 0 bytes/s, done.
Resolving deltas: 100% (2940/2940), done.
Checking connectivity... done.
Checking out files: 100% (121/121), done.

OSX01:WORKING user$ cd vagrant-openstack-provider

OSX01:vagrant-openstack-provider user$ git checkout -b upgrade-json-dependency
Switched to a new branch 'upgrade-json-dependency'

OSX01:vagrant-openstack-provider user$ cd source/

OSX01:source user$ echo "2.2.2" > .ruby-version

OSX01:source user$ echo "vagrant-openstack-provider" > .ruby-gemset

OSX01:source user$ gem install bundler -v 1.10.5

OSX01:source user$ sudo gem install bundler -v 1.10.5
Fetching: bundler-1.10.5.gem (100%)
Successfully installed bundler-1.10.5
Parsing documentation for bundler-1.10.5
Installing ri documentation for bundler-1.10.5
1 gem installed

OSX01:source user$ bundle
Your Gemfile lists the gem vagrant-openstack-provider (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Fetching https://github.com/mitchellh/vagrant.git
Checking out files: 100% (1261/1261), done.
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies....
Using rake 10.4.2
Installing addressable 2.4.0
Using bundler 1.10.5
Installing thor 0.19.1
Installing appraisal 1.0.0
Installing ast 2.2.0
Installing parser 2.2.3.0
Installing astrolabe 1.3.1
Installing builder 3.2.2
Installing byebug 8.2.1 with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile

make "DESTDIR="
make: *** No rule to make target `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14/ruby/config.h', needed by `breakpoint.o'.  Stop.

Gem files will remain installed in /var/folders/0r/_801_sx56pv_m8b491fcnfsh0000gn/T/bundler20160111-234-jc9bm8byebug-8.2.1/gems/byebug-8.2.1 for inspection.
Results logged to /var/folders/0r/_801_sx56pv_m8b491fcnfsh0000gn/T/bundler20160111-234-jc9bm8byebug-8.2.1/gems/byebug-8.2.1/ext/byebug/gem_make.out
An error occurred while installing byebug (8.2.1), and Bundler cannot continue.
Make sure that `gem install byebug -v '8.2.1'` succeeds before bundling.
OSX01:source user$ 
Sharpie commented 8 years ago

If so, please try using v2.0.0 since Vagrant is only supporting that version and not newer ones.

Hashicorp's Vagrant 1.8.x packages, released last month, ship Ruby 2.2.3 --- which is why this JSON issue is popping back into the spotlight.

charlesa101 commented 8 years ago

@Sharpie: how did you solve this ?

Sharpie commented 8 years ago

@charlesa101 The changes proposed in this PR resolve the JSON dependency problem.

charlesa101 commented 8 years ago

oh ok..thank you @Sharpie ...works now!

v1k0d3n commented 8 years ago

@Sharpie I posted that I was running ruby version 2.0.0.

dandunckelman commented 8 years ago

@Sharpie thanks! Because I deleted the original fork, I've created a new PR: https://github.com/ggiamarchi/vagrant-openstack-provider/pull/268