diff --git a/.ruby-version b/.ruby-version index 3e3c2f1..0bee604 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.1.1 +2.3.3 diff --git a/Gemfile b/Gemfile index 446a575..3442c17 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,8 @@ source 'https://rubygems.org' -gem 'rails', '3.2.18' - -# Bundle edge Rails instead: -# gem 'rails', :git => 'git://github.com/rails/rails.git' - -gem 'mysql2' +gem 'rails', '4.0.6' +gem 'mysql2', '0.3.17' +gem 'syslogger', git: 'https://github.com/jbussdieker/syslogger.git', :branch => 'implement_log_formatter' gem 'puppet' gem 'mcollective-client' gem 'chartkick' @@ -14,18 +11,19 @@ gem 'rails-bootstrap', '~> 3.0.0' gem 'kaminari' gem 'unicorn' +gem 'sass-rails', '~> 4.0.0' +gem 'coffee-rails', '~> 4.0.0' +gem 'uglifier', '>= 1.0.3' +gem 'jquery-rails' +gem 'awesome_print', require:"ap" -# Gems used only for assets and not required -# in production environments by default. -group :assets do - gem 'sass-rails', '~> 3.2.3' - gem 'coffee-rails', '~> 3.2.1' - - # See https://github.com/sstephenson/execjs#readme for more supported runtimes - # gem 'therubyracer', :platforms => :ruby +# attr_accessible` is extracted out of Rails into a gem. +# Please use new recommended protection model for params(strong_parameters) +# or add `protected_attributes` to your Gemfile to use old one +gem 'protected_attributes' - gem 'uglifier', '>= 1.0.3' -end +# See https://github.com/sstephenson/execjs#readme for more supported runtimes +# gem 'therubyracer', :platforms => :ruby group :development, :test do gem 'rspec-rails' @@ -40,11 +38,6 @@ group :test do gem 'database_cleaner' end -gem 'jquery-rails' - -# To use ActiveModel has_secure_password -# gem 'bcrypt-ruby', '~> 3.0.0' - # To use Jbuilder templates for JSON # gem 'jbuilder' @@ -56,5 +49,3 @@ gem 'jquery-rails' # To use debugger # gem 'debugger' - -gem 'syslogger', git: 'https://github.com/jbussdieker/syslogger.git', :branch => 'implement_log_formatter' diff --git a/Gemfile.lock b/Gemfile.lock index 2d2545d..80efd9d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,189 +9,189 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (2.2.8) - actionmailer (3.2.18) - actionpack (= 3.2.18) + actionmailer (4.0.6) + actionpack (= 4.0.6) mail (~> 2.5.4) - actionpack (3.2.18) - activemodel (= 3.2.18) - activesupport (= 3.2.18) - builder (~> 3.0.0) + actionpack (4.0.6) + activesupport (= 4.0.6) + builder (~> 3.1.0) erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.18) - activesupport (= 3.2.18) - builder (~> 3.0.0) - activerecord (3.2.18) - activemodel (= 3.2.18) - activesupport (= 3.2.18) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.18) - activemodel (= 3.2.18) - activesupport (= 3.2.18) - activesupport (3.2.18) - i18n (~> 0.6, >= 0.6.4) - multi_json (~> 1.0) - arel (3.0.3) - builder (3.0.4) - capybara (2.2.1) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.6) + activesupport (= 4.0.6) + builder (~> 3.1.0) + activerecord (4.0.6) + activemodel (= 4.0.6) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.6) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.4) + activesupport (4.0.6) + i18n (~> 0.6, >= 0.6.9) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + addressable (2.5.0) + public_suffix (~> 2.0, >= 2.0.2) + arel (4.0.2) + awesome_print (1.7.0) + builder (3.1.4) + capybara (2.11.0) + addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - chartkick (1.2.4) - childprocess (0.5.3) + chartkick (2.2.2) + childprocess (0.5.9) ffi (~> 1.0, >= 1.0.11) - coffee-rails (3.2.2) + coffee-rails (4.0.1) coffee-script (>= 2.2.0) - railties (~> 3.2.0) - coffee-script (2.2.0) + railties (>= 4.0.0, < 5.0) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.7.0) - coveralls (0.7.0) - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - term-ansicolor - thor - database_cleaner (1.2.0) + coffee-script-source (1.12.2) + coveralls (0.8.17) + json (>= 1.8, < 3) + simplecov (~> 0.12.0) + term-ansicolor (~> 1.3) + thor (~> 0.19.1) + tins (~> 1.6) + database_cleaner (1.5.3) diff-lcs (1.2.5) - docile (1.1.3) + docile (1.1.5) erubis (2.7.0) - execjs (2.0.2) - facter (2.0.1) + execjs (2.7.0) + facter (2.4.6) CFPropertyList (~> 2.2.6) - factory_girl (4.4.0) + factory_girl (4.8.0) activesupport (>= 3.0.0) - factory_girl_rails (4.4.1) - factory_girl (~> 4.4.0) + factory_girl_rails (4.8.0) + factory_girl (~> 4.8.0) railties (>= 3.0.0) - faker (1.3.0) + faker (1.7.2) i18n (~> 0.5) - ffi (1.9.3) - groupdate (2.1.0) - activerecord (>= 3.0.0) - hiera (1.3.2) - json_pure + ffi (1.9.17) + groupdate (3.1.1) + activesupport (>= 3) + hiera (3.2.2) hike (1.2.3) - i18n (0.6.9) - journey (1.0.4) - jquery-rails (3.1.0) + i18n (0.7.0) + jquery-rails (3.1.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - json (1.8.1) - json_pure (1.8.1) - kaminari (0.15.1) + json (2.0.3) + json_pure (1.8.6) + kaminari (0.17.0) actionpack (>= 3.0.0) activesupport (>= 3.0.0) - kgio (2.9.2) + kgio (2.11.0) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) - mcollective-client (2.5.1) + mcollective-client (2.9.1) json stomp systemu mime-types (1.25.1) - mini_portile (0.5.3) - multi_json (1.10.0) - mysql2 (0.3.16) - nokogiri (1.6.2) - mini_portile (~> 0.5.2) - polyglot (0.3.4) - puppet (3.5.1) - facter (> 1.6, < 3) - hiera (~> 1.0) - json_pure - rgen (~> 0.6.5) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.4) - rack - rack-test (0.6.2) + mini_portile2 (2.1.0) + minitest (4.7.5) + multi_json (1.12.1) + mysql2 (0.3.17) + nokogiri (1.7.0.1) + mini_portile2 (~> 2.1.0) + polyglot (0.3.5) + protected_attributes (1.1.3) + activemodel (>= 4.0.1, < 5.0) + public_suffix (2.0.5) + puppet (4.8.1) + CFPropertyList (~> 2.2.6) + facter (> 2.0, < 4) + hiera (>= 2.0, < 4) + json_pure (~> 1.8) + rack (1.5.5) + rack-test (0.6.3) rack (>= 1.0) - rails (3.2.18) - actionmailer (= 3.2.18) - actionpack (= 3.2.18) - activerecord (= 3.2.18) - activeresource (= 3.2.18) - activesupport (= 3.2.18) - bundler (~> 1.0) - railties (= 3.2.18) + rails (4.0.6) + actionmailer (= 4.0.6) + actionpack (= 4.0.6) + activerecord (= 4.0.6) + activesupport (= 4.0.6) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.6) + sprockets-rails (~> 2.0) rails-bootstrap (3.0.0.4) - railties (3.2.18) - actionpack (= 3.2.18) - activesupport (= 3.2.18) - rack-ssl (~> 1.3.2) + railties (4.0.6) + actionpack (= 4.0.6) + activesupport (= 4.0.6) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - raindrops (0.13.0) - rake (10.3.1) - rdoc (3.12.2) - json (~> 1.4) - rest-client (1.6.7) - mime-types (>= 1.16) - rgen (0.6.6) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - rspec-rails (2.14.2) + thor (>= 0.18.1, < 2.0) + raindrops (0.17.0) + rake (12.0.0) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-rails (3.5.2) actionpack (>= 3.0) - activemodel (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rubyzip (1.1.3) - sass (3.3.7) - sass-rails (3.2.6) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) - selenium-webdriver (2.41.0) - childprocess (>= 0.5.0) - multi_json (~> 1.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + rubyzip (1.2.0) + sass (3.2.19) + sass-rails (4.0.5) + railties (>= 4.0.0, < 5.0) + sass (~> 3.2.2) + sprockets (~> 2.8, < 3.0) + sprockets-rails (~> 2.0) + selenium-webdriver (3.0.5) + childprocess (~> 0.5) rubyzip (~> 1.0) - websocket (~> 1.0.4) - simplecov (0.8.2) + websocket (~> 1.0) + simplecov (0.12.0) docile (~> 1.1.0) - multi_json - simplecov-html (~> 0.8.0) - simplecov-html (0.8.0) - sprockets (2.2.2) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.0) + sprockets (2.12.4) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - stomp (1.3.2) - systemu (2.6.4) - term-ansicolor (1.3.0) + sprockets-rails (2.3.3) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + stomp (1.4.3) + systemu (2.6.5) + term-ansicolor (1.4.0) tins (~> 1.0) - thor (0.19.1) + thor (0.19.4) + thread_safe (0.3.5) tilt (1.4.1) - tins (1.2.0) + tins (1.13.0) treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.39) - uglifier (2.5.0) - execjs (>= 0.3.0) - json (>= 1.8.0) - unicorn (4.8.3) + tzinfo (0.3.52) + uglifier (3.0.4) + execjs (>= 0.3.0, < 3) + unicorn (5.2.0) kgio (~> 2.6) - rack raindrops (~> 0.7) - websocket (1.0.7) + websocket (1.2.3) xpath (2.0.0) nokogiri (~> 1.3) @@ -199,9 +199,10 @@ PLATFORMS ruby DEPENDENCIES + awesome_print capybara chartkick - coffee-rails (~> 3.2.1) + coffee-rails (~> 4.0.0) coveralls database_cleaner factory_girl_rails @@ -210,12 +211,13 @@ DEPENDENCIES jquery-rails kaminari mcollective-client - mysql2 + mysql2 (= 0.3.17) + protected_attributes puppet - rails (= 3.2.18) + rails (= 4.0.6) rails-bootstrap (~> 3.0.0) rspec-rails - sass-rails (~> 3.2.3) + sass-rails (~> 4.0.0) selenium-webdriver syslogger! uglifier (>= 1.0.3) diff --git a/app/services/report_processing.rb b/app/services/report_processing.rb index a6401e0..95bb324 100644 --- a/app/services/report_processing.rb +++ b/app/services/report_processing.rb @@ -80,7 +80,7 @@ def parse_status def parse node_name = parsed.name - @report.node = Node.find_or_create_by_name(node_name) + @report.node = Node.find_or_create_by(name: node_name) @report.report_logs.create(parse_logs) @report.metrics.create(parse_metrics) @report.resource_statuses.create(parse_resource_statuses) diff --git a/app/views/node_classes/show.html.erb b/app/views/node_classes/show.html.erb index 7d0e8b4..a032d28 100644 --- a/app/views/node_classes/show.html.erb +++ b/app/views/node_classes/show.html.erb @@ -5,7 +5,7 @@
<%= link_to "Back", node_classes_path, :class => 'btn btn-sm btn-default' %> <%= link_to "Edit", edit_node_class_path(@node_class), :class => 'btn btn-sm btn-primary' %> - <%= link_to "Delete", @node_class, :method => :delete, :confirm => "Are you sure?", :class => 'btn btn-sm btn-danger pull-right' %> + <%= link_to "Delete", @node_class, :method => :delete, :data => { :confirm => "Are you sure?" }, :class => 'btn btn-sm btn-danger pull-right' %>

