puppet-herald 0.2.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +3 -0
  3. data/.jshintrc +19 -0
  4. data/Gemfile +25 -12
  5. data/Gemfile.local.example +3 -0
  6. data/Guardfile +57 -0
  7. data/README.md +1 -1
  8. data/Rakefile +100 -20
  9. data/db/migrate/20141218200108_remove_no_of_reports_from_nodes.rb +7 -0
  10. data/lib/puppet-herald.rb +95 -65
  11. data/lib/puppet-herald/app/api.rb +79 -12
  12. data/lib/puppet-herald/app/configuration.rb +47 -15
  13. data/lib/puppet-herald/app/frontend.rb +6 -6
  14. data/lib/puppet-herald/app/views/app.erb +14 -20
  15. data/lib/puppet-herald/app/views/err500.erb +8 -5
  16. data/lib/puppet-herald/application.rb +9 -1
  17. data/lib/puppet-herald/cli.rb +5 -11
  18. data/lib/puppet-herald/database.rb +1 -7
  19. data/lib/puppet-herald/javascript.rb +16 -10
  20. data/lib/puppet-herald/models.rb +47 -0
  21. data/lib/puppet-herald/models/log-entry.rb +2 -0
  22. data/lib/puppet-herald/models/node.rb +49 -2
  23. data/lib/puppet-herald/models/report.rb +33 -9
  24. data/lib/puppet-herald/project.js +46 -0
  25. data/lib/puppet-herald/public/app.js +11 -9
  26. data/lib/puppet-herald/public/bower.json +10 -3
  27. data/lib/puppet-herald/public/components/artifact/artifact-directive.js +4 -0
  28. data/lib/puppet-herald/public/components/artifact/artifact.js +1 -3
  29. data/lib/puppet-herald/public/components/directives/directives.js +5 -1
  30. data/lib/puppet-herald/public/components/directives/status-button.html +1 -1
  31. data/lib/puppet-herald/public/components/directives/status-button.js +11 -11
  32. data/lib/puppet-herald/public/components/filters/filters.js +6 -2
  33. data/lib/puppet-herald/public/components/page.js +2 -2
  34. data/lib/puppet-herald/public/components/pagination.js +142 -0
  35. data/lib/puppet-herald/public/components/settings.js +25 -0
  36. data/lib/puppet-herald/public/css/herald.css +100 -3
  37. data/lib/puppet-herald/public/general/app.html +73 -0
  38. data/lib/puppet-herald/public/img/shield97-white.svg +53 -0
  39. data/lib/puppet-herald/public/img/shield97.png +0 -0
  40. data/lib/puppet-herald/public/node/node.html +27 -9
  41. data/lib/puppet-herald/public/node/node.js +43 -15
  42. data/lib/puppet-herald/public/nodes/nodes.html +25 -7
  43. data/lib/puppet-herald/public/nodes/nodes.js +29 -14
  44. data/lib/puppet-herald/public/report/report.html +60 -13
  45. data/lib/puppet-herald/public/report/report.js +21 -14
  46. data/lib/puppet-herald/public/router.js +55 -0
  47. data/lib/puppet-herald/purgecronjob.rb +35 -0
  48. data/lib/puppet-herald/version.rb +2 -2
  49. data/package.json +14 -16
  50. data/puppet-herald.gemspec +12 -7
  51. data/spec/integration/app/configuration_spec.rb +33 -0
  52. data/spec/integration/application_spec.rb +139 -20
  53. data/spec/integration/fixtures/nodes.yml +13 -0
  54. data/spec/integration/fixtures/pending-notify.yaml +346 -0
  55. data/spec/integration/fixtures/reports.yml +61 -0
  56. data/spec/integration/models/node_spec.rb +12 -3
  57. data/spec/integration/models/report_spec.rb +60 -4
  58. data/spec/spec_helper.rb +6 -10
  59. data/spec/support/active_record.rb +1 -0
  60. data/spec/support/fixtures.rb +16 -0
  61. data/spec/unit/puppet-herald/cli_spec.rb +4 -4
  62. data/spec/unit/puppet-herald/database_spec.rb +5 -3
  63. data/spec/unit/puppet-herald/purgecronjob_spec.rb +37 -0
  64. data/test/javascript/.bowerrc +3 -0
  65. data/test/javascript/bower.json +21 -0
  66. data/test/javascript/karma.conf.js +17 -22
  67. data/test/javascript/src/app_test.js +10 -61
  68. data/test/javascript/src/components/directives/status-button_test.js +10 -10
  69. data/test/javascript/src/components/paginate_test.js +183 -0
  70. data/test/javascript/src/node/node_test.js +16 -6
  71. data/test/javascript/src/nodes/nodes_test.js +14 -2
  72. data/test/javascript/src/report/report_test.js +6 -6
  73. data/test/javascript/src/router_test.js +79 -0
  74. metadata +642 -23
