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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e82009def6948189e79cbb259088c57da5e1f22aa50e5c47a560a76e2a16e9e
4
- data.tar.gz: 31fe1dbb0ec0d740e962942f6d4c511b8c5facebee16411e6daa0d93c1272d47
3
+ metadata.gz: 0107064d86f7742b834d46b40d19cf8de0a8ec0d37445c0a514d778b7faef7dd
4
+ data.tar.gz: 9a980031e5c392d1801901a67433a8999d6ed72ed468d0f444a4d37a794f6cf0
5
5
  SHA512:
6
- metadata.gz: 1719579efd5c3accf5fe402c5b57e51c7613a530bc715f0e71e88e6a8dac7ac05cb965e4d0351dcd8a0fe38aefe4f16dbf76c4692fe93cff40aa325c38a72a10
7
- data.tar.gz: d953dec24128e963a38b58949214d76b5ae32ee0a0f01f47997201ff07a24219f2b8911e06121022d76235ccf5105766cbacb39f3402d796484ef0e24799d42e
6
+ metadata.gz: 260b3a5f31f732c33a20812be19264108d3691f44329d44665bbb7d032256cd58c3616177c098eefc8f7abdf402fc10b88e513ab56a9e59acc22539cab6d4437
7
+ data.tar.gz: e6dd3c2ddcaef6d3644fbd14425cda9caa0a3281a2949fdde185a9b3e37c07db5bad977346e3b01112cd653f77462efae81ff2fba7a615d87bf7b149d3ceb97d
@@ -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
- `bsdtar -xf "#{archive_path}" -C #{base_path}`
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
- `gzip -d "#{archive_path}"`
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
- `unzip -o -d "#{base_path}" #{archive_path}`
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
- `bzip2 -d #{archive_path}`
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
- # if the archive is corrupt and doesn't uncompress properly, greenhat will keep looping on it endlessly,
85
- # trying to decompress it. let's rename it on failure so it stops trying, but the SE can still try and
86
- # extract it themselves.
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
- puts "#{'Decompress failed'.pastel(:red)}: #{archive_path.pastel(:green)}"
90
- puts 'Renaming file so we can continue.'.pastel(:yellow)
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: [
@@ -1,3 +1,3 @@
1
1
  module GreenHat
2
- VERSION = '0.9.0'.freeze
2
+ VERSION = '0.9.1'.freeze
3
3
  end
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.0
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-03 00:00:00.000000000 Z
10
+ date: 2025-04-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: actionview