• Gabriel Mazetto's avatar
    Merge branch 'bug/sidekiq-cron-better-error' into 'master' · 9af66e0c
    Gabriel Mazetto authored
    Improve cron_jobs loading error messages
    
    ## What does this MR do?
    
    Improves the error message from "Sidekiq Cron Jobs" plugin, when trying to load a incorrect definition from gitlab config files.
    
    This is the output before the fix:
    
    ```
    2016-06-08T16:43:19.277Z 2890 TID-gso49ojro INFO: Booting Sidekiq 4.1.2 with redis options {:url=>"unix:/var/run/redis/redis.sock", :namespace=>"resque:gitlab"}
    undefined method `delete' for nil:NilClass
    /home/git/gitlab/config/initializers/sidekiq.rb:16:in `block (2 levels) in <top (required)>'
    /home/git/gitlab/config/initializers/sidekiq.rb:16:in `each'
    /home/git/gitlab/config/initializers/sidekiq.rb:16:in `block in <top (required)>'
    /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-4.1.2/lib/sidekiq.rb:70:in `configure_server'
    ```
    
    This is the output after the fix:
    
    ```
    2016-07-18T10:53:22.414Z 66332 TID-oxal1bmik INFO: Booting Sidekiq 4.1.4 with redis options {:url=>"redis://localhost:6378", :namespace=>"resque:gitlab"}
    Invalid cron_jobs config key: 'registry'. Check your gitlab config file.
    /home/git/gitlab/config/initializers/sidekiq.rb:21:in `block (2 levels) in <top (required)>'
    /home/git/gitlab/config/initializers/sidekiq.rb:17:in `each'
    /home/git/gitlab/config/initializers/sidekiq.rb:17:in `block in <top (required)>'
    /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/ruby-2.1.8/gems/sidekiq-4.1.4/lib/sidekiq.rb:70:in `configure_server'
    ```
    
    Fixes #18378
    
    ## Are there points in the code the reviewer needs to double check?
    
    No
    
    ## Why was this MR needed?
    
    Original error doesn't give any hint on where the problem can be, so the user can't easily troubleshoot unless he knows implementation details.
    
    ## What are the relevant issue numbers?
    
    #18378
    
    ## Does this MR meet the acceptance criteria?
    
    - [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
    - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
    - [ ] API support added
    - Tests
      - [ ] Added for this feature/bug
      - [ ] All builds are passing
    - [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
    - [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
    - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
    
    See merge request !5318
    9af66e0c
To find the state of this project's repository at the time of any of these versions, check out the tags.
CHANGELOG 170 KB