pais_legacy 2.6.11 → 2.6.12
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 +23 -21
- data/lib/pais_legacy/version.rb +1 -1
- data/lib/pais_legacy.rb +58 -28
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 661d4713fc34b7e67ca8a49d1aaaa308cf803f3bed466f4dcf294d8385b14453
|
4
|
+
data.tar.gz: '09eac6e557d924fdeb809028db33697877b8d570ceddda29bf983ac4a429ede5'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 892be86aa2d46c83860fd59f5ea5627d55ca208115465ed6d78f43a1dcac2b530ac0690ea5531a5da5fce468d669a88d7ceb4a12821b51e94ce6c9852c346c56
|
7
|
+
data.tar.gz: cc1d69f67578dfe7767895c7f6c17886886f43a9319437e12fa034a1e870df3656a165b84cc568f963355e41e45a006c7ce005ec57e6c5d138fd0d1eae2f25eb
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pais_legacy (2.6.
|
4
|
+
pais_legacy (2.6.11)
|
5
5
|
net-ssh
|
6
6
|
pastel (~> 0.8)
|
7
7
|
|
@@ -10,37 +10,39 @@ GEM
|
|
10
10
|
specs:
|
11
11
|
ast (2.4.2)
|
12
12
|
byebug (11.1.3)
|
13
|
-
json (2.
|
14
|
-
|
13
|
+
json (2.9.1)
|
14
|
+
language_server-protocol (3.17.0.4)
|
15
|
+
minitest (5.25.4)
|
15
16
|
mocha (1.16.1)
|
16
|
-
net-ssh (7.
|
17
|
-
parallel (1.
|
18
|
-
parser (3.
|
17
|
+
net-ssh (7.3.0)
|
18
|
+
parallel (1.26.3)
|
19
|
+
parser (3.3.7.0)
|
19
20
|
ast (~> 2.4.1)
|
20
21
|
racc
|
21
22
|
pastel (0.8.0)
|
22
23
|
tty-color (~> 0.5)
|
23
|
-
racc (1.
|
24
|
+
racc (1.8.1)
|
24
25
|
rainbow (3.1.1)
|
25
|
-
rake (13.
|
26
|
-
regexp_parser (2.
|
27
|
-
|
28
|
-
rubocop (1.52.1)
|
26
|
+
rake (13.2.1)
|
27
|
+
regexp_parser (2.10.0)
|
28
|
+
rubocop (1.71.1)
|
29
29
|
json (~> 2.3)
|
30
|
+
language_server-protocol (>= 3.17.0)
|
30
31
|
parallel (~> 1.10)
|
31
|
-
parser (>= 3.
|
32
|
+
parser (>= 3.3.0.2)
|
32
33
|
rainbow (>= 2.2.2, < 4.0)
|
33
|
-
regexp_parser (>=
|
34
|
-
|
35
|
-
rubocop-ast (>= 1.28.0, < 2.0)
|
34
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
35
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
36
36
|
ruby-progressbar (~> 1.7)
|
37
|
-
unicode-display_width (>= 2.4.0, <
|
38
|
-
rubocop-ast (1.
|
39
|
-
parser (>= 3.
|
37
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
38
|
+
rubocop-ast (1.38.0)
|
39
|
+
parser (>= 3.3.1.0)
|
40
40
|
ruby-progressbar (1.13.0)
|
41
|
-
timecop (0.9.
|
41
|
+
timecop (0.9.10)
|
42
42
|
tty-color (0.6.0)
|
43
|
-
unicode-display_width (
|
43
|
+
unicode-display_width (3.1.4)
|
44
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
45
|
+
unicode-emoji (4.0.4)
|
44
46
|
|
45
47
|
PLATFORMS
|
46
48
|
x86_64-linux
|
@@ -55,4 +57,4 @@ DEPENDENCIES
|
|
55
57
|
timecop (~> 0.9)
|
56
58
|
|
57
59
|
BUNDLED WITH
|
58
|
-
2.
|
60
|
+
2.6.3
|
data/lib/pais_legacy/version.rb
CHANGED
data/lib/pais_legacy.rb
CHANGED
@@ -18,6 +18,9 @@ module PaisLegacy
|
|
18
18
|
SERVER="pais.com.au"
|
19
19
|
USER="map7"
|
20
20
|
KEY="/home/map7/.ssh/id_rsa"
|
21
|
+
|
22
|
+
MAX_RETRIES = 5
|
23
|
+
RETRY_DELAY = 1 # seconds
|
21
24
|
|
22
25
|
SUSPENSE_ACCOUNT=1599
|
23
26
|
CLEARING_ACCOUNT=5199
|
@@ -29,40 +32,67 @@ module PaisLegacy
|
|
29
32
|
|
30
33
|
def self.execute_ssh_command(command)
|
31
34
|
output = ""
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
35
|
+
retries = 0
|
36
|
+
|
37
|
+
begin
|
38
|
+
|
39
|
+
# Start an SSH session
|
40
|
+
Net::SSH.start(SERVER,USER,keys: [KEY]) do |ssh|
|
41
|
+
# Open a new SSH channel
|
42
|
+
ssh.open_channel do |channel|
|
43
|
+
# Request a pseudo-tty
|
44
|
+
channel.request_pty do |ch, success|
|
45
|
+
raise "Could not obtain pty" unless success
|
46
|
+
|
47
|
+
# Execute the command
|
48
|
+
ch.exec(command) do |ch, success|
|
49
|
+
raise "Could not execute command" unless success
|
50
|
+
|
51
|
+
# Collect the data received from the command's standard output
|
52
|
+
ch.on_data do |c, data|
|
53
|
+
output += data
|
54
|
+
end
|
55
|
+
|
56
|
+
# Collect the data received from the command's standard error
|
57
|
+
ch.on_extended_data do |c, type, data|
|
58
|
+
output += "stderr: #{data}"
|
59
|
+
end
|
60
|
+
|
61
|
+
ch.on_close do
|
62
|
+
puts "Command execution finished"
|
63
|
+
end
|
57
64
|
end
|
58
65
|
end
|
59
66
|
end
|
67
|
+
|
68
|
+
# Keep the session open until the command execution is finished
|
69
|
+
ssh.loop
|
60
70
|
end
|
61
71
|
|
62
|
-
|
63
|
-
|
64
|
-
|
72
|
+
rescue Net::SSH::ConnectionTimeout => e
|
73
|
+
retries += 1
|
74
|
+
if retries <= MAX_RETRIES
|
75
|
+
puts "Connection timed out, retrying (#{retries}/#{MAX_RETRIES})..."
|
76
|
+
sleep RETRY_DELAY
|
77
|
+
retry
|
78
|
+
else
|
79
|
+
puts "Max retries reached. Could not connect."
|
80
|
+
end
|
65
81
|
|
82
|
+
rescue Errno::ECONNRESET => e
|
83
|
+
retries += 1
|
84
|
+
if retries <= MAX_RETRIES
|
85
|
+
puts "Connection reset by peer, retrying (#{retries}/#{MAX_RETRIES})..."
|
86
|
+
sleep RETRY_DELAY
|
87
|
+
retry
|
88
|
+
else
|
89
|
+
puts "Max retries reached. Could not connect."
|
90
|
+
end
|
91
|
+
|
92
|
+
rescue StandardError => e
|
93
|
+
puts "An error occurred: #{e.message}"
|
94
|
+
end
|
95
|
+
|
66
96
|
output
|
67
97
|
end
|
68
98
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pais_legacy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Pope
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-04 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: pastel
|
@@ -61,7 +60,6 @@ licenses:
|
|
61
60
|
- MIT
|
62
61
|
metadata:
|
63
62
|
homepage_uri: https://github.com/map7/pais_legacy
|
64
|
-
post_install_message:
|
65
63
|
rdoc_options: []
|
66
64
|
require_paths:
|
67
65
|
- lib
|
@@ -76,8 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
74
|
- !ruby/object:Gem::Version
|
77
75
|
version: '0'
|
78
76
|
requirements: []
|
79
|
-
rubygems_version: 3.
|
80
|
-
signing_key:
|
77
|
+
rubygems_version: 3.6.3
|
81
78
|
specification_version: 4
|
82
79
|
summary: PAIS Legacy API Wrapper
|
83
80
|
test_files: []
|