teuton 2.9.4 → 2.9.5
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/README.md +9 -5
- data/docs/es/README.md +72 -0
- data/docs/es/aprender/01-cmd_new.md +27 -0
- data/docs/es/aprender/02-target.md +131 -0
- data/docs/es/aprender/README.md +36 -0
- data/docs/learn/02-target.md +3 -2
- data/lib/teuton/case/config.rb +1 -1
- data/lib/teuton/case/dsl/expect.rb +1 -1
- data/lib/teuton/case/dsl/expect_sequence.rb +2 -2
- data/lib/teuton/case/dsl/run_script.rb +1 -1
- data/lib/teuton/case/dsl/unique.rb +1 -1
- data/lib/teuton/case/execute/execute_base.rb +2 -2
- data/lib/teuton/case/execute/execute_manager.rb +2 -2
- data/lib/teuton/case/execute/execute_ssh.rb +10 -10
- data/lib/teuton/case/execute/execute_telnet.rb +1 -1
- data/lib/teuton/case/host.rb +6 -6
- data/lib/teuton/check/dsl/all.rb +1 -1
- data/lib/teuton/check/show.rb +4 -4
- data/lib/teuton/deprecated/runner.rb +12 -12
- data/lib/teuton/readme/dsl/getset.rb +3 -3
- data/lib/teuton/readme/dsl/run.rb +3 -3
- data/lib/teuton/report/formatter/default/array.rb +1 -1
- data/lib/teuton/report/formatter/default/html.rb +1 -1
- data/lib/teuton/report/formatter/default/json.rb +3 -2
- data/lib/teuton/report/formatter/default/xml.rb +1 -1
- data/lib/teuton/report/formatter/default/yaml.rb +1 -1
- data/lib/teuton/report/formatter/moodle_csv_formatter.rb +1 -1
- data/lib/teuton/report/formatter/resume/array.rb +1 -1
- data/lib/teuton/report/formatter/resume/html.rb +1 -1
- data/lib/teuton/report/formatter/resume/json.rb +3 -2
- data/lib/teuton/report/formatter/resume/yaml.rb +1 -1
- data/lib/teuton/report/report.rb +2 -2
- data/lib/teuton/utils/configfile_reader.rb +2 -1
- data/lib/teuton/version.rb +1 -1
- metadata +14 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ce9e5fc4e8a37ff624e2c8dc16440236aed569cf1c6b77a49e9efbb6f2b1894
|
4
|
+
data.tar.gz: e2959aef5f909f245c27bf18868ffb7cfd0e7dee376da8f9620b1306f0d8b383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60567daad6f01a946b227f5eba0c63813bcb9e2d1f466e3d0fbf5407e7e3d1efa120036df6cc29f4e63f627b0e638d3334f34f0182558fb20d66d35bedf113de
|
7
|
+
data.tar.gz: ed5569263c61fa81b42c4764793fe4e917d4395c115b2f95c4456813c62b5e0d86e02a68e79354babc9e2bc471678d6566c032e475bd1944563817163b65ee54
|
data/README.md
CHANGED
@@ -8,10 +8,10 @@ _Create Unit Test for your machines. Test your infrastructure as code._
|
|
8
8
|
|
9
9
|