@@ -2,6 +2,7 @@ require 'sinatra/base'
2
2
  require 'sinatra/namespace'
3
3
  require 'puppet-herald'
4
4
  require 'puppet-herald/app/configuration'
5
+ require 'puppet-herald/models'
5
6
  require 'puppet-herald/models/node'
6
7
  require 'puppet-herald/models/report'
7
8
 
@@ -18,6 +19,7 @@ module PuppetHerald
18
19
  @app = app
19
20
  end
20
21
  # Creates a new report
22
+ #
21
23
  # @param request [Sinatra::Request] an request object
22
24
  # @return [Array] an response array: [code, body] or [code, headers, body]
23
25
  def post_reports(request)
@@ -27,34 +29,46 @@ module PuppetHerald
27
29
  [201, body]
28
30
  end
29
31
  # Get a report by its ID
32
+ #
30
33
  # @param params [Hash] an requests parsed params
31
34
  # @return [Array] an response array: [code, body] or [code, headers, body]
32
35
  def get_report(params)
33
36
  id = params[:id]
34
- report = PuppetHerald::Models::Report.get_with_log_entries(id)
37
+ report = PuppetHerald::Models::Report.with_log_entries(id)
35
38
  status = 200
36
39
  status = 404 if report.nil?
37
40
  body = report.to_json(include: :log_entries)
38
41
  [status, body]
39
42
  end
40
- # Gets all nodes
43
+ # Gets all nodes with pagination
44
+ #
45
+ # @param request [Sinatra::Request] an request object
41
46
  # @return [Array] an response array: [code, body] or [code, headers, body]
42
- def nodes
43
- nodes = PuppetHerald::Models::Node.all
44
- [200, nodes.to_json]
47
+ def nodes(request)
48
+ pag = paginate request
49
+ nodes = PuppetHerald::Models::Node.paginate(pag)
50
+ [200, headers(pag), nodes.to_json(methods: :no_of_reports)]
51
+ rescue ArgumentError => ex
52
+ clienterror ex
45
53
  end
46
- # Gets a node by its ID
54
+ # Gets a node by its ID, with pagination
55
+ #
47
56
  # @param params [Hash] an requests parsed params
57
+ # @param request [Sinatra::Request] an request object
48
58
  # @return [Array] an response array: [code, body] or [code, headers, body]
49
- def get_node(params)
59
+ def get_node(params, request)
50
60
  id = params[:id]
51
- node = PuppetHerald::Models::Node.get_with_reports(id)
61
+ pag = paginate request
62
+ node = PuppetHerald::Models::Node.with_reports(id, pag)
52
63
  status = 200
53
64
  status = 404 if node.nil?
54
- body = node.to_json(include: :reports)
55
- [status, body]
65
+ body = node.to_json(include: :reports, methods: :no_of_reports)
66
+ [status, headers(pag), body]
67
+ rescue ArgumentError => ex
68
+ clienterror ex
56
69
  end
57
70
  # Get a app's artifact information
71
+ #
58
72
  # @return [Array] an response array: [code, body] or [code, headers, body]
59
73
  def version_json
60
74
  ver = {}
@@ -63,6 +77,59 @@ module PuppetHerald
63
77
  end
64
78
  [200, ver.to_json]
65
79
  end
80
+
81
+ private
82
+
83
+ # Creates headers for given pagination
84
+ #
85
+ # @param pagination [PuppetHerald::Models::Pagination] a pagination
86
+ # @param httpize [Boolean] if true given, will change headers to Rack format +HTTP_*+
87
+ # @return [Hash] a HTTP request headers
88
+ def headers(pagination, httpize = false)
89
+ keys = httpize_keys(httpize)
90
+ head = {
91
+ keys[:page] => pagination.page.to_s,
92
+ keys[:limit] => pagination.limit.to_s
93
+ }
94
+ head[keys[:total]] = pagination.total.to_s unless pagination.total.nil?
95
+ head[keys[:pages]] = pagination.pages.to_s unless pagination.pages.nil?
96
+ head
97
+ end
98
+
99
+ def httpize_keys(httpize = false)
100
+ map = PuppetHerald::Models::Pagination::KEYS.map do |k, str|
101
+ [k, httpize_key(str, httpize)]
102
+ end
103
+ Hash[map]
104
+ end
105
+
106
+ def httpize_key(key, httpize = false)
107
+ noop = ->(name) { name }
108
+ oper = httpize ? method(:httpize) : noop
109
+ oper.call key
110
+ end
111
+
112
+ # Creates a pagination from request
113
+ #
114
+ # @param request [Sinatra::Request] a HTTP request
115
+ # @return [PuppetHerald::Models::Pagination] a pagination
116
+ def paginate(request)
117
+ pkey = httpize(PuppetHerald::Models::Pagination::KEYS[:page])
118
+ lkey = httpize(PuppetHerald::Models::Pagination::KEYS[:limit])
119
+ page = request.env[pkey] ? request.env[pkey] : PuppetHerald::Models::Pagination::DEFAULT.page
120
+ limit = request.env[lkey] ? request.env[lkey] : PuppetHerald::Models::Pagination::DEFAULT.limit
121
+ PuppetHerald::Models::Pagination.new(page, limit)
122
+ end
123
+
124
+ def httpize(header_name)
125
+ upper = header_name.upcase.gsub('-', '_')
126
+ "HTTP_#{upper}"
127
+ end
128
+
129
+ def clienterror(ex)
130
+ err = { error: "#{ex.class}: #{ex.message}" }
131
+ [400, err.to_json]
132
+ end
66
133
  end
67
134
 
68
135
  # An API app module
@@ -92,12 +159,12 @@ module PuppetHerald
92
159
 
93
160
  get '/nodes' do
94
161
  content_type 'application/json'
95
- api.nodes
162
+ api.nodes request
96
163
  end
97
164
 
98
165
  get '/nodes/:id' do
99
166
  content_type 'application/json'
100
- api.get_node params
167
+ api.get_node params, request
101
168
  end
102
169
 
103
170
  get '/reports/:id' do
@@ -4,6 +4,7 @@ require 'sinatra/namespace'
4
4
  require 'sinatra/activerecord'
5
5
  require 'puppet-herald'
6
6
  require 'puppet-herald/javascript'
7
+ require 'puppet-herald/purgecronjob'
7
8
 
8
9
  # A module for Herald
9
10
  module PuppetHerald
@@ -16,14 +17,26 @@ module PuppetHerald
16
17
  set :database, PuppetHerald.database.spec unless PuppetHerald.database.spec.nil?
17
18
 
18
19
  class << self
19
- # Migrates a database to state desired for the application
20
+ # Configure the application
20
21
  #
22
+ # @param options [Hash] optional parameters
21
23
  # @return [nil]
22
- def dbmigrate!
23
- ActiveRecord::Base.establish_connection(PuppetHerald.database.spec)
24
+ def configure_app(options = {})
25
+ cron = options.fetch(:cron, true)
26
+ dbmigrate = options.fetch(:dbmigrate, true)
24
27
  setup_database_logger
25
- ActiveRecord::Migrator.up 'db/migrate'
26
- ActiveRecord::Base.clear_active_connections!
28
+ dbmigrate! if dbmigrate
29
+ enable_cron if cron
30
+ nil
31
+ end
32
+
33
+ # De-configure the application
34
+ #
35
+ # @param options [Hash] optional parameters
36
+ # @return [nil]
37
+ def deconfigure_app(options = {})
38
+ cron = options.fetch(:cron, true)
39
+ disable_cron if cron
27
40
  nil
28
41
  end
29
42
 
@@ -36,24 +49,43 @@ module PuppetHerald
36
49
 
37
50
  private
38
51
 
52
+ # Migrates a database to state desired for the application
53
+ #
54
+ # @return [nil]
55
+ def dbmigrate!
56
+ ActiveRecord::Base.establish_connection(PuppetHerald.database.spec)
57
+ ActiveRecord::Migrator.up 'db/migrate'
58
+ ActiveRecord::Base.clear_active_connections!
59
+ nil
60
+ end
61
+
62
+ # Enable cron in application
63
+ def enable_cron
64
+ require 'rufus/scheduler'
65
+ set :scheduler, Rufus::Scheduler.new
66
+ job = PuppetHerald::PurgeCronJob.new
67
+ # Run every 30 minutes, by default
68
+ cron = ENV['PUPPET_HERALD_PURGE_CRON'] || '*/30 * * * *'
69
+ PuppetHerald.logger.info "Stating scheduler with: `#{cron}`..."
70
+ scheduler.cron(cron) { job.run! }
71
+ end
72
+
73
+ # Disable cron in application
74
+ def disable_cron
75
+ scheduler.shutdown if scheduler.up?
76
+ PuppetHerald.logger.info 'Scheduler stopped.'
77
+ end
78
+
39
79
  # Sets logger level for database handlers
40
80
  #
41
81
  # @return [nil]
42
82
  def setup_database_logger
43
- if PuppetHerald.in_dev?
44
- ActiveRecord::Base.logger.level = Logger::DEBUG
45
- else
46
- ActiveRecord::Base.logger.level = Logger::WARN
47
- end
83
+ ActiveRecord::Base.logger = PuppetHerald.logger
48
84
  nil
49
85
  end
50
86
  end
51
87
 
52
- if PuppetHerald.in_dev?
53
- set :environment, :development
54
- else
55
- set :environment, :production
56
- end
88
+ set :environment, PuppetHerald.rackenv
57
89
  set :show_exceptions, false
58
90
 
59
91
  error do
@@ -37,20 +37,20 @@ module PuppetHerald
37
37
  set :logic, PuppetHerald::App::LogicImpl.new
38
38
 
39
39
  get '/' do
40
- redirect '/app.html', 301
40
+ cache_control :public, :must_revalidate, max_age: 60 if PuppetHerald.in_prod?
41
+ @minified, @files = settings.logic.app_html
42
+ erb :app
41
43
  end
42
44
 
43
45
  get '/index.html' do
44
- redirect '/app.html', 301
46
+ redirect '/', 301
45
47
  end
46
48
 
47
49
  get '/app.html' do
48
- cache_control :public, :must_revalidate, max_age: 60 if PuppetHerald.in_prod?
49
- @minified, @files = settings.logic.app_html
50
- erb :app
50
+ redirect '/', 301
51
51
  end
52
52
 
53
- get(/\/app\.min\.(js\.map|js)/) do |ext|
53
+ get %r{^/app\.min\.(js\.map|js)$} do |ext|
54
54
  content_type 'application/javascript'
55
55
  contents = settings.logic.uglify('/app.min.js.map')[ext]
56
56
  cache_control :public, :must_revalidate, max_age: 60 if PuppetHerald.in_prod?
@@ -3,37 +3,31 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <title>Herald - a Puppet report processor</title>
6
+ <title>Herald</title>
7
7
 
8
8
  <meta name="description" content="Herald - a Puppet report processor">
9
9
  <meta name="viewport" content="width=device-width, initial-scale=1">
10
10
  <!-- Latest compiled and minified CSS -->
11
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap<%= @minified %>.css">
11
+ <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap<%= @minified %>.css">
12
12
  <!-- Optional theme -->
13
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme<%= @minified %>.css">
13
+ <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap-theme<%= @minified %>.css">
14
14
  <link rel="stylesheet" href="css/herald.css">
15
+ <link rel="icon" type="image/png" href="img/shield97.png"/>
15
16
  </head>
16
17
  <body>
17
18
 
18
- <section class="container-fluid">
19
-
20
- <h2><a href="#/"><img src="/img/shield97.svg" />Herald</a> <small>a Puppet report processor</small></h2>
19
+ <ui-view></ui-view>
21
20
 
22
- <div ng-view></div>
23
-
24
- <address>
25
- <hr />
26
- <p class="text-muted"><small>Herald v<span app-version></span></small></p>
27
- </address>
28
- </section>
21
+ <script type="text/javascript" src="bower_components/angular/angular<%= @minified %>.js"></script>
22
+ <script type="text/javascript" src="bower_components/angular-ui-router/release/angular-ui-router<%= @minified %>.js"></script>
23
+ <script type="text/javascript" src="bower_components/angular-breadcrumb/release/angular-breadcrumb<%= @minified %>.js"></script>
24
+ <script type="text/javascript" src="bower_components/moment/min/moment.min.js"></script>
25
+ <script type="text/javascript" src="bower_components/angular-moment/angular-moment<%= @minified %>.js"></script>
26
+ <script type="text/javascript" src="bower_components/ngstorage/ngStorage<%= @minified %>.js"></script>
27
+ <script type="text/javascript" src="bower_components/angular-utils-pagination/dirPagination.js"></script>
29
28
 
30
- <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular<%= @minified %>.js"></script>
31
- <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-route<%= @minified %>.js"></script>
32
- <script src="//cdn.jsdelivr.net/momentjs/2.8.4/moment.min.js"></script>
33
- <script src="//cdn.jsdelivr.net/angular.moment/0.8.3/angular-moment<%= @minified %>.js"></script>
34
-
35
- <!-- Automatic incudes of project files -->
29
+ <!-- Automatic includes of project files -->
36
30
  <% @files.each do |file| %>
37
- <script src="<%= file %>"></script><% end %>
31
+ <script type="text/javascript" src="<%= file %>"></script><% end %>
38
32
  </body>
39
33
  </html>
@@ -3,13 +3,16 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <title>Error 500 | Herald - a Puppet report processor</title>
6
+ <title>Herald</title>
7
+ <title>Error 500 | Herald</title>
7
8
  <meta name="description" content="Herald - a Puppet report processor">
8
9
  <meta name="viewport" content="width=device-width, initial-scale=1">
9
10
  <!-- Latest compiled and minified CSS -->
10
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
11
+ <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap<%= @minified %>.css">
11
12
  <!-- Optional theme -->
12
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
13
+ <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap-theme<%= @minified %>.css">
14
+ <link rel="stylesheet" href="css/herald.css">
15
+ <link rel="icon" type="image/png" href="img/shield97.png"/>
13
16
  </head>
14
17
  <body>
15
18
 
@@ -18,10 +21,10 @@
18
21
 
19
22
  <div class="jumbotron">
20
23
  <h2 class="text-danger glyphicon glyphicon-fire">Internal Server Error (500)</h2>
21
- <p>Something realy unpredictable just happend...</p>
24
+ <p>Something really unpredictable just happend...</p>
22
25
  <div class="well well-lg"><samp><%= @bug[:message] %></samp></div>
23
26
  <p><small><strong>Pro Tip!</strong> Please report this bug by passing contents of bug file: <code><%= @bug[:bugfile] %></code></small></p>
24
- <p><a class="btn btn-danger btn-lg" href="<%= @bug[:homepage] %>" role="button">Report a bug</a></p>
27
+ <p><a class="btn btn-danger btn-lg" href="<%= @bug[:homepage] %>/issues/new" role="button">Report a bug</a></p>
25
28
  </div>
26
29
  </section>
27
30
  </body>
@@ -19,9 +19,17 @@ module PuppetHerald
19
19
  # @param block [block] an extra configuration block
20
20
  # @return [Sinatra::Application] an Herald application
21
21
  def run!(options = {}, &block)
22
- PuppetHerald::App::Configuration.dbmigrate!
22
+ PuppetHerald::App::Configuration.configure_app
23
23
  super options, *block
