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

NoMethodError : undefined method `divmod' for nil:NilClass #25

Open
FishGel opened this issue Jul 18, 2014 · 1 comment
Open

NoMethodError : undefined method `divmod' for nil:NilClass #25

FishGel opened this issue Jul 18, 2014 · 1 comment

Comments

@FishGel
Copy link

FishGel commented Jul 18, 2014

I use git clone redis-audit

[root@www local]#  git clone https://github.com/snmaynard/redis-audit.git
Initialized empty Git repository in /usr/local/redis-audit/.git/
remote: Reusing existing pack: 117, done.
remote: Total 117 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (117/117), 17.79 KiB | 11 KiB/s, done.
Resolving deltas: 100% (38/38), done.

And install it by bundle

[root@www redis-audit]# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break
this application for all non-root users on this machine.
Fetching gem metadata from http://rubygems.org/..........
Fetching additional metadata from http://rubygems.org/..
Installing redis 3.0.2
Using bundler 1.6.4
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

When I try to run it, error print out as follows:

[root@www redis-audit]# bundle exec ruby  redis-audit.rb 127.0.0.1 6379 1 10000
Auditing 192.168.1.6:6379 db:1 sampling 10000 keys
Getting a list of all 0 keys...
Auditing 0 keys...
DB has 0 keys
redis-audit.rb:184:in `output_bytes': undefined method `divmod' for nil:NilClass (NoMethodError)
    from redis-audit.rb:207:in `output_stats'
    from redis-audit.rb:278:in `<main>'
@snmaynard
Copy link
Owner

The bug is because I haven't tested the script with 0 keys in the redis db. If you run it against a db with keys in it you should have more luck.

If you fancy sending a PR to fix I'd merge :-)

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

2 participants