Class: ObsDeploy::ApacheSysconfig

Inherits:
Object
  • Object
show all
Defined in:
lib/obs_deploy/apache_sysconfig.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApacheSysconfig

Returns a new instance of ApacheSysconfig.



7
8
9
# File 'lib/obs_deploy/apache_sysconfig.rb', line 7

def initialize
  @path = '/etc/sysconfig/apache2'
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/obs_deploy/apache_sysconfig.rb', line 5

def path
  @path
end

Instance Method Details

#disable_maintenance_modeObject



19
20
21
22
23
24
25
# File 'lib/obs_deploy/apache_sysconfig.rb', line 19

def disable_maintenance_mode
  if maintenance_mode?
    content = File.read(path).gsub(/^#{server_flags}="STATUS MAINTENANCE"/,
                                   apache_status_line(no_maintenance))
    write_apache_sysconfig(content)
  end
end

#enable_maintenance_modeObject



11
12
13
14
15
16
17
# File 'lib/obs_deploy/apache_sysconfig.rb', line 11

def enable_maintenance_mode
  unless maintenance_mode?
    content = File.read(path).gsub(/^#{server_flags}="STATUS"$/,
                                   apache_status_line(maintenance))
    write_apache_sysconfig(content)
  end
end

#maintenance_mode?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/obs_deploy/apache_sysconfig.rb', line 27

def maintenance_mode?
  find_server_flags.all? { |r| r.include?('MAINTENANCE') }
end