Class: Inspec::Resources::Mysql

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/resources/mysql.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMysql

Returns a new instance of Mysql.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/inspec/resources/mysql.rb', line 10

def initialize
  # set OS-dependent filenames and paths
  case inspec.os[:family]
  when "debian"
    init_ubuntu
  when "redhat", "fedora"
    init_redhat
  when "arch"
    init_arch
  else
    # TODO: could not detect
    init_default
  end
end

Instance Attribute Details

#conf_dirObject (readonly)

Returns the value of attribute conf_dir.



9
10
11
# File 'lib/inspec/resources/mysql.rb', line 9

def conf_dir
  @conf_dir
end

#conf_pathObject (readonly)

Returns the value of attribute conf_path.



9
10
11
# File 'lib/inspec/resources/mysql.rb', line 9

def conf_path
  @conf_path
end

#data_dirObject (readonly)

Returns the value of attribute data_dir.



9
10
11
# File 'lib/inspec/resources/mysql.rb', line 9

def data_dir
  @data_dir
end

#log_dirObject (readonly)

Returns the value of attribute log_dir.



9
10
11
# File 'lib/inspec/resources/mysql.rb', line 9

def log_dir
  @log_dir
end

#log_dir_groupObject (readonly)

Returns the value of attribute log_dir_group.



9
10
11
# File 'lib/inspec/resources/mysql.rb', line 9

def log_dir_group
  @log_dir_group
end

#log_groupObject (readonly)

Returns the value of attribute log_group.



9
10
11
# File 'lib/inspec/resources/mysql.rb', line 9

def log_group
  @log_group
end

#log_pathObject (readonly)

Returns the value of attribute log_path.



9
10
11
# File 'lib/inspec/resources/mysql.rb', line 9

def log_path
  @log_path
end

#packageObject (readonly)

Returns the value of attribute package.



9
10
11
# File 'lib/inspec/resources/mysql.rb', line 9

def package
  @package
end

#serviceObject (readonly)

Returns the value of attribute service.



9
10
11
# File 'lib/inspec/resources/mysql.rb', line 9

def service
  @service
end

Instance Method Details

#init_archObject



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/inspec/resources/mysql.rb', line 54

def init_arch
  @package = "mariadb"
  @service = "mysql"
  @conf_path = "/etc/mysql/my.cnf"
  @conf_dir = "/etc/mysql/"
  @data_dir = "/var/lib/mysql/"
  @log_dir = "/var/log/"
  @log_path = "/var/log/mysql.log"
  @log_group = "mysql"
  @log_dir_group = "root"
end

#init_defaultObject



66
67
68
69
70
71
72
73
74
75
# File 'lib/inspec/resources/mysql.rb', line 66

def init_default
  @service = "mysqld"
  @conf_path = "/etc/my.cnf"
  @conf_dir = "/etc/"
  @data_dir = "/var/lib/mysql/"
  @log_dir = "/var/log/"
  @log_path = "/var/log/mysqld.log"
  @log_group = "mysql"
  @log_dir_group = "root"
end

#init_redhatObject



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/inspec/resources/mysql.rb', line 42

def init_redhat
  @package = "mysql-server"
  @service = "mysqld"
  @conf_path = "/etc/my.cnf"
  @conf_dir = "/etc/"
  @data_dir = "/var/lib/mysql/"
  @log_dir = "/var/log/"
  @log_path = "/var/log/mysqld.log"
  @log_group = "mysql"
  @log_dir_group = "root"
end

#init_ubuntuObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/inspec/resources/mysql.rb', line 25

def init_ubuntu
  @package = "mysql-server"
  @service = "mysql"
  @conf_path = "/etc/mysql/my.cnf"
  @conf_dir = "/etc/mysql/"
  @data_dir = "/var/lib/mysql/"
  @log_dir = "/var/log/"
  @log_path = "/var/log/mysql.log"
  @log_group = "adm"
  case inspec.os[:release]
  when "14.04"
    @log_dir_group = "syslog"
  else
    @log_dir_group = "root"
  end
end

#to_sObject



77
78
79
# File 'lib/inspec/resources/mysql.rb', line 77

def to_s
  "MySQL"
end