Nodes

diff --git a/app/views/node_groups/show.html.erb b/app/views/node_groups/show.html.erb index 6fb4d34..528cbe8 100644 --- a/app/views/node_groups/show.html.erb +++ b/app/views/node_groups/show.html.erb @@ -5,7 +5,7 @@
<%= link_to "Back", node_groups_path, :class => 'btn btn-sm btn-default' %> <%= link_to "Edit", edit_node_group_path(@node_group), :class => 'btn btn-sm btn-primary' %> - <%= link_to "Delete", @node_group, :method => :delete, :confirm => "Are you sure?", :class => 'btn btn-sm btn-danger pull-right' %> + <%= link_to "Delete", @node_group, :method => :delete, :data => { :confirm => "Are you sure?" }, :class => 'btn btn-sm btn-danger pull-right' %>

Parameters

diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb index d54d7f3..a96adcd 100644 --- a/app/views/nodes/show.html.erb +++ b/app/views/nodes/show.html.erb @@ -17,7 +17,7 @@
<%= puppet_agent_node_status(@node) %>
- <%= link_to "Delete", @node, :method => :delete, :confirm => "Are you sure?", :class => 'btn btn-sm btn-danger pull-right' %> + <%= link_to "Delete", @node, :method => :delete, :data => { :confirm => "Are you sure?" }, :class => 'btn btn-sm btn-danger pull-right' %>

