socotra-build 0.3.36 → 0.3.37
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/lib/socotra-build.rb +18 -16
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3897e7d32763b7664839b7a1d37a40fecde8be77
|
|
4
|
+
data.tar.gz: c8afb869e653520cff0516b4af3c8140f6592688
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bf00ce16138808a32e9414e1cc3b0afe1eef059884e68c24c306c603444c4fc778901456b4519935656648dc04aee8cc568dbc614035fb996a42c28da4e4fa45
|
|
7
|
+
data.tar.gz: cffd38c8f30affcdfdbade74c5e1e02d03b1fd35f97f472189e58af28c31af59cc2cf520ff015092e550c8513a5e7e3d246ae8c60ab579a57c779a775f1ee54c
|
data/lib/socotra-build.rb
CHANGED
|
@@ -60,9 +60,9 @@ def self.pid_exists(pid)
|
|
|
60
60
|
return true
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
def self.kill_pid(pid)
|
|
64
|
-
puts "
|
|
65
|
-
|
|
63
|
+
def self.kill_pid(pid, timeout)
|
|
64
|
+
puts "INFO: #{pid} timed out after #{timeout}, killing it"
|
|
65
|
+
|
|
66
66
|
killpid = fork { Process.kill('INT', pid) }
|
|
67
67
|
Process.detach(killpid)
|
|
68
68
|
begin
|
|
@@ -85,18 +85,22 @@ def self.system_safe(cmd=cmd, cmd_description=cmd_description, error_message=err
|
|
|
85
85
|
puts "Not logging command"
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
if log
|
|
89
|
+
log_out = "logs/#{cmd_description}_out.log"
|
|
90
|
+
log_err = "logs/#{cmd_description}_err.log"
|
|
91
|
+
else
|
|
92
|
+
log_out = "/dev/null"
|
|
93
|
+
log_err = "/dev/null"
|
|
94
|
+
end
|
|
90
95
|
|
|
91
96
|
pid = spawn(cmd, :out=>log_out, :err=>log_err)
|
|
92
|
-
puts "pid of spawned process: #{pid}"
|
|
93
97
|
begin
|
|
94
98
|
Timeout::timeout(timeout) do
|
|
95
99
|
Process.wait(pid)
|
|
96
100
|
end
|
|
97
101
|
rescue Timeout::Error
|
|
98
102
|
while pid_exists(pid)
|
|
99
|
-
if kill_pid(pid)
|
|
103
|
+
if kill_pid(pid, timeout)
|
|
100
104
|
break
|
|
101
105
|
end
|
|
102
106
|
end
|
|
@@ -105,16 +109,15 @@ def self.system_safe(cmd=cmd, cmd_description=cmd_description, error_message=err
|
|
|
105
109
|
|
|
106
110
|
elapsed = Time.now.to_i - start
|
|
107
111
|
|
|
108
|
-
puts "\
|
|
112
|
+
puts "\tINFO: #{cmd_description} took #{elapsed} seconds"
|
|
109
113
|
|
|
110
114
|
file = File.open("logs/#{cmd_description}_out.log", "rb")
|
|
111
115
|
out = file.read
|
|
112
116
|
|
|
113
117
|
if log
|
|
114
|
-
puts "\
|
|
118
|
+
puts "\tINFO: Logs available here: #{cmd_description}_err.log and #{cmd_description}_out.log\n\n"
|
|
115
119
|
else
|
|
116
|
-
|
|
117
|
-
File.delete("logs/#{cmd_description}_out.log")
|
|
120
|
+
puts "\tINFO: Logs unavailable due to user settings"
|
|
118
121
|
end
|
|
119
122
|
|
|
120
123
|
if not success and raise_on_fail
|
|
@@ -125,9 +128,9 @@ def self.system_safe(cmd=cmd, cmd_description=cmd_description, error_message=err
|
|
|
125
128
|
puts "#{log_level}: see logs/#{cmd_description}_out.log and #{cmd_description}_err.log for details"
|
|
126
129
|
end
|
|
127
130
|
raise "#{log_level}: #{error_message}"
|
|
128
|
-
|
|
131
|
+
end
|
|
129
132
|
|
|
130
|
-
return
|
|
133
|
+
return success
|
|
131
134
|
end
|
|
132
135
|
|
|
133
136
|
def self.system_unsafe(cmd)
|
|
@@ -136,9 +139,8 @@ def self.system_unsafe(cmd)
|
|
|
136
139
|
end
|
|
137
140
|
|
|
138
141
|
def self.get_secret(key, subkey, log_identifier)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
secret = secret.strip
|
|
142
|
+
secret = `vault read -field=#{subkey} #{key}`
|
|
143
|
+
secret = secret.strip
|
|
142
144
|
|
|
143
145
|
return secret
|
|
144
146
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: socotra-build
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.37
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Antenesse
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-07-
|
|
11
|
+
date: 2017-07-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Common functions for build
|
|
14
14
|
email: chris.antenesse@socotra.com
|