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

Unable to install sensu without rubygems #322

Closed
confiq opened this issue Feb 26, 2015 · 8 comments
Closed

Unable to install sensu without rubygems #322

confiq opened this issue Feb 26, 2015 · 8 comments

Comments

@confiq
Copy link
Contributor

confiq commented Feb 26, 2015

if we don't have rubygems on machine (default: debian6/7) we are not able to run puppet configuration to install rubygems. Example:

err: Could not retrieve catalog from remote server: Could not intern from pson: Could not autoload sensu_rabbitmq_config: Could not autoload /var/lib/puppet/lib/puppet/provider/sensu_rabbitmq_config/json.rb: no such file to load -- rubygems

halts puppet run until rubygems is manually installed although we do have Package {"rubygems": ensure: 'installed'} in same run. (our configuration is to automatically install sensu-client on every server)

EDIT:
If json.rb has require rubygems then it's module job to install it.

@nohtyp
Copy link

nohtyp commented Mar 26, 2015

It might be an ordering problem in your case. Even though you have the rubygems package set to installed in the same run, dosen't necessarily mean that it will run in that order. Do you have keywords like before or after in your manifests?

This might be helpful: https://docs.puppetlabs.com/learning/ordering.html

@confiq
Copy link
Contributor Author

confiq commented Mar 26, 2015

The problem is not ordering, the problem is that sensu is using provider-api which is loaded before compaling the catalog.

I also think that rubygems Package should be part of this module anyway.

@confiq confiq closed this as completed Mar 26, 2015
@confiq confiq reopened this Mar 26, 2015
@jlambert121
Copy link
Contributor

I'm not sure anything can be done about this within this module (other than remove support for ruby 1.8.7 or remove all of the types) since, like you said, rubygems is required for catalog compilation. Is there another suggestion you have for solving this issue?

@nohtyp
Copy link

nohtyp commented Mar 26, 2015

When you say it's not an ordering issue, what happens if you run the rubygems module before you install Sensu? Would that work or you are seeing a different issue before. I have installed sensu automatically without an issue...have a look: https://github.com/nohtyp/myvagrant-sensu/blob/master/puppet/modules/sensu/manifests/init.pp. I am also installing the rubygems package too.

@nohtyp
Copy link

nohtyp commented Mar 26, 2015

@confiq Did the above link help you resolve your issue?

@confiq
Copy link
Contributor Author

confiq commented Mar 26, 2015

Is there another suggestion you have for solving this issue?

After little research here is the results:

  • I've removed require rubygems from all /lib/puppet/provider/*/json.rb files and it worked fine with ruby 1.8.7.302-2squeeze2 (I saw with my own eyes that json file is created after deleting /etc/sensu/conf.d directory)
  • Looked git history and saw commit 8a823 of @chrisleavoy. No real reason why he put it there.
  • Worse case scenario is that we can use rescue exception if require rubygems returns false. This way we can keep compatibility with old version

After this little research, my suggestion is to remove that line. I can do PR if required. If not rescue is fine with nice printing error message.

Some info about machine that I'm testing

root@XX:~# ruby --version
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
root@XX:~# facter --version
1.6.9
root@XX:~# puppet --version
2.7.18
root@XX:~# cat /etc/debian_version 
6.0.10

@nohtyp : Yes I saw it. that module does not use sensu-sensu module it uses nohtyp-sensu module. In other words, you wrote that module from scratch.

@jlambert121
Copy link
Contributor

@confiq is #365 what you were proposing? My understanding is that in ruby < 1.9.0 anything that wasn't core required rubygems in order to be loaded, and I didn't think json was part of core. Do you know how Debian is making that happen (or am I wrong on my understanding)?

@confiq
Copy link
Contributor Author

confiq commented Jun 12, 2015

Yes. That is exactly what I'm suggesting.

Do you know how Debian is making that happen (or am I wrong on my understanding)?

No idea. :( All I know it worked well on my debian machine.
Debian 6 won't be supported next year, this version should die anyway. I just had to move old servers to sensu.

@confiq confiq closed this as completed Jun 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants