obs_deploy 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/obs_deploy/apache_sysconfig.rb +35 -9
- data/lib/obs_deploy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56e0cc88321f0bc33598a1e3ea3ded2ed35b4d9bead0dc610283f8763c2dd535
|
4
|
+
data.tar.gz: 95753db3ab45df12657cd1732e5eb99a90f297a5fe4bfc755faeaface8768e67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 358cdbc116947e6f1a4138cf3a1bb547758b362f5d46cb6bf0bca2324010ad2ed5c526a16551c0aa35d6fa6d8ab2e2e00dbf27ee7e8da07e290aeea54c18733a
|
7
|
+
data.tar.gz: 0a9dfb324d28c6629ddb598e7081c22561d63721f595dd455528b7c83bae324903f6f25985c6fc963dafca3a4bc26b8bdbec2e9a00585762a0ff795ad6b607a2
|
data/Gemfile.lock
CHANGED
@@ -2,30 +2,56 @@
|
|
2
2
|
|
3
3
|
module ObsDeploy
|
4
4
|
class ApacheSysconfig
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :path
|
6
6
|
|
7
7
|
def initialize
|
8
|
-
@
|
8
|
+
@path = '/etc/sysconfig/apache2'
|
9
9
|
end
|
10
10
|
|
11
11
|
def enable_maintenance_mode
|
12
|
-
|
12
|
+
unless maintenance_mode?
|
13
|
+
content = File.read(path).gsub(/^#{server_flags}=\"STATUS\"$/,
|
14
|
+
apache_status_line(maintenance))
|
15
|
+
write_apache_sysconfig(content)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
def disable_maintenance_mode
|
16
|
-
|
20
|
+
if maintenance_mode?
|
21
|
+
content = File.read(path).gsub(/^#{server_flags}=\"STATUS MAINTENANCE\"/,
|
22
|
+
apache_status_line(no_maintenance))
|
23
|
+
write_apache_sysconfig(content)
|
24
|
+
end
|
17
25
|
end
|
18
26
|
|
19
27
|
def maintenance_mode?
|
20
|
-
|
28
|
+
find_server_flags.all? { |r| r.include?('MAINTENANCE') }
|
21
29
|
end
|
22
30
|
|
23
31
|
private
|
24
32
|
|
25
|
-
def
|
26
|
-
|
27
|
-
|
28
|
-
|
33
|
+
def no_maintenance
|
34
|
+
'STATUS'
|
35
|
+
end
|
36
|
+
|
37
|
+
def maintenance
|
38
|
+
'STATUS MAINTENANCE'
|
39
|
+
end
|
40
|
+
|
41
|
+
def server_flags
|
42
|
+
'APACHE_SERVER_FLAGS'
|
43
|
+
end
|
44
|
+
|
45
|
+
def apache_status_line(status)
|
46
|
+
"#{server_flags}=\"#{status}\""
|
47
|
+
end
|
48
|
+
|
49
|
+
def find_server_flags
|
50
|
+
File.readlines(path).grep(/^#{server_flags}=/)
|
51
|
+
end
|
52
|
+
|
53
|
+
def write_apache_sysconfig(content)
|
54
|
+
File.open(path, 'wb') { |file| file.write(content) }
|
29
55
|
end
|
30
56
|
end
|
31
57
|
end
|
data/lib/obs_deploy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: obs_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pereira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04
|
11
|
+
date: 2020-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|