|
10
10
|
|
11
|
-
|
11
|
+
The infrastructure test is useful for:
|
12
12
|
* Sysadmin teachers who want to evaluate students remote machines.
|
13
|
-
*
|
14
|
-
*
|
13
|
+
* Students who want to evaluate their learning process.
|
14
|
+
* Professionals who want to monitor their remote machines.
|
15
15
|
|
16
16
|
# Installation
|
17
17
|
|
@@ -28,7 +28,7 @@ gem install teuton
|
|
28
28
|
Executing `teuton` command to run example test:
|
29
29
|
|
30
30
|
```console
|
31
|
-
|
31
|
+
> teuton run examples/01-target
|
32
32
|
|
33
33
|
CASE RESULTS
|
34
34
|
+------+-----------+-------+-------+
|
@@ -37,6 +37,8 @@ CASE RESULTS
|
|
37
37
|
+------+-----------+-------+-------+
|
38
38
|
```
|
39
39
|
|
40
|
+
> More information about [commands](docs/commands/README.md)
|
41
|
+
|
40
42
|
# Features
|
41
43
|
|
42
44
|
* Simple DSL to define your tests: `target`, `run`,`expect` and more.
|
@@ -67,4 +69,6 @@ CASE RESULTS
|
|
67
69
|
1. Push to the branch (`git push origin my-new-feature`)
|
68
70
|
1. Create new Pull Request.
|
69
71
|
|
70
|
-
You can also [create issues](https://github.com/teuton-software/teuton/issues) with your requests
|
72
|
+
You can also [create issues](https://github.com/teuton-software/teuton/issues) with your requests, incidences or suggestions.
|
73
|
+
|
74
|
+
> Read [Spanish documentation](docs/es/README.md)
|
data/docs/es/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
|
2
|
+
# TEUTON (ES) - (Documentación en progreso)
|
3
|
+
|
4
|
+
[](https://badge.fury.io/rb/teuton)
|
5
|
+

|
6
|
+
|
7
|
+
_Crear test unitarios para tus máquinas y probar tu infraestructura como si fuera código._
|
8
|
+
|
9
|
+

|
10
|
+
|
11
|
+
El test de infraestructura es útil para:
|
12
|
+
* Profesores de administración de sistemas que quieren evaluar a las máquinas remotas de los alumnos.
|
13
|
+
* Alumnos que quieren evaluar su proceso de aprendizaje.
|
14
|
+
* Profesionales que desean monitorizar sus máquinas remotas.
|
15
|
+
|
16
|
+
# Instalación
|
17
|
+
|
18
|
+
Primero es necesario tener instalado `Ruby`y a continuación instalamos Teuton con el siguiente comando:
|
19
|
+
|
20
|
+
```console
|
21
|
+
gem install teuton
|
22
|
+
```
|
23
|
+
|
24
|
+
> Para instalar Teuton sin privilegios de root: `gem install --user-install teuton`
|
25
|
+
|
26
|
+
# Modo de uso
|
27
|
+
|
28
|
+
Usaremos el comando `teuton` para ejecutar los tests:
|
29
|
+
|
30
|
+
```console
|
31
|
+
> teuton run examples/01-target
|
32
|
+
|
33
|
+
CASE RESULTS
|
34
|
+
+------+-----------+-------+-------+
|
35
|
+
| CASE | MEMBERS | GRADE | STATE |
|
36
|
+
| 01 | anonymous | 100.0 | ✔ |
|
37
|
+
+------+-----------+-------+-------+
|
38
|
+
```
|
39
|
+
|
40
|
+
> Más información sobre los [comandos](../commands/README.md)
|
41
|
+
|
42
|
+
# Características
|
43
|
+
|
44
|
+
* DSL sencillo para definir los tests: `target`, `run`,`expect`, etc.
|
45
|
+
* Se usa conexiones SSH o Telnet para acceder a los dispositivos remotos.
|
46
|
+
* Formatos de salida: `txt`, `html`, `json`, `yaml`, etc.
|
47
|
+
* Multiplatforma.
|
48
|
+
* [Licencia de Software Libre](LICENSE).
|
49
|
+
|
50
|
+
# Documentación
|
51
|
+
|
52
|
+
* [Instalación](../install/README.md)
|
53
|
+
* [Aprender](../learn/README.md)
|
54
|
+
* [Ejemplos](../../examples)
|
55
|
+
* [Comandos](../commands/README.md)
|
56
|
+
* [DSL](../dsl/README.md)
|
57
|
+
* [Blogs y videos](../videos.md)
|
58
|
+
|
59
|
+
# Contacto
|
60
|
+
|
61
|
+
* **Email**: `teuton.software@protonmail.com`
|
62
|
+
|
63
|
+
# Contribuciones
|
64
|
+
|
65
|
+
1. Asegúrate de tener `Ruby`instalado.
|
66
|
+
1. Haz un "fork" del proyecto.
|
67
|
+
1. Crear tu rama "feature" (`git checkout -b my-new-feature`)
|
68
|
+
1. Haz "commit" de tus cambios (`git commit -am 'Add some feature'`)
|
69
|
+
1. Haz "push" a la rama (`git push origin my-new-feature`)
|
70
|
+
1. Crear un "pull request" nuevo.
|
71
|
+
|
72
|
+
También se pueden [crear issues](https://github.com/teuton-software/teuton/issues) con peticiones, incidencias o sugerencias.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
[<< back](README.md)
|
3
|
+
|
4
|
+
# Nuevo test
|
5
|
+
|
6
|
+
Crear el esquelero para un nuevo proyecto: `teuton create foo`
|
7
|
+
|
8
|
+
```
|
9
|
+
> teuton new foo
|
10
|
+
|
11
|
+
[INFO] Creating foo project skeleton
|
12
|
+
* Create dir => foo
|
13
|
+
* Create file => foo/config.yaml
|
14
|
+
* Create file => foo/start.rb
|
15
|
+
```
|
16
|
+
|
17
|
+
> NOTA: Lo ficheros se pueden crear manualmente.
|
18
|
+
|
19
|
+
Este comando crea los siguientes ficheros:
|
20
|
+
|
21
|
+
| Fichero/Directorio | Descripción |
|
22
|
+
| ------------------ | ---------------- |
|
23
|
+
| foo | Direcotrio base |
|
24
|
+
| foo/start.rb | Script principal |
|
25
|
+
| foo/config.yaml | Fichero de configuración |
|
26
|
+
|
27
|
+
Ahora es el momento de personalizar nuestros objetivos (targets).
|
@@ -0,0 +1,131 @@
|
|
1
|
+
[<< back](README.md)
|
2
|
+
|
3
|
+
# target
|
4
|
+
|
5
|
+
Un [target](../../dsl/target.md) es el objetivo que queremos evaluar. Los objetivos se definen dentro de una sección `group`.
|
6
|
+
|
7
|
+
## Target definition
|
8
|
+
|
9
|
+
Cada proceso de evaluación consta de 3 partes:
|
10
|
+
|
11
|
+
* [target](../../dsl/target.md): Descripción del elemento que va a ser evaluado.
|
12
|
+
* [run](../../dsl/run.md): Ejecutar el comando `id obiwan` en la máquina local.
|
13
|
+
* [expect](../../dsl/expect.md): Verificar que el resultado del comando devuelve el valor esperado.
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
group "Aprender sobre los targets" do
|
17
|
+
|
18
|
+
target "Existe el usuario <obiwan>"
|
19
|
+
run "id obiwan"
|
20
|
+
expect ["uid=", "(obiwan)", "gid="]
|
21
|
+
|
22
|
+
target "No existe el usuario <vader>"
|
23
|
+
run "id vader"
|
24
|
+
expect_fail
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
> En este ejemplo estamo usando un SO GNU/Linux en la máquina local porque queremos ejecutar el comando `id obiwan`.
|
29
|
+
|
30
|
+
Cuando el usuario existe, esperamos encontrar estas palabras en la salida del comando: `uid=, (obiwan), gid=`.
|
31
|
+
|
32
|
+
```
|
33
|
+
> id obiwan
|
34
|
+
uid=1000(obiwan) gid=1000(obiwan) grupos=1000(obiwan)
|
35
|
+
```
|
36
|
+
|
37
|
+
Pero cuando el usuario no existe, se esperan una salida de error.
|
38
|
+
|
39
|
+
```
|
40
|
+
> id vader
|
41
|
+
id: «vader»: no such user
|
42
|
+
|
43
|
+
> echo $?
|
44
|
+
1
|
45
|
+
|
46
|
+
```
|
47
|
+
|
48
|
+
## Section de ejecución
|
49
|
+
|
50
|
+
Cuando se ejecuta el test, se procesa la sección `play`, la cual contiene las siguientes instrucciones:
|
51
|
+
|
52
|
+
* [show](../../dsl/show.md): mostrar por pantalla información del proceso.
|
53
|
+
* [export](../../dsl/export.md): generar informes de salida.
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
play do
|
57
|
+
show
|
58
|
+
export
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
## Ejemplo
|
63
|
+
|
64
|
+
Usa este comando para ejecutar el test:
|
65
|
+
|
66
|
+
```console
|
67
|
+
> teuton run examples/02-target
|
68
|
+
|
69
|
+
CASE RESULTS
|
70
|
+
+------+-----------+-------+-------+
|
71
|
+
| CASE | MEMBERS | GRADE | STATE |
|
72
|
+
| 01 | anonymous | 100.0 | ✔ |
|
73
|
+
+------+-----------+-------+-------+
|
74
|
+
```
|
75
|
+
|
76
|
+
Los informes de salida se crean en la carpeta `var/02-target/`:
|
77
|
+
|
78
|
+
```console
|
79
|
+
var
|
80
|
+
└── 02-target
|
81
|
+
├── case-01.txt
|
82
|
+
├── moodle.csv
|
83
|
+
└── resume.txt
|
84
|
+
```
|
85
|
+
|
86
|
+
Veamos el contenido:
|
87
|
+
|
88
|
+
```
|
89
|
+
> cat var/02-target/case-01.txt
|
90
|
+
|
91
|
+
CONFIGURATION
|
92
|
+
+-------------+-----------+
|
93
|
+
| tt_members | anonymous |
|
94
|
+
| tt_sequence | false |
|
95
|
+
| tt_skip | false |
|
96
|
+
| tt_testname | 02-target |
|
97
|
+
+-------------+-----------+
|
98
|
+
|
99
|
+
GROUPS
|
100
|
+
- Learn about targets
|
101
|
+
01 (0.0/1.0)
|
102
|
+
Description : Create user obiwan
|
103
|
+
Command : id obiwan
|
104
|
+
Output : id: «obiwan»: no existe ese usuario
|
105
|
+
Duration : 0.002 (local)
|
106
|
+
Alterations : find(uid=) & find((obiwan)) & find(gid=) & count
|
107
|
+
Expected : Greater than 0
|
108
|
+
Result : 0
|
109
|
+
02 (1.0/1.0)
|
110
|
+
Description : Delete user vader
|
111
|
+
Command : id vader
|
112
|
+
Output : id: «vader»: no existe ese usuario
|
113
|
+
Duration : 0.002 (local)
|
114
|
+
Alterations : Read exit code
|
115
|
+
Expected : Greater than 0
|
116
|
+
Result : 1
|
117
|
+
|
118
|
+
RESULTS
|
119
|
+
+--------------+---------------------------+
|
120
|
+
| case_id | 01 |
|
121
|
+
| start_time | 2023-06-16 08:42:13 +0100 |
|
122
|
+
| finish_time | 2023-06-16 08:42:13 +0100 |
|
123
|
+
| duration | 0.004527443 |
|
124
|
+
| unique_fault | 0 |
|
125
|
+
| max_weight | 2.0 |
|
126
|
+
| good_weight | 1.0 |
|
127
|
+
| fail_weight | 1.0 |
|
128
|
+
| fail_counter | 1 |
|
129
|
+
| grade | 50 |
|
130
|
+
+--------------+---------------------------+
|
131
|
+
```
|
@@ -0,0 +1,36 @@
|
|
1
|
+
[<< back](../README.md)
|
2
|
+
|
3
|
+
# Aprender
|
4
|
+
|
5
|
+
Aprender a escribir tus propios test:
|
6
|
+
|
7
|
+
1. [Crear un NUEVO test](01-cmd_new.md)
|
8
|
+
1. [Evaluating TARGET](02-target.md)
|
9
|
+
1. [Checking REMOTE HOSTS](03-remote_hosts.md)
|
10
|
+
1. [Reading CONFIG file](04-config.md)
|
11
|
+
1. [Using several files](05-use.md)
|
12
|
+
1. [CHECK test syntax](06-cmd_check.md)
|
13
|
+
1. [Target WEIGHT](07-target_weight.md)
|
14
|
+
1. [UNIQUE values](08-unique_values.md)
|
15
|
+
1. [SEND report copies to remote hosts](09-send.md)
|
16
|
+
1. [DEBUG results](10-debug.md)
|
17
|
+
1. [Export other FORMATS](11-export.md)
|
18
|
+
1. [PRESERVE old reports](12-preserve.md)
|
19
|
+
1. [Hide FEEDBACK from reports](13-feedback.md)
|
20
|
+
1. [MOODLE](14-moodle_id.md)
|
21
|
+
1. [Build README from test](15-readme.md)
|
22
|
+
1. [INCLUDE more configuration files](16-include.md)
|
23
|
+
1. [ALIAS](17-alias.md)
|
24
|
+
1. [LOG messages](18-log.md)
|
25
|
+
1. [Don't get params, just read vars](19-read_vars.md)
|
26
|
+
1. [MACROS](20-macros.md)
|
27
|
+
1. [Checking exit codes](21-exit_codes.md)
|
28
|
+
1. [RESULT object](22-result.md)
|
29
|
+
1. [Test code](23-test-code.md)
|
30
|
+
1. [Test SQL and database](24-test-sql.md)
|
31
|
+
1. [expect vs result](25-expect-result.md) TODO
|
32
|
+
1. [EXPECT_SEQUENCE](26-expect_sequence.md)
|
33
|
+
1. [RUN_SCRIPT](27-run_script.md)
|
34
|
+
1. [UPLOAD](28-upload.md)
|
35
|
+
|
36
|
+
Mores examples at [teuton-tests](https://github.com/dvarrui/teuton-tests) GitHub repository.
|
data/docs/learn/02-target.md
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
# target
|
4
4
|
|
5
|
-
A [target](../dsl/target.md) is a feature you want to check. Targets are defined into `group` sections
|
5
|
+
A [target](../dsl/target.md) is a feature you want to check. Targets are defined into `group` sections.
|
6
6
|
|
7
7
|
## Target definition
|
8
8
|
|
9
|
+
Every evaluation has 3 parts:
|
9
10
|
* [target](dsl/target.md): Description of the element to be tested.
|
10
11
|
* [run](../dsl/run.md): Execute a command `id obiwan` on localhost.
|
11
12
|
* [expect](../dsl/expect.md): Verify that the result contains expected value.
|
@@ -32,7 +33,7 @@ When the user exists, we expect this words: `uid=, (obiwan), gid=`.
|
|
32
33
|
uid=1000(obiwan) gid=1000(obiwan) grupos=1000(obiwan)
|
33
34
|
```
|
34
35
|
|
35
|
-
But when user does not exist, we expect
|
36
|
+
But when user does not exist, we expect command fail.
|
36
37
|
|
37
38
|
```
|
38
39
|
> id vader
|
data/lib/teuton/case/config.rb
CHANGED
@@ -23,7 +23,7 @@ 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
|
26
|
+
# When exitcode is less than zero, it is because there has been
|
27
27
|
# an error in the remote connection (SSH or Telnet)
|
28
28
|
@action[:check] = false
|
29
29
|
@action[:result] = @action[:output]
|
@@ -38,8 +38,8 @@ class ExpectSequence
|
|
38
38
|
|
39
39
|
def find_best_state
|
40
40
|
@states.each do |state|
|
41
|
-
state[:score] = (state[:steps].select {
|
42
|
-
state[:fails] = (state[:steps].select { !
|
41
|
+
state[:score] = (state[:steps].select { it }).size
|
42
|
+
state[:fails] = (state[:steps].select { !it }).size
|
43
43
|
state[:ok] = (state[:fails] == 0)
|
44
44
|
end
|
45
45
|
best = @states[0]
|
@@ -5,7 +5,7 @@ module DSL
|
|
5
5
|
def run_script(script, args = {})
|
6
6
|
items = script.split(" ")
|
7
7
|
if items.size == 1
|
8
|
-
shell = args[:shell] || (get(:shell) != "NODATA" ? get(:shell) : nil)
|
8
|
+
shell = args[:shell] || ((get(:shell) != "NODATA") ? get(:shell) : nil)
|
9
9
|
script = "#{shell} #{script}" if shell
|
10
10
|
script = "#{script} #{args[:args]} " if args[:args]
|
11
11
|
end
|
@@ -41,8 +41,8 @@ class ExecuteBase
|
|
41
41
|
|
42
42
|
# TODO: text.gsub!('\r', '')
|
43
43
|
if [:default, "UTF-8"].include? encoding
|
44
|
-
text.encode!("UTF-8", invalid: :replace, :
|
45
|
-
return text.split("\n")
|
44
|
+
text.encode!("UTF-8", invalid: :replace, undef: :replace, replace: "")
|
45
|
+
return text.split("\n")
|
46
46
|
end
|
47
47
|
|
48
48
|
# Convert text from input ENCODING to UTF-8
|
@@ -31,8 +31,8 @@ class ExecuteManager
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def run_on(host)
|
34
|
-
protocol = config.get("#{host}_protocol"
|
35
|
-
ip = config.get("#{host}_ip"
|
34
|
+
protocol = config.get(:"#{host}_protocol")
|
35
|
+
ip = config.get(:"#{host}_ip")
|
36
36
|
|
37
37
|
if protocol.to_s.downcase == "local" || host.to_s == "localhost"
|
38
38
|
# Protocol force => local
|
@@ -9,24 +9,24 @@ class ExecuteSSH < ExecuteBase
|
|
9
9
|
def call(input_hostname)
|
10
10
|
action[:conn_type] = :ssh
|
11
11
|
hostname = input_hostname.to_s
|
12
|
-
ip = config.get("#{hostname}_ip"
|
13
|
-
username = config.get("#{hostname}_username"
|
14
|
-
password = config.get("#{hostname}_password"
|
15
|
-
port = config.get("#{hostname}_port"
|
12
|
+
ip = config.get(:"#{hostname}_ip").to_s
|
13
|
+
username = config.get(:"#{hostname}_username").to_s
|
14
|
+
password = config.get(:"#{hostname}_password").to_s
|
15
|
+
port = config.get(:"#{hostname}_port").to_i
|
16
16
|
port = 22 if port.zero?
|
17
17
|
|
18
|
-
unless config.get("#{hostname}_route"
|
18
|
+
unless config.get(:"#{hostname}_route") == "NODATA"
|
19
19
|
# Reconfigure command with gateway. Example host1_route: IP.
|
20
20
|
# hostname2 = hostname ¿not used?
|
21
21
|
ip2 = ip
|
22
22
|
username2 = username
|
23
23
|
password2 = password
|
24
24
|
command2 = action[:command]
|
25
|
-
hostname = config.get("#{hostname}_route"
|
26
|
-
ip = config.get("#{hostname}_ip"
|
27
|
-
username = config.get("#{hostname}_username"
|
28
|
-
password = config.get("#{hostname}_password"
|
29
|
-
ostype = config.get("#{hostname}_ostype"
|
25
|
+
hostname = config.get(:"#{hostname}_route")
|
26
|
+
ip = config.get(:"#{hostname}_ip").to_s
|
27
|
+
username = config.get(:"#{hostname}_username").to_s
|
28
|
+
password = config.get(:"#{hostname}_password").to_s
|
29
|
+
ostype = config.get(:"#{hostname}_ostype").to_s
|
30
30
|
|
31
31
|
action[:command] = if ostype.downcase.start_with? "win"
|
32
32
|
"echo y | plink #{username2}@#{ip2} -ssh -pw #{password2} \"#{command2}\""
|
data/lib/teuton/case/host.rb
CHANGED
@@ -34,11 +34,11 @@ class Case
|
|
34
34
|
|
35
35
|
def init(id)
|
36
36
|
@id = id.to_sym
|
37
|
-
@ip = @config.get("#{@id}_ip"
|
38
|
-
@username = @config.get("#{@id}_username"
|
39
|
-
@password = @config.get("#{@id}_password"
|
37
|
+
@ip = @config.get(:"#{@id}_ip").to_s
|
38
|
+
@username = @config.get(:"#{@id}_username").to_s
|
39
|
+
@password = @config.get(:"#{@id}_password").to_s
|
40
40
|
|
41
|
-
@protocol = @config.get("#{@id}_protocol"
|
41
|
+
@protocol = @config.get(:"#{@id}_protocol").to_s.downcase
|
42
42
|
if @protocol == "nodata"
|
43
43
|
@protocol = if @ip == "localhost" || @ip.start_with?("127.0.0.")
|
44
44
|
"local"
|
@@ -47,12 +47,12 @@ class Case
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
@port = @config.get("#{@id}_port"
|
50
|
+
@port = @config.get(:"#{@id}_port").to_i
|
51
51
|
if @port.zero?
|
52
52
|
default = {"local" => 0, "ssh" => 22, "telnet" => 23}
|
53
53
|
@port = default[@protocol]
|
54
54
|
end
|
55
|
-
@route = @config.get("#{@id}_route"
|
55
|
+
@route = @config.get(:"#{@id}_route")
|
56
56
|
end
|
57
57
|
|
58
58
|
def init_default
|
data/lib/teuton/check/dsl/all.rb
CHANGED
data/lib/teuton/check/show.rb
CHANGED
@@ -61,7 +61,7 @@ class ShowCheck
|
|
61
61
|
end
|
62
62
|
if Project.value[:macros].size.positive?
|
63
63
|
st.add_row ["Macros", Project.value[:macros].size]
|
64
|
-
Project.value[:macros].each_key { st.add_row ["",
|
64
|
+
Project.value[:macros].each_key { st.add_row ["", it] }
|
65
65
|
end
|
66
66
|
st.add_row ["Groups", @stats[:groups]]
|
67
67
|
st.add_row ["Targets", @stats[:targets]]
|
@@ -87,11 +87,11 @@ class ShowCheck
|
|
87
87
|
|
88
88
|
if @stats[:sets].size.positive?
|
89
89
|
st.add_row ["Sets", @stats[:sets].size]
|
90
|
-
@stats[:sets].each { st.add_row ["",
|
90
|
+
@stats[:sets].each { st.add_row ["", it] }
|
91
91
|
end
|
92
92
|
if @stats[:uploads].size.positive?
|
93
93
|
st.add_row ["Uploads", @stats[:uploads].size]
|
94
|
-
@stats[:uploads].each { st.add_row ["",
|
94
|
+
@stats[:uploads].each { st.add_row ["", it] }
|
95
95
|
end
|
96
96
|
end
|
97
97
|
Logger.info my_screen_table.to_s + "\n"
|
@@ -114,7 +114,7 @@ class ShowCheck
|
|
114
114
|
script_vars << k.to_s + "_password"
|
115
115
|
end
|
116
116
|
end
|
117
|
-
@stats[:gets].keys.each { script_vars <<
|
117
|
+
@stats[:gets].keys.each { script_vars << it }
|
118
118
|
script_vars
|
119
119
|
end
|
120
120
|
end
|
@@ -9,8 +9,8 @@ class Case
|
|
9
9
|
# READ: @config
|
10
10
|
# WRITE: @action, @result, @session
|
11
11
|
def run_cmd_on(host)
|
12
|
-
protocol = @config.get("#{host}_protocol"
|
13
|
-
ip = @config.get("#{host}_ip"
|
12
|
+
protocol = @config.get(:"#{host}_protocol")
|
13
|
+
ip = @config.get(:"#{host}_ip")
|
14
14
|
|
15
15
|
if protocol.to_s.downcase == "local" || host.to_s == "localhost"
|
16
16
|
# Protocol force => local
|
@@ -59,24 +59,24 @@ class Case
|
|
59
59
|
def run_cmd_remote_ssh(input_hostname)
|
60
60
|
@action[:conn_type] = :ssh
|
61
61
|
hostname = input_hostname.to_s
|
62
|
-
ip = @config.get("#{hostname}_ip"
|
63
|
-
username = @config.get("#{hostname}_username"
|
64
|
-
password = @config.get("#{hostname}_password"
|
65
|
-
port = @config.get("#{hostname}_port"
|
62
|
+
ip = @config.get(:"#{hostname}_ip").to_s
|
63
|
+
username = @config.get(:"#{hostname}_username").to_s
|
64
|
+
password = @config.get(:"#{hostname}_password").to_s
|
65
|
+
port = @config.get(:"#{hostname}_port").to_i
|
66
66
|
port = 22 if port.zero?
|
67
67
|
|
68
|
-
unless @config.get("#{hostname}_route"
|
68
|
+
unless @config.get(:"#{hostname}_route") == "NODATA"
|
69
69
|
# Reconfigure command with gateway. Example host1_route: IP.
|
70
70
|
# hostname2 = hostname ¿not used?
|
71
71
|
ip2 = ip
|
72
72
|
username2 = username
|
73
73
|
password2 = password
|
74
74
|
command2 = @action[:command]
|
75
|
-
hostname = @config.get("#{hostname}_route"
|
76
|
-
ip = @config.get("#{hostname}_ip"
|
77
|
-
username = @config.get("#{hostname}_username"
|
78
|
-
password = @config.get("#{hostname}_password"
|
79
|
-
ostype = @config.get("#{hostname}_ostype"
|
75
|
+
hostname = @config.get(:"#{hostname}_route")
|
76
|
+
ip = @config.get(:"#{hostname}_ip").to_s
|
77
|
+
username = @config.get(:"#{hostname}_username").to_s
|
78
|
+
password = @config.get(:"#{hostname}_password").to_s
|
79
|
+
ostype = @config.get(:"#{hostname}_ostype").to_s
|
80
80
|
|
81
81
|
@action[:command] = if ostype.downcase.start_with? "win"
|
82
82
|
"echo y | plink #{username2}@#{ip2} -ssh -pw #{password2} \"#{command2}\""
|
@@ -14,11 +14,11 @@ module ReadmeDSL
|
|
14
14
|
def gett(value)
|
15
15
|
a = get(value)
|
16
16
|
if @cases_params.include? value
|
17
|
-
"[
|
17
|
+
"[" + value + "](#required-params)"
|
18
18
|
elsif @setted_params[value]
|
19
|
-
"[
|
19
|
+
"[" + value + "](#created-params)"
|
20
20
|
elsif @global_params.include? value
|
21
|
-
"[
|
21
|
+
"[" + a + "](#global-params)"
|
22
22
|
end
|
23
23
|
a
|
24
24
|
end
|
@@ -2,21 +2,21 @@ module ReadmeDSL
|
|
2
2
|
def goto(host = :localhost, args = {})
|
3
3
|
unless host == :localhost
|
4
4
|
b = {}
|
5
|
-
a = "#{host}_ip"
|
5
|
+
a = :"#{host}_ip"
|
6
6
|
if @config[:global][a].nil? && !@setted_params.include?(a)
|
7
7
|
@cases_params << a
|
8
8
|
end
|
9
9
|
b[:ip] = @config[:global][a] if @config[:global][a]
|
10
10
|
b[:ip] = @setted_params[a] if @setted_params[a]
|
11
11
|
|
12
|
-
a = "#{host}_username"
|
12
|
+
a = :"#{host}_username"
|
13
13
|
if @config[:global][a].nil? && !@setted_params.include?(a)
|
14
14
|
@cases_params << a
|
15
15
|
end
|
16
16
|
b[:username] = @config[:global][a] if @config[:global][a]
|
17
17
|
b[:username] = @setted_params[a] if @setted_params[a]
|
18
18
|
|
19
|
-
a = "#{host}_password"
|
19
|
+
a = :"#{host}_password"
|
20
20
|
if @config[:global][a].nil? && !@setted_params.include?(a)
|
21
21
|
@cases_params << a
|
22
22
|
end
|
data/lib/teuton/report/report.rb
CHANGED
@@ -28,7 +28,7 @@ class Report
|
|
28
28
|
report = Report.new
|
29
29
|
attrs = %i[id filename output_dir head lines tail format]
|
30
30
|
attrs.each do |attr|
|
31
|
-
attr_set = "#{attr}="
|
31
|
+
attr_set = :"#{attr}="
|
32
32
|
report.send(attr_set, send(attr).clone)
|
33
33
|
end
|
34
34
|
|
@@ -42,7 +42,7 @@ class Report
|
|
42
42
|
|
43
43
|
def export_resume(options)
|
44
44
|
format = options[:format]
|
45
|
-
@format = "resume_#{format}"
|
45
|
+
@format = :"resume_#{format}"
|
46
46
|
options[:format] = @format
|
47
47
|
filepath = File.join(@output_dir, @filename)
|
48
48
|
Formatter.call(self, options, filepath)
|
data/lib/teuton/version.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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Vargas Ruiz
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-05-14 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rainbow
|
@@ -43,14 +43,14 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '7.
|
46
|
+
version: '7.3'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '7.
|
53
|
+
version: '7.3'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: net-telnet
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,14 +99,14 @@ dependencies:
|
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '4.0'
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '4.0'
|
110
110
|
description: |2
|
111
111
|
Intrastructure test, useful for:
|
112
112
|
(1) Sysadmin teachers to evaluate students remote machines.
|
@@ -142,6 +142,10 @@ extra_rdoc_files:
|
|
142
142
|
- docs/dsl/set.md
|
143
143
|
- docs/dsl/show.md
|
144
144
|
- docs/dsl/target.md
|
145
|
+
- docs/es/README.md
|
146
|
+
- docs/es/aprender/01-cmd_new.md
|
147
|
+
- docs/es/aprender/02-target.md
|
148
|
+
- docs/es/aprender/README.md
|
145
149
|
- docs/es/exit_code.md
|
146
150
|
- docs/es/guess_os.md
|
147
151
|
- docs/ideas/Challenge-Server-Project.md
|
@@ -207,6 +211,10 @@ files:
|
|
207
211
|
- docs/dsl/set.md
|
208
212
|
- docs/dsl/show.md
|
209
213
|
- docs/dsl/target.md
|
214
|
+
- docs/es/README.md
|
215
|
+
- docs/es/aprender/01-cmd_new.md
|
216
|
+
- docs/es/aprender/02-target.md
|
217
|
+
- docs/es/aprender/README.md
|
210
218
|
- docs/es/exit_code.md
|
211
219
|
- docs/es/guess_os.md
|
212
220
|
- docs/ideas/Challenge-Server-Project.md
|