Class: PuppetHerald::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet-herald/database.rb

Overview

A class for a database configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDatabase

Returns a new instance of Database.



8
9
10
11
# File 'lib/puppet-herald/database.rb', line 8

def initialize
  @dbconn   = nil
  @passfile = nil
end

Instance Attribute Details

#dbconn=(value) ⇒ String (writeonly)

Sets a database connection

Returns:

  • (String)

    a dbconnection string



15
16
17
# File 'lib/puppet-herald/database.rb', line 15

def dbconn=(value)
  @dbconn = value
end

#passfile=(value) ⇒ String (writeonly)

Sets a passfile

Returns:

  • (String)

    a password file



19
20
21
# File 'lib/puppet-herald/database.rb', line 19

def passfile=(value)
  @passfile = value
end

Instance Method Details

#spec(log = false) ⇒ Hash

Compiles a spec for database creation

Parameters:

  • log (Boolean) (defaults to: false)

    should log on screen?

Returns:

  • (Hash)

    a database configuration



25
26
27
28
29
# File 'lib/puppet-herald/database.rb', line 25

def spec(log = false)
  connection = process_spec
  print_config(connection, log)
  connection
end