greenhat 0.9.0 → 0.9.1
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/greenhat/archive.rb +30 -22
- data/lib/greenhat/thing/file_types.rb +30 -0
- data/lib/greenhat/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: 0107064d86f7742b834d46b40d19cf8de0a8ec0d37445c0a514d778b7faef7dd
|
4
|
+
data.tar.gz: 9a980031e5c392d1801901a67433a8999d6ed72ed468d0f444a4d37a794f6cf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 260b3a5f31f732c33a20812be19264108d3691f44329d44665bbb7d032256cd58c3616177c098eefc8f7abdf402fc10b88e513ab56a9e59acc22539cab6d4437
|
7
|
+
data.tar.gz: e6dd3c2ddcaef6d3644fbd14425cda9caa0a3281a2949fdde185a9b3e37c07db5bad977346e3b01112cd653f77462efae81ff2fba7a615d87bf7b149d3ceb97d
|
data/lib/greenhat/archive.rb
CHANGED
@@ -48,32 +48,42 @@ module GreenHat
|
|
48
48
|
end
|
49
49
|
# rubocop:enable Style/SymbolProc
|
50
50
|
|
51
|
+
# If the archive is corrupt and doesn't uncompress properly, greenhat will keep looping on it endlessly,
|
52
|
+
# trying to decompress it. let's rename it on failure so it stops trying, but the SE can still try and
|
53
|
+
# extract it themselves.
|
54
|
+
def self.unpack_cmd(run_me, archive_path)
|
55
|
+
stdout, stderr, status = Open3.capture3(run_me)
|
56
|
+
|
57
|
+
if status.success?
|
58
|
+
# No Doubling Up
|
59
|
+
FileUtils.rm_f(archive_path)
|
60
|
+
return
|
61
|
+
end
|
62
|
+
# Simplified Logging
|
63
|
+
base_name = File.basename(archive_path)
|
64
|
+
|
65
|
+
LogBot.warn('Archive', "Unable to decompress #{base_name.pastel(:green)}, moving to #{base_name}.broken")
|
66
|
+
LogBot.warn('Archive', "STDOUT: #{stdout.pastel(:red)}")
|
67
|
+
LogBot.warn('Archive', "STDERR: #{stderr.pastel(:red)}")
|
68
|
+
FileUtils.mv(archive_path, "#{archive_path}.broken")
|
69
|
+
end
|
70
|
+
|
51
71
|
# Handle Different Types of Archives
|
52
72
|
def self.unpack(archive_path, path)
|
53
|
-
decompressed_successfully = false
|
54
|
-
|
55
73
|
case File.extname archive_path
|
56
74
|
when '.tgz', '.tar'
|
57
75
|
base_path = archive_path.gsub(File.basename(archive_path), '')
|
58
|
-
|
59
|
-
|
60
|
-
decompressed_successfully = $CHILD_STATUS.success?
|
61
|
-
FileUtils.rm(archive_path) if decompressed_successfully
|
76
|
+
unpack_cmd("bsdtar -xf #{archive_path} -C #{base_path}", archive_path)
|
62
77
|
when '.gz'
|
63
|
-
|
64
|
-
|
65
|
-
decompressed_successfully = $CHILD_STATUS.success?
|
78
|
+
unpack_cmd("gzip -d #{archive_path}", archive_path)
|
66
79
|
when '.zip'
|
67
80
|
base_path = archive_path.gsub(File.basename(archive_path), '')
|
68
|
-
|
81
|
+
unpack_cmd("unzip -o -d #{base_path} #{archive_path}", archive_path)
|
69
82
|
|
70
|
-
decompressed_successfully = $CHILD_STATUS.success?
|
71
|
-
FileUtils.rm(archive_path) if decompressed_successfully
|
72
83
|
when '.bz2'
|
73
|
-
|
74
|
-
|
75
|
-
decompressed_successfully = $CHILD_STATUS.success?
|
84
|
+
unpack_cmd("bzip2 -d #{archive_path}", archive_path)
|
76
85
|
when '.s'
|
86
|
+
# LogBot.info('Archive', file: archive_path, message: 'Rename .s files')
|
77
87
|
# Find Original Directory, Split Path, Rename to .gz
|
78
88
|
base_path = archive_path.gsub(File.basename(archive_path), '')
|
79
89
|
FileUtils.mv(archive_path, "#{base_path}/#{File.basename(archive_path, '.s')}.gz")
|
@@ -81,14 +91,12 @@ module GreenHat
|
|
81
91
|
FileUtils.cp(archive_path, "#{path}/#{archive_path}")
|
82
92
|
end
|
83
93
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
return if decompressed_successfully
|
94
|
+
# Safety Exception Handling to Prevent Endless looping
|
95
|
+
rescue StandardError => e
|
96
|
+
LogBot.fatal('Archive', file: archive_path, message: e.message, backtrace: e.backtrace.first)
|
88
97
|
|
89
|
-
|
90
|
-
|
91
|
-
FileUtils.mv(archive_path, "#{archive_path}.broken")
|
98
|
+
# Safety no looping
|
99
|
+
FileUtils.rm_f(archive_path)
|
92
100
|
end
|
93
101
|
|
94
102
|
def self.archive?(file_name)
|
@@ -24,6 +24,36 @@ module GreenHat
|
|
24
24
|
%r{gitlab/gitlab.rb}
|
25
25
|
]
|
26
26
|
},
|
27
|
+
'gitaly_check' => {
|
28
|
+
format: :raw,
|
29
|
+
pattern: [
|
30
|
+
/gitaly_check/
|
31
|
+
]
|
32
|
+
},
|
33
|
+
'gitaly_internal_api_check' => {
|
34
|
+
format: :raw,
|
35
|
+
pattern: [
|
36
|
+
/gitaly_internal_api_check/
|
37
|
+
]
|
38
|
+
},
|
39
|
+
'lsblk' => {
|
40
|
+
format: :raw,
|
41
|
+
pattern: [
|
42
|
+
/lsblk/
|
43
|
+
]
|
44
|
+
},
|
45
|
+
'zoekt_info' => {
|
46
|
+
format: :raw,
|
47
|
+
pattern: [
|
48
|
+
/zoekt_info/
|
49
|
+
]
|
50
|
+
},
|
51
|
+
'systemd_detect_virt' => {
|
52
|
+
format: :raw,
|
53
|
+
pattern: [
|
54
|
+
/systemd_detect_virt/
|
55
|
+
]
|
56
|
+
},
|
27
57
|
'cpuinfo' => {
|
28
58
|
format: :raw,
|
29
59
|
pattern: [
|
data/lib/greenhat/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greenhat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davin Walker
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-22 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: actionview
|