Class: Inspec::Resources::Mysql

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMysql

Returns a new instance of Mysql.



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

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.



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

def conf_dir
  @conf_dir
end

#conf_pathObject (readonly)

Returns the value of attribute conf_path.



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

def conf_path
  @conf_path
end

#data_dirObject (readonly)

Returns the value of attribute data_dir.



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

def data_dir
  @data_dir
end

#log_dirObject (readonly)

Returns the value of attribute log_dir.



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

def log_dir
  @log_dir
end

#log_dir_groupObject (readonly)

Returns the value of attribute log_dir_group.



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

def log_dir_group
  @log_dir_group
end

#log_groupObject (readonly)

Returns the value of attribute log_group.



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

def log_group
  @log_group
end

#log_pathObject (readonly)

Returns the value of attribute log_path.



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

def log_path
  @log_path
end

#packageObject (readonly)

Returns the value of attribute package.



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

def package
  @package
end

#serviceObject (readonly)

Returns the value of attribute service.



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

def service
  @service
end

Instance Method Details

#init_archObject



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

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



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

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



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

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



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

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



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

def to_s
  'MySQL'
end