Class: ObsDeploy::ApacheSysconfig
- Inherits:
-
Object
- Object
- ObsDeploy::ApacheSysconfig
- Defined in:
- lib/obs_deploy/apache_sysconfig.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #disable_maintenance_mode ⇒ Object
- #enable_maintenance_mode ⇒ Object
-
#initialize ⇒ ApacheSysconfig
constructor
A new instance of ApacheSysconfig.
- #maintenance_mode? ⇒ Boolean
Constructor Details
#initialize ⇒ ApacheSysconfig
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
#path ⇒ Object (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_mode ⇒ Object
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_mode ⇒ Object
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
27 28 29 |
# File 'lib/obs_deploy/apache_sysconfig.rb', line 27 def maintenance_mode? find_server_flags.all? { |r| r.include?('MAINTENANCE') } end |