Parameters

diff --git a/app/views/reports/show.html.erb b/app/views/reports/show.html.erb index 639edd7..96cf41c 100644 --- a/app/views/reports/show.html.erb +++ b/app/views/reports/show.html.erb @@ -4,7 +4,7 @@
<%= link_to "Back", @report.node ? node_path(@report.node) : reports_path, :class => 'btn btn-sm btn-default' %> - <%= link_to "Delete", @report, :method => :delete, :confirm => "Are you sure?", :class => 'btn btn-sm btn-danger pull-right' %> + <%= link_to "Delete", @report, :method => :delete, :data => { :confirm => "Are you sure?" }, :class => 'btn btn-sm btn-danger pull-right' %>

diff --git a/config/application.rb b/config/application.rb index 38fdd57..f1c8963 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,7 +4,7 @@ if defined?(Bundler) # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) + Bundler.require(*Rails.groups) # If you want your assets lazily compiled in production, use this line # Bundler.require(:default, :assets, Rails.env) end diff --git a/config/database.yml b/config/database.yml index 0f2eeb1..dd5c7fd 100644 --- a/config/database.yml +++ b/config/database.yml @@ -18,15 +18,27 @@ postgresql: &pg defaults: &defaults pool: 16 timeout: 5000 - host: localhost <<: *<%= ENV['DB'] || "mysql2" %> development: - <<: *defaults + adapter: mysql2 + encoding: utf8 + host: enc-dashboard.c1phlpd5jvwq.us-west-2.rds.amazonaws.com + port: 3306 + database: dashboard_development + username: dashboard + password: d4aca968 test: <<: *defaults + host: localhost production: - <<: *defaults + # <<: *defaults # presumably, we'd erb-echo the production password from /etc/something here. + adapter: mysql2 + encoding: utf8 + host: enc-dashboard + database: dashboard_production + username: dashboard + password: d4aca968 diff --git a/config/environments/development.rb b/config/environments/development.rb index 0335c29..a5bf402 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -6,8 +6,7 @@ # since you don't have to restart the web server when you make code changes. config.cache_classes = false - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true + config.eager_load = false # Show full error reports and disable caching config.consider_all_requests_local = true @@ -19,19 +18,9 @@ # Print deprecation notices to the Rails logger config.active_support.deprecation = :log - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin - # Raise exception on mass assignment protection for Active Record models config.active_record.mass_assignment_sanitizer = :strict - # Log the query plan for queries taking more than this (works - # with SQLite, MySQL, and PostgreSQL) - config.active_record.auto_explain_threshold_in_seconds = 0.5 - - # Do not compress assets - config.assets.compress = false - # Expands the lines which load the assets config.assets.debug = true end diff --git a/config/environments/prod.rb b/config/environments/prod.rb index 3f68241..76c4bb1 100644 --- a/config/environments/prod.rb +++ b/config/environments/prod.rb @@ -4,6 +4,8 @@ # Code is not reloaded between requests config.cache_classes = true + config.eager_load = true + # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config.action_controller.perform_caching = true @@ -12,7 +14,7 @@ config.serve_static_assets = false # Compress JavaScripts and CSS - config.assets.compress = true + config.assets.js_compressor = :uglifier # Don't fallback to assets pipeline if a precompiled asset is missed config.assets.compile = false @@ -61,10 +63,6 @@ # Send deprecation notices to registered listeners config.active_support.deprecation = :notify - # Log the query plan for queries taking more than this (works - # with SQLite, MySQL, and PostgreSQL) - # config.active_record.auto_explain_threshold_in_seconds = 0.5 - config.serve_static_assets = true config.assets.compile = false config.paths['config/database'] = '/etc/enc_dashboard/database.yml' if File.exists? '/etc/enc_dashboard/database.yml' diff --git a/config/environments/production.rb b/config/environments/production.rb index 4c19acd..d100d72 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -4,6 +4,8 @@ # Code is not reloaded between requests config.cache_classes = true + config.eager_load = true + # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config.action_controller.perform_caching = true @@ -12,7 +14,7 @@ config.serve_static_assets = false # Compress JavaScripts and CSS - config.assets.compress = true + config.assets.js_compressor = :uglifier # Don't fallback to assets pipeline if a precompiled asset is missed config.assets.compile = false @@ -60,8 +62,4 @@ # Send deprecation notices to registered listeners config.active_support.deprecation = :notify - - # Log the query plan for queries taking more than this (works - # with SQLite, MySQL, and PostgreSQL) - # config.active_record.auto_explain_threshold_in_seconds = 0.5 end diff --git a/config/environments/stage.rb b/config/environments/stage.rb index e9efcd4..cb39d68 100644 --- a/config/environments/stage.rb +++ b/config/environments/stage.rb @@ -6,8 +6,7 @@ # since you don't have to restart the web server when you make code changes. config.cache_classes = false - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true + config.eager_load = false # Show full error reports and disable caching config.consider_all_requests_local = true @@ -19,19 +18,9 @@ # Print deprecation notices to the Rails logger config.active_support.deprecation = :log - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin - # Raise exception on mass assignment protection for Active Record models config.active_record.mass_assignment_sanitizer = :strict - # Log the query plan for queries taking more than this (works - # with SQLite, MySQL, and PostgreSQL) - config.active_record.auto_explain_threshold_in_seconds = 0.5 - - # Do not compress assets - config.assets.compress = false - # Expands the lines which load the assets config.assets.debug = true diff --git a/config/environments/test.rb b/config/environments/test.rb index b365299..69f771b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -11,8 +11,7 @@ config.serve_static_assets = true config.static_cache_control = "public, max-age=3600" - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true + config.eager_load = false # Show full error reports and disable caching config.consider_all_requests_local = true diff --git a/config/initializers/00_enc_settings.rb b/config/initializers/00_enc_settings.rb index d826860..db4811f 100644 --- a/config/initializers/00_enc_settings.rb +++ b/config/initializers/00_enc_settings.rb @@ -1,7 +1,9 @@ if File.exists? "config/settings.yml" - ENC_CONFIG = YAML.load_file("#{Rails.root}/config/settings.yml")[Rails.env].with_indifferent_access + ENC_CONFIG = HashWithIndifferentAccess.new(YAML.load(File.read("#{Rails.root}/config/settings.yml"))[Rails.env]) + puts "=> Config file(settings.yml) loaded. \n ENC_CONFIG: #{ENC_CONFIG}" elsif File.exists? "/etc/enc_dashboard/settings.yml" - ENC_CONFIG = YAML.load_file("/etc/enc_dashboard/settings.yml")[Rails.env].with_indifferent_access + ENC_CONFIG = HashWithIndifferentAccess.new(YAML.load(File.read("/etc/enc_dashboard/settings.yml"))[Rails.env]) + puts "=> Config file(settings.yml) loaded. \n ENC_CONFIG: #{ENC_CONFIG}" else puts "WARNING: No config/settings.yml file found" ENC_CONFIG = {} diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index be058f1..6cb96ce 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -2,6 +2,9 @@ # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! + # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -Enc::Application.config.secret_token = '920e97b1d36c9c3f92c6fb9ba9c2ff72e3dccea603965445d2e8e1ce0e003e55ac084008a9841940bb3173ed6269e412ffecb23b20598c730e2fe85f8ac5ce60' +# You can use `rake secret` to generate a secure secret key. + +Enc::Application.config.secret_key_base = '5c82fd92241d77979577a72754fbe29de81e14a7343814aa9b9486147920bbdf2f71e7dc271e33c1a7037e8d1c1b487b7209ff4ba7820278069d6e02992ee38e' diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 999df20..c2f744d 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -7,8 +7,3 @@ ActiveSupport.on_load(:action_controller) do wrap_parameters format: [:json] end - -# Disable root element in JSON by default. -ActiveSupport.on_load(:active_record) do - self.include_root_in_json = false -end diff --git a/config/routes.rb b/config/routes.rb index d9dee89..c413289 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -32,5 +32,7 @@ end resources :parameters, only: [:index, :new, :create] root :to => 'nodes#index' - match 'moov_check' => "home#moov_check" + # Rails 4.0 requires that routes using match must specify the request method + # match 'moov_check' => "home#moov_check" + get 'moov_check' => 'home#moov_check' end diff --git a/config/settings.yml.sample b/config/settings.yml.sample deleted file mode 100644 index 355a6ed..0000000 --- a/config/settings.yml.sample +++ /dev/null @@ -1,10 +0,0 @@ -development: -# spool_path: /tmp/enc_spool - puppetdb: - host: hostname - port: port -production: -# spool_path: /tmp/enc_spool - puppetdb: - host: hostname - port: port diff --git a/db/schema.rb b/db/schema.rb index 0ccfedf..2c42a1c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,110 +9,110 @@ # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # -# It's strongly recommended to check this file into your version control system. +# It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160503213802) do +ActiveRecord::Schema.define(version: 20160503213802) do - create_table "metrics", :force => true do |t| - t.integer "report_id", :null => false + create_table "metrics", force: true do |t| + t.integer "report_id", null: false t.string "category" t.string "name" - t.decimal "value", :precision => 12, :scale => 6 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.decimal "value", precision: 12, scale: 6 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "metrics", ["report_id"], :name => "index_metrics_on_report_id" + add_index "metrics", ["report_id"], name: "index_metrics_on_report_id", using: :btree - create_table "node_class_memberships", :force => true do |t| + create_table "node_class_memberships", force: true do |t| t.integer "node_id" t.integer "node_class_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "node_classes", :force => true do |t| - t.string "name", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + create_table "node_classes", force: true do |t| + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "node_classes", ["name"], :name => "index_node_classes_on_name", :unique => true + add_index "node_classes", ["name"], name: "index_node_classes_on_name", unique: true, using: :btree - create_table "node_group_memberships", :force => true do |t| + create_table "node_group_memberships", force: true do |t| t.integer "node_id" t.integer "node_group_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "node_group_memberships", ["node_group_id"], :name => "index_node_group_memberships_on_node_group_id" + add_index "node_group_memberships", ["node_group_id"], name: "index_node_group_memberships_on_node_group_id", using: :btree - create_table "node_groups", :force => true do |t| - t.string "name", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + create_table "node_groups", force: true do |t| + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "node_groups", ["name"], :name => "index_node_groups_on_name", :unique => true + add_index "node_groups", ["name"], name: "index_node_groups_on_name", unique: true, using: :btree - create_table "nodes", :force => true do |t| - t.string "name", :null => false + create_table "nodes", force: true do |t| + t.string "name", null: false t.text "description" t.datetime "reported_at" t.integer "last_apply_report_id" t.string "status" - t.boolean "hidden", :default => false + t.boolean "hidden", default: false t.integer "last_inspect_report_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.string "environment" end - add_index "nodes", ["name"], :name => "index_nodes_on_name", :unique => true + add_index "nodes", ["name"], name: "index_nodes_on_name", unique: true, using: :btree - create_table "parameters", :force => true do |t| + create_table "parameters", force: true do |t| t.string "key" t.text "value" t.integer "parameterable_id" t.string "parameterable_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "report_logs", :force => true do |t| + create_table "report_logs", force: true do |t| t.integer "report_id" t.string "level" t.text "message" t.datetime "time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.string "source" end - add_index "report_logs", ["report_id"], :name => "index_report_logs_on_report_id" + add_index "report_logs", ["report_id"], name: "index_report_logs_on_report_id", using: :btree - create_table "reports", :force => true do |t| + create_table "reports", force: true do |t| t.integer "node_id" t.string "status" t.string "environment" t.datetime "time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "reports", ["node_id"], :name => "index_reports_on_node_id" + add_index "reports", ["node_id"], name: "index_reports_on_node_id", using: :btree - create_table "resource_statuses", :force => true do |t| + create_table "resource_statuses", force: true do |t| t.integer "report_id" t.boolean "failed" t.boolean "skipped" t.boolean "is_changed" t.text "title" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "resource_statuses", ["report_id"], :name => "index_resource_statuses_on_report_id" + add_index "resource_statuses", ["report_id"], name: "index_resource_statuses_on_report_id", using: :btree end diff --git a/db/seeds.rb b/db/seeds.rb index 6c82759..fb5384d 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,12 +5,12 @@ # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) -node1 = Node.find_or_create_by_name("node1") +node1 = Node.find_or_create_by(name: "node1") node1.status = "unchanged" node1.save -node2 = Node.find_or_create_by_name("node2") +node2 = Node.find_or_create_by(name: "node2") node2.status = "changed" node2.save -group1 = NodeGroup.find_or_create_by_name("group1") -group2 = NodeGroup.find_or_create_by_name("group2") -group3 = NodeGroup.find_or_create_by_name("group3") +group1 = NodeGroup.find_or_create_by(name: "group1") +group2 = NodeGroup.find_or_create_by(name: "group2") +group3 = NodeGroup.find_or_create_by(name: "group3") diff --git a/spec/lib/puppetdb_spec.rb b/spec/lib/puppetdb_spec.rb index 69c97c2..9392624 100644 --- a/spec/lib/puppetdb_spec.rb +++ b/spec/lib/puppetdb_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' describe PuppetDB do - its(:options) { should be_kind_of Hash } + it(:options) { should be_kind_of Hash } end