teuton 2.9.3 → 2.9.4
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/docs/changelog/changelog.2.md +9 -0
- data/docs/install/README.md +2 -2
- data/docs/install/s-node.md +3 -3
- data/docs/install/t-node.md +8 -13
- data/docs/learn/02-target.md +4 -4
- data/lib/teuton/case/dsl/expect.rb +2 -0
- data/lib/teuton/case/execute/execute_base.rb +8 -4
- data/lib/teuton/case/execute/execute_ssh.rb +0 -1
- data/lib/teuton/case/execute/execute_telnet.rb +21 -14
- data/lib/teuton/readme/readme.rb +6 -6
- data/lib/teuton/version.rb +1 -1
- data/lib/teuton.rb +0 -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: 6df4861135eb226e52818814c68af43772f58cd196c5cd8008572a4bbaa26065
|
4
|
+
data.tar.gz: fe68c2d388c2e506641addcb32476c8de97c77224d50333a8026e2fc263656a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b853fecce334497ee93d289e90f67ce8ab1d6f3f78d67072d0ed424df431e1e967a3f529c20cec4089e76d05209b7854f1d311115ec5e385185bcbf6d8cacb5
|
7
|
+
data.tar.gz: 56d989afeeca6f82b9f03a8a3d1613814db19e47df0d4e301934affa03e8faff033c7d85a6c60d14b04b9764ca56392db66659d5238cb314f204594b07393676
|
@@ -117,3 +117,12 @@ DSL send:
|
|
117
117
|
/home/username/example/foo/start.rb
|
118
118
|
or /home/username/example/foo.rb
|
119
119
|
```
|
120
|
+
|
121
|
+
## [2.9.3] 20250402
|
122
|
+
|
123
|
+
- [FIX] Error with telnet connections.
|
124
|
+
|
125
|
+
## [2.9.4] 20250410
|
126
|
+
|
127
|
+
- [FIX] Improve the markdown output of the readme.
|
128
|
+
- [FIX] Telnet exitcode
|
data/docs/install/README.md
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
# Installation
|
4
4
|
|
5
|
-
There are 2 types of nodes
|
5
|
+
There are 2 types of nodes (hosts), so there are 2 installations:
|
6
6
|
|
7
7
|
| ID | Software | Description |
|
8
8
|
| -- | -------- | ----------- |
|
9
9
|
| **T-node** | [Teuton installation](t-node.md) | T-NODE host monitors one or severals S-NODE hosts |
|
10
10
|
| **S-node** | [SSH server installation](s-node.md) | S-NODE hosts are monitorized by T-NODE host |
|
11
11
|
|
12
|
-
Read [modes of use](modes_of_use.md) to know more about differents T-NODE/S-NODE schemes.
|
12
|
+
> Read [modes of use](modes_of_use.md) to know more about differents T-NODE/S-NODE schemes.
|
13
13
|
|
14
14
|
## Tested OS list
|
15
15
|
|
data/docs/install/s-node.md
CHANGED
@@ -11,7 +11,7 @@ Install SSH server on every machine with S-NODE role.
|
|
11
11
|
Run this command as `root` user:
|
12
12
|
|
13
13
|
```bash
|
14
|
-
wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/install/linux/
|
14
|
+
wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/install/linux/s-node_install.sh | bash
|
15
15
|
```
|
16
16
|
|
17
17
|
**S-node Windows installation**
|
@@ -23,7 +23,7 @@ Requirements:
|
|
23
23
|
Run this command on **PowerShell (PS)** as `Administrator` user:
|
24
24
|
|
25
25
|
```powershell
|
26
|
-
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/master/install/windows/
|
26
|
+
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/master/install/windows/s-node_install.ps1'))
|
27
27
|
```
|
28
28
|
|
29
29
|
**S-node Mac OS X installation**
|
@@ -31,5 +31,5 @@ Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.We
|
|
31
31
|
Run this command as `root` user:
|
32
32
|
|
33
33
|
```bash
|
34
|
-
curl -sL https://raw.githubusercontent.com/teuton-software/teuton/master/install/mac/
|
34
|
+
curl -sL https://raw.githubusercontent.com/teuton-software/teuton/master/install/mac/s-node_install.sh | bash
|
35
35
|
```
|
data/docs/install/t-node.md
CHANGED
@@ -4,24 +4,19 @@
|
|
4
4
|
|
5
5
|
# 1. Recommended
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
Installation:
|
9
8
|
1. Install Ruby on your system.
|
10
9
|
2. `gem install teuton`
|
11
10
|
|
12
11
|
Run `teuton version` to check the installed version.
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
`gem
|
17
|
-
|
18
|
-
**Uninstall**
|
19
|
-
|
20
|
-
`gem uninstall teuton`.
|
13
|
+
> NOTE:
|
14
|
+
> * Update: `gem update teuton`.
|
15
|
+
> * Uninstall: `gem uninstall teuton`.
|
21
16
|
|
22
17
|
# 2. Problems
|
23
18
|
|
24
|
-
|
19
|
+
Sometimes we don't find `teuton` command (OpenSUSE distro, for example), so try this:
|
25
20
|
|
26
21
|
Option A:
|
27
22
|
* `ruby -v`, display your current ruby version. Suppose it is "2.5".
|
@@ -40,7 +35,7 @@ If you don't know how to install Ruby on your system, execute this script to run
|
|
40
35
|
Run this command as `root` user:
|
41
36
|
|
42
37
|
```bash
|
43
|
-
wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/install/linux/
|
38
|
+
wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/install/linux/t-node_install.sh | bash
|
44
39
|
```
|
45
40
|
|
46
41
|
**T-node Windows installation**
|
@@ -52,7 +47,7 @@ Requirements:
|
|
52
47
|
Run this command on **PowerShell (PS)** as `Administrator` user:
|
53
48
|
|
54
49
|
```powershell
|
55
|
-
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/master/install/windows/
|
50
|
+
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/master/install/windows/t-node_install.ps1'))
|
56
51
|
```
|
57
52
|
|
58
53
|
**T-node Mac OS X installation**
|
@@ -60,7 +55,7 @@ Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.We
|
|
60
55
|
Run this command as admin user (member of `admin` group):
|
61
56
|
|
62
57
|
```bash
|
63
|
-
curl -sL https://raw.githubusercontent.com/teuton-software/teuton/master/install/mac/
|
58
|
+
curl -sL https://raw.githubusercontent.com/teuton-software/teuton/master/install/mac/t-node_install.sh | bash
|
64
59
|
```
|
65
60
|
|
66
61
|
# 4. Vagrant/Docker
|
data/docs/learn/02-target.md
CHANGED
@@ -8,7 +8,7 @@ A [target](../dsl/target.md) is a feature you want to check. Targets are defined
|
|
8
8
|
|
9
9
|
* [target](dsl/target.md): Description of the element to be tested.
|
10
10
|
* [run](../dsl/run.md): Execute a command `id obiwan` on localhost.
|
11
|
-
* [expect](
|
11
|
+
* [expect](../dsl/expect.md): Verify that the result contains expected value.
|
12
12
|
|
13
13
|
```ruby
|
14
14
|
group "Learn about targets" do
|
@@ -28,17 +28,17 @@ end
|
|
28
28
|
When the user exists, we expect this words: `uid=, (obiwan), gid=`.
|
29
29
|
|
30
30
|
```
|
31
|
-
|
31
|
+
> id obiwan
|
32
32
|
uid=1000(obiwan) gid=1000(obiwan) grupos=1000(obiwan)
|
33
33
|
```
|
34
34
|
|
35
35
|
But when user does not exist, we expect different words: `id:, vader, no exist`.
|
36
36
|
|
37
37
|
```
|
38
|
-
|
38
|
+
> id vader
|
39
39
|
id: «vader»: no such user
|
40
40
|
|
41
|
-
|
41
|
+
> echo $?
|
42
42
|
1
|
43
43
|
|
44
44
|
```
|
@@ -23,6 +23,8 @@ module DSL
|
|
23
23
|
@action_counter += 1
|
24
24
|
@action[:id] = @action_counter
|
25
25
|
if @result.exitcode < 0
|
26
|
+
# When exitcode is less than zero, it is because there has been
|
27
|
+
# an error in the remote connection (SSH or Telnet)
|
26
28
|
@action[:check] = false
|
27
29
|
@action[:result] = @action[:output]
|
28
30
|
else
|
@@ -38,8 +38,12 @@ class ExecuteBase
|
|
38
38
|
def encode_and_split(encoding, text)
|
39
39
|
# Convert text to UTF-8 deleting unknown chars
|
40
40
|
text ||= "" # Ensure text is not nil
|
41
|
-
|
42
|
-
|
41
|
+
|
42
|
+
# TODO: text.gsub!('\r', '')
|
43
|
+
if [:default, "UTF-8"].include? encoding
|
44
|
+
text.encode!("UTF-8", invalid: :replace, :undef => :replace, :replace => '')
|
45
|
+
return text.split("\n")
|
46
|
+
end
|
43
47
|
|
44
48
|
# Convert text from input ENCODING to UTF-8
|
45
49
|
ec = Encoding::Converter.new(encoding.to_s, "UTF-8")
|
@@ -47,9 +51,9 @@ class ExecuteBase
|
|
47
51
|
text = ec.convert(text)
|
48
52
|
rescue => e
|
49
53
|
puts "[ERROR] #{e}: Declare text encoding..."
|
50
|
-
puts " run 'command', on: :host, :
|
54
|
+
puts " run 'command', on: :host, encoding: 'ISO-8859-1'"
|
51
55
|
end
|
52
56
|
|
53
|
-
text.split("\n")
|
57
|
+
text.split("\n").compact
|
54
58
|
end
|
55
59
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "net/telnet"
|
2
|
-
require "rainbow"
|
2
|
+
# require "rainbow"
|
3
3
|
require_relative "../../utils/project"
|
4
|
-
require_relative "../../utils/verbose"
|
4
|
+
# require_relative "../../utils/verbose"
|
5
5
|
require_relative "execute_base"
|
6
6
|
|
7
7
|
class ExecuteTelnet < ExecuteBase
|
@@ -9,48 +9,55 @@ class ExecuteTelnet < ExecuteBase
|
|
9
9
|
action[:conn_type] = :telnet
|
10
10
|
hostname = input_hostname.to_s
|
11
11
|
ip = config.get((hostname + "_ip").to_sym)
|
12
|
-
|
13
|
-
|
12
|
+
port = config.get((hostname + "_port").to_sym)
|
13
|
+
mode = true
|
14
|
+
if port.to_i == 0
|
15
|
+
port = "23"
|
16
|
+
mode = false
|
17
|
+
end
|
14
18
|
text = ""
|
19
|
+
exitcode = -1
|
15
20
|
begin
|
16
21
|
if sessions[hostname].nil? || sessions[hostname] == :ok
|
17
22
|
h = Net::Telnet.new(
|
18
23
|
"Host" => ip,
|
24
|
+
"Port" => port,
|
25
|
+
"Telnetmode" => mode,
|
19
26
|
"Timeout" => 30,
|
20
|
-
"Prompt" => /login|teuton|[$%#>]
|
27
|
+
"Prompt" => /login|teuton|[$%#>]/
|
21
28
|
)
|
22
29
|
# "Prompt" => Regexp.new(username[1, 40]))
|
23
30
|
# "Prompt" => /[$%#>] \z/n)
|
24
|
-
|
31
|
+
unless mode
|
32
|
+
username = config.get((hostname + "_username").to_sym).to_s
|
33
|
+
password = config.get((hostname + "_password").to_sym).to_s
|
34
|
+
h.login(username, password)
|
35
|
+
end
|
25
36
|
h.cmd(action[:command]) { |i| text << i }
|
26
37
|
h.close
|
27
38
|
sessions[hostname] = :ok
|
39
|
+
exitcode = 0
|
28
40
|
else
|
29
|
-
text = "
|
41
|
+
text = "Telnet: NO CONNECTION!"
|
30
42
|
end
|
31
43
|
rescue Net::OpenTimeout
|
32
44
|
sessions[hostname] = :nosession
|
33
45
|
conn_status[hostname] = :open_timeout
|
34
|
-
# verbose Rainbow(Application.instance.letter[:error]).red.bright
|
35
46
|
log(" ExceptionType=<Net::OpenTimeout> doing <telnet #{ip}>", :error)
|
36
47
|
log(" └── Revise host IP!", :warn)
|
37
48
|
rescue Net::ReadTimeout
|
38
49
|
sessions[hostname] = :nosession
|
39
50
|
conn_status[hostname] = :read_timeout
|
40
|
-
# verbose Rainbow(Application.instance.letter[:error]).red.bright
|
41
51
|
log(" ExceptionType=<Net::ReadTimeout> doing <telnet #{ip}>", :error)
|
42
52
|
rescue => e
|
43
53
|
sessions[hostname] = :nosession
|
44
54
|
conn_status[hostname] = :error
|
45
|
-
# verbose Rainbow(Application.instance.letter[:error]).red.bright
|
46
55
|
log(" ExceptionType=<#{e.class}> doing telnet on <#{username}@#{ip}>" \
|
47
56
|
" exec: #{action[:command]}", :error)
|
48
57
|
log(" └── username=<#{username}>, password=<#{password}>," \
|
49
58
|
" ip=<#{ip}>, HOSTID=<#{hostname}>", :warn)
|
50
59
|
end
|
51
|
-
|
52
|
-
result.
|
53
|
-
result.content = output
|
54
|
-
result.content.compact!
|
60
|
+
result.exitcode = exitcode
|
61
|
+
result.content = encode_and_split(action[:encoding], text)
|
55
62
|
end
|
56
63
|
end
|
data/lib/teuton/readme/readme.rb
CHANGED
@@ -71,8 +71,8 @@ class Readme
|
|
71
71
|
unless @required_hosts.empty?
|
72
72
|
puts Lang.get(:hosts)
|
73
73
|
puts "\n"
|
74
|
-
puts "| ID
|
75
|
-
puts "| --- |
|
74
|
+
puts "| ID | Host | Configuration |"
|
75
|
+
puts "| --- | ---- | ------------- |"
|
76
76
|
@required_hosts.each_pair do |k, v|
|
77
77
|
c = []
|
78
78
|
v.each_pair { |k2, v2| c << "#{k2}=#{v2}" }
|
@@ -123,15 +123,15 @@ class Readme
|
|
123
123
|
puts Lang.get(:global_params)
|
124
124
|
puts "\n"
|
125
125
|
puts "| Param | Value |"
|
126
|
-
puts "|
|
126
|
+
puts "| ----- | ----- |"
|
127
127
|
@global_params.each_pair { |k, v| puts "|#{k}|#{v}|" }
|
128
128
|
end
|
129
129
|
if @setted_params.size.positive?
|
130
130
|
puts Lang.get(:created_params)
|
131
131
|
puts "\n"
|
132
|
-
puts "| Param |
|
133
|
-
puts "|
|
134
|
-
@setted_params.each_pair { |k, v| puts "|#{k}
|
132
|
+
puts "| Param |"
|
133
|
+
puts "| ----- |"
|
134
|
+
@setted_params.each_pair { |k, v| puts "|#{k}|" }
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
data/lib/teuton/version.rb
CHANGED
data/lib/teuton.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teuton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Vargas Ruiz
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-10 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rainbow
|