24
24
  end
25
+
26
+ # Deconfigure application
27
+ #
28
+ # @return [nil]
29
+ def quit!
30
+ PuppetHerald::App::Configuration.deconfigure_app
31
+ super
32
+ end
25
33
  end
26
34
  end
27
35
  end
@@ -1,5 +1,4 @@
1
1
  require 'micro-optparse'
2
- require 'logger'
3
2
  require 'puppet-herald'
4
3
  require 'puppet-herald/version'
5
4
  require 'puppet-herald/database'
@@ -11,21 +10,15 @@ module PuppetHerald
11
10
  # Initialize CLI
12
11
  # @return [CLI] an CLI object
13
12
  def initialize
14
- @logger = Logger.new STDOUT
15
- @errlogger = Logger.new STDERR
16
13
  self
17
14
  end
18
15
 
19
- # Logger for CLI interface (error and std)
20
- # @return [Logger] logger for CLI
21
- attr_reader :logger, :errlogger
22
-
23
16
  # Executes an Herald app from CLI
24
17
  #
25
18
  # @param argv [Array] an argv from CLI
26
19
  # @return [Integer] a status code for program
27
20
  def run!(argv = ARGV)
28
- PuppetHerald.environment
21
+ PuppetHerald.rackenv
29
22
 
30
23
  options = parse_or_kill argv, 2
31
24
  run_or_kill options, 1
@@ -40,7 +33,8 @@ module PuppetHerald
40
33
  def parse(argv)
41
34
  options = parser.process!(argv)
42
35
 
43
- logger.info "Starting #{PuppetHerald::NAME} v#{PuppetHerald::VERSION} in #{PuppetHerald.environment}..."
36
+ msg = "Starting #{PuppetHerald::NAME} v#{PuppetHerald::VERSION} in #{PuppetHerald.rackenv}..."
37
+ PuppetHerald.logger.info msg
44
38
  PuppetHerald.database.dbconn = options[:dbconn]
45
39
  PuppetHerald.database.passfile = options[:passfile]
46
40
  PuppetHerald.database.spec(true)
@@ -54,14 +48,14 @@ module PuppetHerald
54
48
  PuppetHerald::Application.run! options
55
49
  rescue StandardError => ex
56
50
  bug = PuppetHerald.bug(ex)
57
- errlogger.fatal "Unexpected error occured, mayby a bug?\n\n#{bug[:message]}\n\n#{bug[:help]}"
51
+ PuppetHerald.errlogger.fatal "Unexpected error occured, mayby a bug?\n\n#{bug[:message]}\n\n#{bug[:help]}"
58
52
  Kernel.exit retcode
59
53
  end
60
54
 
61
55
  def parse_or_kill(argv, retcode)
62
56
  return parse argv
63
57
  rescue StandardError => ex
64
- errlogger.fatal "Database configuration is invalid!\n\n#{ex.message}"
58
+ PuppetHerald.errlogger.fatal "Database configuration is invalid!\n\n#{ex.message}"
65
59
  Kernel.exit retcode
66
60
  end
67
61
 
@@ -1,5 +1,4 @@
1
1
  require 'fileutils'
2
- require 'logger'
3
2
 
4
3
  # A module for Herald
5
4
  module PuppetHerald
@@ -8,13 +7,8 @@ module PuppetHerald
8
7
  def initialize
9
8
  @dbconn = nil
10
9
  @passfile = nil
11
- @logger = Logger.new STDOUT
12
10
  end
13
11
 
14
- # Gets a logger for database
15
- # @return [Logger] a logger
16
- attr_reader :logger
17
-
18
12
  # Sets a database connection
19
13
  # @return [String] a dbconnection string
20
14
  attr_writer :dbconn
@@ -57,7 +51,7 @@ module PuppetHerald
57
51
  return unless log
58
52
  copy = connection.dup
59
53
  copy[:password] = '***' unless copy[:password].nil?
60
- logger.info "Using #{copy.inspect} for database."
54
+ PuppetHerald.logger.info "Using #{copy.inspect} for database."
61
55
  end
62
56
 
63
57
  def sqlite(match)