teuton 2.7.3 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/docs/changelog/changelog.1.md +119 -0
- data/docs/changelog/changelog.2.md +105 -0
- data/docs/diagram.md +10 -10
- data/docs/dsl/expect.md +76 -23
- data/docs/dsl/export.md +6 -3
- data/docs/dsl/result.md +24 -30
- data/docs/dsl/send.md +34 -23
- data/docs/learn/02-target.md +32 -27
- data/docs/learn/13-feedback.md +8 -9
- data/docs/learn/25-expect-result.md +39 -0
- data/docs/learn/26-expect_sequence.md +79 -0
- data/docs/learn/27-run_script.md +91 -0
- data/docs/learn/28-upload.md +55 -0
- data/docs/learn/README.md +4 -15
- data/docs/videos.md +14 -8
- data/lib/teuton/case/case.rb +3 -3
- data/lib/teuton/case/config.rb +0 -5
- data/lib/teuton/case/dsl/all.rb +5 -1
- data/lib/teuton/case/dsl/expect.rb +20 -33
- data/lib/teuton/case/dsl/expect_exitcode.rb +31 -0
- data/lib/teuton/case/dsl/expect_sequence.rb +173 -0
- data/lib/teuton/case/dsl/getset.rb +0 -1
- data/lib/teuton/case/dsl/host.rb +5 -0
- data/lib/teuton/case/dsl/macro.rb +7 -4
- data/lib/teuton/case/dsl/run_script.rb +35 -0
- data/lib/teuton/case/dsl/send.rb +3 -3
- data/lib/teuton/case/dsl/upload.rb +42 -0
- data/lib/teuton/case/dsl/weight.rb +12 -0
- data/lib/teuton/case/execute/execute_ssh.rb +11 -7
- data/lib/teuton/case/host.rb +68 -0
- data/lib/teuton/case/play.rb +2 -6
- data/lib/teuton/{utils → case}/result/ext_array.rb +0 -1
- data/lib/teuton/{utils → case}/result/ext_compare.rb +0 -1
- data/lib/teuton/{utils → case}/result/ext_filter.rb +0 -2
- data/lib/teuton/{utils → case}/result/result.rb +13 -21
- data/lib/teuton/check/checker.rb +82 -0
- data/lib/teuton/check/dsl/all.rb +37 -0
- data/lib/teuton/check/{builtin.rb → dsl/builtin.rb} +1 -3
- data/lib/teuton/check/dsl/expect.rb +90 -0
- data/lib/teuton/check/dsl/expect_sequence.rb +29 -0
- data/lib/teuton/check/dsl/getset.rb +23 -0
- data/lib/teuton/check/dsl/run.rb +35 -0
- data/lib/teuton/check/main.rb +29 -0
- data/lib/teuton/check/show.rb +75 -100
- data/lib/teuton/{utils → deprecated}/application.rb +0 -6
- data/lib/teuton/deprecated/application_test.rb +32 -0
- data/lib/teuton/readme/dsl/all.rb +32 -0
- data/lib/teuton/readme/dsl/expect.rb +29 -0
- data/lib/teuton/readme/dsl/getset.rb +33 -0
- data/lib/teuton/readme/dsl/run.rb +51 -0
- data/lib/teuton/readme/lang.rb +8 -10
- data/lib/teuton/readme/main.rb +27 -0
- data/lib/teuton/readme/readme.rb +31 -58
- data/lib/teuton/readme/result.rb +7 -0
- data/lib/teuton/report/formatter/default/txt.rb +2 -2
- data/lib/teuton/utils/configfile_reader.rb +8 -4
- data/lib/teuton/utils/logger.rb +32 -0
- data/lib/teuton/utils/verbose.rb +1 -1
- data/lib/teuton/version.rb +1 -1
- data/lib/teuton.rb +6 -5
- metadata +45 -37
- data/docs/CHANGELOG.md +0 -10
- data/docs/changelog/v2.0.md +0 -18
- data/docs/changelog/v2.1.md +0 -54
- data/docs/changelog/v2.2.md +0 -42
- data/docs/changelog/v2.3.md +0 -10
- data/docs/changelog/v2.4.md +0 -41
- data/docs/changelog/v2.5.md +0 -6
- data/docs/changelog/v2.6.md +0 -4
- data/docs/changelog/v2.7.md +0 -23
- data/docs/changelog/version2.1.md +0 -4
- data/docs/learn/videos.md +0 -13
- data/lib/teuton/case/execute/copy_ssh.rb +0 -70
- data/lib/teuton/check/dsl.rb +0 -112
- data/lib/teuton/check/laboratory.rb +0 -59
- data/lib/teuton/readme/dsl.rb +0 -126
- /data/lib/teuton/case/dsl/{goto.rb → run.rb} +0 -0
- /data/lib/teuton/{case/deprecated → deprecated}/runner.rb +0 -0
- /data/lib/teuton/{case/deprecated → deprecated}/utils.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41d7f02d5c9cc429427966cadfc4b7190a30194d4e23af3b436100dac3a1ee17
|
4
|
+
data.tar.gz: 41a7034fad8189b98ff0d17e5d875a5ed3512ddfb0dcac3e22d9b750e6c62304
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c6058ce58e3794926125f6bb06b27d98412e6ebf230c27e2f1abec30da87334fa519329ebff176e8ed649f79d876f15be811a6976aeef79e0168b647df637be
|
7
|
+
data.tar.gz: 1447f163a0b1d83c8ffa0cc1e3813810b2b22b59bb1ad359b2e5364f840f196ab8dc35906b612eb0912ec48b7dc67b9e136d42302b5943a08c4ec642e6b91faf
|
data/README.md
CHANGED
@@ -47,12 +47,12 @@ CASE RESULTS
|
|
47
47
|
|
48
48
|
# Documentation
|
49
49
|
|
50
|
+
* [Installation](docs/install/README.md)
|
50
51
|
* [Getting started](docs/learn/README.md)
|
51
|
-
* [
|
52
|
+
* [Examples](examples)
|
52
53
|
* [Commands](docs/commands/README.md)
|
53
|
-
* [
|
54
|
-
|
55
|
-
> [Blogs and videos](docs/videos.md)
|
54
|
+
* [Language reference](docs/dsl/README.md)
|
55
|
+
* [Blogs and videos](docs/videos.md)
|
56
56
|
|
57
57
|
# Contact
|
58
58
|
|
@@ -0,0 +1,119 @@
|
|
1
|
+
[<< back](../CHANGELOG.md)
|
2
|
+
|
3
|
+
# CHANGELOG
|
4
|
+
|
5
|
+
## [0.22.1] June 2017
|
6
|
+
|
7
|
+
* Now it's posible to use config files with YAML and JSON format
|
8
|
+
* Preparing migration of CLI command to use Thor gem
|
9
|
+
|
10
|
+
## [1.0.0] July 2017
|
11
|
+
|
12
|
+
* New stable version
|
13
|
+
|
14
|
+
## 2019
|
15
|
+
|
16
|
+
## [1.10.0] Janyary 2019
|
17
|
+
|
18
|
+
* SysadminGame change his name by TEUTON. "project" command replaced by "teuton".
|
19
|
+
* Challenges (Teuton scripts) moved to "teuton-challenges" github repository.
|
20
|
+
* Execute "rake get_challenges" to get sample teuton challenges
|
21
|
+
|
22
|
+
## [2.0.4] August 2019
|
23
|
+
|
24
|
+
* TEUTON project grew up and was divided into the folowing repositories: teuton, challenges, panel, resources and vagrant.
|
25
|
+
* Documentation has been moved into respository teuton wiki. Only maintain English docs.
|
26
|
+
|
27
|
+
## [2.1.0]
|
28
|
+
|
29
|
+
**Export grades on csv file using Moodle format**
|
30
|
+
|
31
|
+
* Automaticaly exports `moodle.csv` file with all cases grades, using adecuate format so it could be imported directly into Moodle platform.
|
32
|
+
* We need to configure some params like this:
|
33
|
+
|
34
|
+
```
|
35
|
+
---
|
36
|
+
:global:
|
37
|
+
:cases:
|
38
|
+
- :tt_members: ...
|
39
|
+
:tt_moodle_id: User Moodle Identity
|
40
|
+
```
|
41
|
+
|
42
|
+
**readme keyword**
|
43
|
+
|
44
|
+
We currently use the "teuton readme pry-folder" command to export README file from the challenge.
|
45
|
+
|
46
|
+
* This example shows how to use readme keyword to add group description or target description:
|
47
|
+
|
48
|
+
```
|
49
|
+
group "GROUPNAME" do
|
50
|
+
readme "Description for this group"
|
51
|
+
|
52
|
+
target "target1"
|
53
|
+
readme "Description for this target"
|
54
|
+
goto :host, :exec => 'id root'
|
55
|
+
expec_one 'root'
|
56
|
+
```
|
57
|
+
|
58
|
+
**Installation process**
|
59
|
+
|
60
|
+
* Use Bundler to install gems instead of rake.
|
61
|
+
* It will be usefull use sysadming-game as gem? And install it with `gem install teuton`.
|
62
|
+
* Vagrant: test how to use vagrant machines as case hosts.
|
63
|
+
|
64
|
+
**Info sobre novedades de la versión 2.1**
|
65
|
+
|
66
|
+
1. Teuton readme y dsl readme
|
67
|
+
2. Macros de define macro
|
68
|
+
3. Export yaml y html
|
69
|
+
4. Teuton --no-color
|
70
|
+
5. teuton run --case
|
71
|
+
6. teuton run --cname
|
72
|
+
7. teuton run --cpath
|
73
|
+
8. actualizar formatos de salida
|
74
|
+
9. instalación mediante gemas
|
75
|
+
10. teuton panel
|
76
|
+
11. teuton client y server
|
77
|
+
12. nuevos nombres de comandos...
|
78
|
+
13. cambio de goto a run
|
79
|
+
|
80
|
+
## [2.2.0]
|
81
|
+
|
82
|
+
**New features**
|
83
|
+
|
84
|
+
* Let's see new features examples:
|
85
|
+
* 10 result and moodle_id
|
86
|
+
* 11 get_vars
|
87
|
+
* 12 alias
|
88
|
+
* 13 include (tt_include config param)
|
89
|
+
* 14 macros
|
90
|
+
|
91
|
+
**Configuration file**
|
92
|
+
|
93
|
+
* Por defecto los valores de clave de los ficheros de configuración serán Strings en lugar de símbolos, aunque lo símbolos seguirán funcionando.
|
94
|
+
|
95
|
+
**get_vars: To think - We are not sure about this***
|
96
|
+
|
97
|
+
* "get" keyword simplification: Simplify getting and setting params process. For example: `_username_`, may be alias for `get(:username)`. Then
|
98
|
+
|
99
|
+
```
|
100
|
+
target "Create user #{_username_}"
|
101
|
+
run "id #{_username_}"
|
102
|
+
expect_one _username_
|
103
|
+
```
|
104
|
+
Same as
|
105
|
+
|
106
|
+
```
|
107
|
+
target "Create user "+get(:username)
|
108
|
+
run "id " + get(:username)
|
109
|
+
expect_one get(:username)
|
110
|
+
```
|
111
|
+
|
112
|
+
* Promocinar el proyecto:
|
113
|
+
* Documentar y hacer videos.
|
114
|
+
* Charlas y talleres
|
115
|
+
|
116
|
+
**Fixed**
|
117
|
+
|
118
|
+
* Solucionar fallo en --cname
|
119
|
+
* Revisar doc options como cpanel
|
@@ -0,0 +1,105 @@
|
|
1
|
+
|
2
|
+
## [2.3.9]
|
3
|
+
|
4
|
+
- FIX: Remove warnings from linter
|
5
|
+
- FIX: Remove warning about thor gem version. Upgrade gem to 1.2
|
6
|
+
|
7
|
+
## [2.3.11]
|
8
|
+
|
9
|
+
- Issue #18
|
10
|
+
|
11
|
+
## [2.4.0]
|
12
|
+
|
13
|
+
New features:
|
14
|
+
- Hide feedback from reports: `export feedback: false`
|
15
|
+
- Add new DSL keyword: expect_last, expect_fisrt
|
16
|
+
- Remove os gem.
|
17
|
+
- Change test output colors to green as use others test tools.
|
18
|
+
- Change show DSL params. Accepts one param "verbose: NUMBER" to adjust verbosity output level on screen.
|
19
|
+
|
20
|
+
New doc and example:
|
21
|
+
- 14-alias
|
22
|
+
- 16-exit_codes
|
23
|
+
|
24
|
+
Bug fixed:
|
25
|
+
- All "expect*" keywords must require 2 arguments. The second is optional.
|
26
|
+
|
27
|
+
Revise
|
28
|
+
- Remove colors to log text
|
29
|
+
- teuton readme: macros, getvars, expect_last, expect_first
|
30
|
+
|
31
|
+
## [2.4.2]
|
32
|
+
|
33
|
+
- Fix bug with result.grep_v(Array)
|
34
|
+
|
35
|
+
## [2.4.3]
|
36
|
+
|
37
|
+
- Fix: "expect_none" without params works as "expect result.count.eq 0"
|
38
|
+
- Add: "expect_nothing" that works as "expect result.count.eq 0".
|
39
|
+
|
40
|
+
## [2.4.4]
|
41
|
+
|
42
|
+
-- Modify: teuton check output colors and exit codes.
|
43
|
+
exit code 0 = check OK
|
44
|
+
exit code 1 = check error
|
45
|
+
-- Fix teuton check docs.
|
46
|
+
|
47
|
+
## [2.4.5]
|
48
|
+
|
49
|
+
-- FIX: "expect_nothing" was always TRUE when SSH/Telnet connections fails!
|
50
|
+
Now when SSH/Telnet connections fails result contains "SSH: NO CONNECTION!"
|
51
|
+
So "expect_nothing" will fail.
|
52
|
+
|
53
|
+
## [2.5.0]
|
54
|
+
|
55
|
+
- ADD: "tt_moodle_max_score" global configuration param. Teuton grades (0-100) are divided by this value when exporting data into "moodle.csv" output file.
|
56
|
+
- UPDATE: Revise documentation. Doc learn 10,11, 12,13 y 14. 10 result and moodle_id, 12 alias, 13 include, 14 macro, Doc tt_include
|
57
|
+
- UPDATE: Internal changes. Remove Colorize gem and replace with Rainbow.
|
58
|
+
|
59
|
+
## [2.6.0]
|
60
|
+
|
61
|
+
- [ADD] When running local or SSH commands, stdout and stderr are captured and readed by "expect" sentence.
|
62
|
+
|
63
|
+
## [2.7.0]
|
64
|
+
|
65
|
+
New features:
|
66
|
+
- [ADD] "teuton config PROJECTPATH" will suggest suitable configuration for the project.
|
67
|
+
- [ADD] Every one line command output is registered into reports.
|
68
|
+
- [ADD] "expect_exit 1", check last command exit code is equal to 1.
|
69
|
+
|
70
|
+
Internal changes:
|
71
|
+
* Application class splited into Settings and Project classes
|
72
|
+
* Create SendManager similar to ExportManager
|
73
|
+
|
74
|
+
## [2.7.1]
|
75
|
+
|
76
|
+
- [FIX] Fixed an issue that appeared when executing test and fail connection to remote computer.
|
77
|
+
|
78
|
+
## [2.7.2] 20230607
|
79
|
+
|
80
|
+
- [FIX] Fixed an issue that appeared when exporting reports without feedback after failing to connect to remote computer.
|
81
|
+
|
82
|
+
## [2.7.3] 20230607
|
83
|
+
|
84
|
+
- [FIX] Hall of fame now use Project class instead of Application.
|
85
|
+
|
86
|
+
## [2.8.0] 20230630
|
87
|
+
|
88
|
+
DSL expect:
|
89
|
+
- [ADD] "expect_ok" as "expect_exit 0 ".
|
90
|
+
- [ADD] "expect_fail" as "expect_exit NUMBER" where NUMBER > 0.
|
91
|
+
- [FIX] expect evaluation fail when there is no remote connection.
|
92
|
+
|
93
|
+
DSL send:
|
94
|
+
- [UPDATE] Rename "remote_dir" send param to "dir".
|
95
|
+
- [UPDATE] send output messages
|
96
|
+
|
97
|
+
## [2.9.0] unrelease
|
98
|
+
|
99
|
+
- [ADD] "expect_sequence" that check if sequence is present
|
100
|
+
- [ADD] New DSL "run_script". Example: `run_script script, on: :host1`, upload script to host1 and then execute it on remote.
|
101
|
+
- [ADD] New DSL "upload". Upload local file to remote host. Example `upload "localfile", to: :host1`
|
102
|
+
- [ADD] `teuton check` works with `expect_sequence`, `run_script` and `upload`.
|
103
|
+
- [FIX] `teuton check` works fine with `macros`.
|
104
|
+
- [ADD] `teuton readme` works with `expect_sequence`, `run_script` and `upload`.
|
105
|
+
- [FIX] `teuton readme` works fine with `macros`.
|
data/docs/diagram.md
CHANGED
@@ -9,15 +9,15 @@ subgraph user
|
|
9
9
|
CLI --> Teuton
|
10
10
|
end
|
11
11
|
|
12
|
-
subgraph "create
|
13
|
-
Teuton -- create --> Skeleton("
|
12
|
+
subgraph "create new project"
|
13
|
+
Teuton -- create --> Skeleton("Skeleton\nFiles")
|
14
14
|
end
|
15
15
|
|
16
|
-
subgraph "Check\nproject
|
16
|
+
subgraph "Check\nproject"
|
17
17
|
Teuton -- check --> Laboratory("Laboratory\nDSL\nShow\nBuiltin!")
|
18
18
|
end
|
19
19
|
|
20
|
-
subgraph "Create readme
|
20
|
+
subgraph "Create\nproject readme"
|
21
21
|
Teuton -- readme --> Readme("Readme\nDSL\nLang!")
|
22
22
|
end
|
23
23
|
|
@@ -27,8 +27,8 @@ subgraph manager
|
|
27
27
|
ReportManager --> HallOfFame
|
28
28
|
end
|
29
29
|
|
30
|
-
subgraph "case
|
31
|
-
CaseManager --> Case("Case\nConfig\
|
30
|
+
subgraph "case"
|
31
|
+
CaseManager --> Case("Case\nConfig\nDSL\nPlay\nExecute\nResult\nClose\nbuiltin!")
|
32
32
|
end
|
33
33
|
|
34
34
|
subgraph utils
|
@@ -42,10 +42,10 @@ subgraph utils
|
|
42
42
|
Readme --> Result("Result\next_array\next_compare\next_filter")
|
43
43
|
Case --> Result
|
44
44
|
|
45
|
-
Laboratory -->
|
46
|
-
Readme -->
|
47
|
-
manager/DSL -- use/macros/groups -->
|
48
|
-
Case -->
|
45
|
+
Laboratory --> Project
|
46
|
+
Readme --> Project
|
47
|
+
manager/DSL -- use/macros/groups --> Project("Project\nNameFileFinder")
|
48
|
+
Case --> Project
|
49
49
|
end
|
50
50
|
|
51
51
|
subgraph report
|
data/docs/dsl/expect.md
CHANGED
@@ -9,31 +9,84 @@ Compare the obtained result with the expected one. This comparation process is r
|
|
9
9
|
Let's see some examples:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
target
|
13
|
-
run
|
14
|
-
expect
|
12
|
+
target "Exist user obiwan"
|
13
|
+
run "id obiwan"
|
14
|
+
expect "obiwan" # Expect run command output will contain "obiwan"
|
15
15
|
```
|
16
16
|
|
17
|
-
##
|
17
|
+
## Simple evaluations
|
18
18
|
|
19
|
-
| Command
|
20
|
-
|
|
21
|
-
| expect "yoda"
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
| Command | Description |
|
20
|
+
| ----------------------------- | ------------------------------ |
|
21
|
+
| expect "yoda" | one or more line/s with "yoda" |
|
22
|
+
| expect_any "yoda" | one or more line/s with "yoda" |
|
23
|
+
| expect ["obiwan", "kenobi"] | one or more line/s with "obiwan" and kenobi" |
|
24
|
+
| expect_first "episode" | the first line with "episode" |
|
25
|
+
| expect_last "the end" | the last line with "the end" |
|
26
|
+
| expect_one "rogue" | only one line with "rogue" |
|
26
27
|
| expect_one ["obiwan","kenobi"] | only one line with "obiwan" and "kenobi" |
|
27
|
-
|
|
28
|
+
| expect /Obiwan\|obi-wan/ | one or more line/s with Obiwan or obi-wan. This example uses regular expresions. |
|
29
|
+
|
30
|
+
## Negative evaluations
|
31
|
+
|
32
|
+
| Command | Description |
|
33
|
+
| ------------------------------ | ---------------------------- |
|
34
|
+
| expect_none "vader" | Expects no line with "vader" |
|
28
35
|
| expect_none ["darth", "vader"] | no line with "darth" or "vader" |
|
29
|
-
| expect_none
|
30
|
-
| expect_nothing
|
31
|
-
|
32
|
-
|
36
|
+
| expect_none | no output lines expected |
|
37
|
+
| expect_nothing | no output lines expected |
|
38
|
+
|
39
|
+
## Exitcode evaluations
|
40
|
+
|
41
|
+
| Command | Description |
|
42
|
+
| -------------------- | ------------------------- |
|
43
|
+
| expect_ok | Check exit code is 0 |
|
44
|
+
| expect_fail | Check exit code is > 0 |
|
45
|
+
| expect_exit NUMBER | Check exit code is NUMBER |
|
46
|
+
| expect_exit MIN..MAX | Check exit code is >= MIN and < MAXNUMBER |
|
47
|
+
|
48
|
+
## Evaluate sequence
|
49
|
+
|
50
|
+
* **Simple sequence**. Validate sequences where the elements are in order. Use `find` statement to find each element of the sequence.
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
# Examples: [A,B,C], [A,s,B,s,C], [x,A,B,s,C,x], etc.
|
54
|
+
|
55
|
+
expect_sequence do
|
56
|
+
find "A"
|
57
|
+
find "B"
|
58
|
+
find "C"
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
* **Strict sequence**. validate sequences where the elements are in strict consecutive order. First use `find` to find an element in the sequence and then `next_to` for the next element in strict order.
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
# Examples: [A,B,C], [x,A,B,C,x], etc.
|
66
|
+
|
67
|
+
expect_sequence do
|
68
|
+
find "A"
|
69
|
+
next_to "B"
|
70
|
+
next_to "C"
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
* **Strict sequence with jumps**. Use `ignore N` to indicate that there are N lines between 2 elements of the sequence.
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
# Examples: [A,B,s,s,C], [x,A,B,s,s,C,x], etc.
|
78
|
+
|
79
|
+
expect_sequence do
|
80
|
+
find "A"
|
81
|
+
next_to "B"
|
82
|
+
ignore 2
|
83
|
+
next_to "C"
|
84
|
+
end
|
85
|
+
```
|
33
86
|
|
34
|
-
##
|
87
|
+
## Complex evaluations
|
35
88
|
|
36
|
-
After every execution keyword
|
89
|
+
After every execution keyword `run`, command outputs is wrapped into **result** object. We may use **result** to make complex evaluations.
|
37
90
|
|
38
91
|
For example, if we have this execution
|
39
92
|
|
@@ -42,10 +95,10 @@ target 'Exist user vader'
|
|
42
95
|
run 'cat /etc/passwd'
|
43
96
|
```
|
44
97
|
|
45
|
-
Then we check result with:
|
98
|
+
Then we can check result with:
|
46
99
|
|
47
|
-
* **expect result.find(
|
48
|
-
* **expect result.find(/
|
49
|
-
* **expect result.not_find('#').find('
|
100
|
+
* **expect result.find(/obiwan|kenobi/).count.eq(1)**, expect there exists only 1 line with "obiwan" or "kenobi".
|
101
|
+
* **expect result.find(/darth/).find(/vader/).count.gt(2)**, expect there exists more than 2 lines with texts "darth" and "vader".
|
102
|
+
* **expect result.not_find('#').find('yoda').count.lt(3)**, expects there exists less than 3 lines with text "yoda" and without "#" symbol.
|
50
103
|
|
51
|
-
Read [result](result.md)
|
104
|
+
Read more about [result](result.md) object.
|
data/docs/dsl/export.md
CHANGED
@@ -24,9 +24,11 @@ end
|
|
24
24
|
|
25
25
|
## Options
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
| Option | Values | Description |
|
28
|
+
| ------ | ------ | ----------- |
|
29
|
+
| format | **txt** (default), html, yaml, json, colored_text (txt with colors) |Output file format |
|
30
|
+
| preserve | **false** (default), true | Keep report old copies |
|
31
|
+
| feedback | **true** (default), false | Hide some fields from reports |
|
30
32
|
|
31
33
|
## Usage
|
32
34
|
|
@@ -40,3 +42,4 @@ end
|
|
40
42
|
| 06 | `export format: 'colored_text'` or `export format: :colored_text` | Export file using colored TXT ouput format |
|
41
43
|
| 07 | `export preserve: true` | Export default format and preserve report copies |
|
42
44
|
| 08 | `export format: 'html', preserve: true` or `export format: :html, preserve: true` | Export 'html' format and preserve report copies |
|
45
|
+
| 09 | `export feedback: false` | With "feedback: false" some fields are hidden: command, alterations, expected and result |
|
data/docs/dsl/result.md
CHANGED
@@ -33,18 +33,12 @@ run "cat /etc/passwd", on: :host1
|
|
33
33
|
```
|
34
34
|
|
35
35
|
And then we could do:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
result.grep_v("nologin").grep("/bin/bash").count
|
43
|
-
```
|
44
|
-
* Return true if the number when count all lines that dosn't contain "nologin" and contain "/bin/bash" is greater than 0
|
45
|
-
```
|
46
|
-
result.grep_v("nologin").grep("/bin/bash").count.gt 0
|
47
|
-
```
|
36
|
+
|
37
|
+
| Description | Command |
|
38
|
+
| ----------- | ------- |
|
39
|
+
| Get all lines that dosn't contain "nologin" and contain "/bin/bash" | result.grep_v("nologin").grep("/bin/bash") |
|
40
|
+
| Count all lines that dosn't contain "nologin" and contain "/bin/bash" | result.grep_v("nologin").grep("/bin/bash").count |
|
41
|
+
| Return true if the number when count all lines that dosn't contain "nologin" and contain "/bin/bash" is greater than 0 | result.grep_v("nologin").grep("/bin/bash").count.gt 0 |
|
48
42
|
|
49
43
|
## Functions
|
50
44
|
|
@@ -52,33 +46,33 @@ result.grep_v("nologin").grep("/bin/bash").count.gt 0
|
|
52
46
|
|
53
47
|
| Function | Description |
|
54
48
|
| ------------------- | ------------------------- |
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
| result.eq(VALUE) | Result equal to VALUE |
|
50
|
+
| result.neq(VALUE) | Result not equal to VALUE |
|
51
|
+
| result.gt(VALUE) | Result greater than VALUE |
|
52
|
+
| result.ge(VALUE) | Result equal or greater than VALUE |
|
53
|
+
| result.lt(VALUE) | Result lesser than VALUE |
|
54
|
+
| result.le(VALUE) | Result equal or lesser than VALUE |
|
61
55
|
|
62
56
|
**Filtering functions:**
|
63
57
|
|
64
58
|
| Function | VALUE type | Description |
|
65
59
|
| -------------------- | ----------- | ------------------------------------- |
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
| result.count | | Count lines from result and save this number into result object. |
|
61
|
+
| result.first | | Remove all lines except first one.|
|
62
|
+
| result.find(VALUE) | String | Filter lines that contains VALUE text |
|
69
63
|
| | RegExp | Filter lines that match VALUE regexp. For example `/?ello]`, filter lines with "Hello" or "hello" |
|
70
64
|
| | Array | Apply filter to every array element. For example `["Hi","Hello"]`, filter lines with "Hi" or "Hello". |
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
| result.grep(VALUE) | String, RegExp, Array | Same as find |
|
66
|
+
| result.grep_v(VALUE) | String, RegExp, Array | Same as not_find |
|
67
|
+
| result.last | | Remove all lines except last one.|
|
68
|
+
| result.not_find(VALUE) | | Filter lines that not contains VALUE. VALUE may be String, Regular Expresion or an Array. |
|
69
|
+
| result.restore | | Restore result data. After every filtering action result is modified, but this function restore data to their original state. |
|
76
70
|
|
77
71
|
**Information functions:**
|
78
72
|
|
79
73
|
| Function | Description |
|
80
74
|
| -------------------- | --------------------------------- |
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
| result.alterations | Return transformations applied to the output |
|
76
|
+
| result.content | Return all output lines |
|
77
|
+
| result.debug | Print the result content on screen. Usefull for debugging process |
|
78
|
+
| result.value | Return first output line or value |
|
data/docs/dsl/send.md
CHANGED
@@ -12,33 +12,18 @@ end
|
|
12
12
|
```
|
13
13
|
|
14
14
|
* `send` instruction must be execute after `export`. Reports must be generated before send them, of course.
|
15
|
-
* `host1`,
|
15
|
+
* `host1`, label that identify remote host. This information must be configured into config file.
|
16
16
|
* `send copy_to: :host1`, copy every case resport file into temp directory on remote host `host1`.
|
17
17
|
|
18
|
-
##
|
18
|
+
## Options
|
19
19
|
|
20
|
-
|
20
|
+
| Option | Action | Description |
|
21
|
+
| ------: | ------ | ----------- |
|
22
|
+
| copy_to | send copy_to: :host1 | Copy report into default directory of remote machine `host1`. |
|
23
|
+
| prefix | send copy_to: :host1, prefix: "example_" | Case report will be save into default directory on every host `host1`, named as `example_case-XX.txt`. |
|
24
|
+
| dir | send copy_to: :host1, dir: "/home/obiwan" | Reports will be saved into "/home/obiwan" directory in remote machine `host1`. |
|
21
25
|
|
22
|
-
|
23
|
-
|
24
|
-
![](images/send-remote-dir-dot2.jpg)
|
25
|
-
|
26
|
-
Example 2: send report file to remote "./Desktop" folder.
|
27
|
-
|
28
|
-
![](images/send-remote-dir-desktop1.jpg)
|
29
|
-
|
30
|
-
## Parameters
|
31
|
-
|
32
|
-
| Action | Description |
|
33
|
-
| ------ | ----------- |
|
34
|
-
| `send copy_to: :host1, remote_dir: "/home/david"` | Reports will be saved into "/home/david" directory in remote machine `host1`. |
|
35
|
-
| `send copy_to: :host1, prefix: "samba_"` | Case report will be save into temp directory on every host `host1`, named as `samba_case-XX.txt`. |
|
36
|
-
|
37
|
-
> Teuton version 2.0.x
|
38
|
-
> * By default, `send` only works when remote OS type is UNIX base, like GNU/Linux, MACOS, BSD, etc.
|
39
|
-
> * For Windows OS we must specified `:remote_dir`. Example: `send :copy_to => :host1, :remote_dir => "C:\\"`. This example will copy files on directory c:\ of host1 machine.
|
40
|
-
|
41
|
-
## Send several reports
|
26
|
+
## Example: Send several reports with diferent formats
|
42
27
|
|
43
28
|
If you export several files using differents output formats, you will use several `export` orders. Then when invoke `send` order, this will send the last exported file.
|
44
29
|
|
@@ -64,3 +49,29 @@ start do
|
|
64
49
|
send copy_to: :host1
|
65
50
|
end
|
66
51
|
```
|
52
|
+
|
53
|
+
## Example: Using "dir" options
|
54
|
+
|
55
|
+
Example 1: send `case-01-txt` file to default folder of remote remote host.
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
play do
|
59
|
+
show
|
60
|
+
export
|
61
|
+
send copy_to: :host1
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
65
|
+
Result:
|
66
|
+
|
67
|
+
![](images/send-remote-dir-dot2.jpg)
|
68
|
+
|
69
|
+
Example 2: send report file to "./Desktop" folder of remote host.
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
play do
|
73
|
+
show
|
74
|
+
export
|
75
|
+
send copy_to: :host1, dir: "./Desktop"
|
76
|
+
end
|
77
|
+
```
|