teuton 2.4.3 → 2.4.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/README.md +2 -2
- data/docs/changelog/v2.4.md +6 -0
- data/docs/commands/example_check.md +17 -6
- data/docs/dsl/expect.md +3 -1
- data/lib/teuton/check/show.rb +4 -5
- data/lib/teuton/utils/configfile_reader.rb +5 -5
- data/lib/teuton/utils/name_file_finder.rb +3 -6
- data/lib/teuton/version.rb +1 -1
- data/lib/teuton.rb +12 -6
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d08e48b0ba8d25877e8e77346605089c59c56553f659d26c16e457907594c5dc
|
4
|
+
data.tar.gz: 030e7290d52ddef0087e9d5f4c391f259fc88bd0c20ec4b47500e9ffcf6be6f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad340ebd02ca80be898aff768e523f0b8773da4b3c92181db61efbde24a55b67ca02ba243f7f1217d947c28ff8bb3ba552c867ff17ada2d2097de2cf07dd5701
|
7
|
+
data.tar.gz: 258e6510a41d0d5e1218e2f42db26c2857207db389158efa69fa0125a4593fbf85f2165b8f1a16f072da8830b44f6803863ba513f4635740583c9ba7ee56d38f
|
data/README.md
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|

|
6
6
|

|
7
7
|
|
8
|
-
_Create Unit Test for your machines. Test your
|
8
|
+
_Create Unit Test for your machines. Test your infrastructure as code._
|
9
9
|
|
10
10
|

|
11
11
|
|
12
|
-
Teuton is an
|
12
|
+
Teuton is an infrastructure test tool, useful for:
|
13
13
|
* Sysadmin teachers who want to evaluate students remote machines.
|
14
14
|
* Sysadmin apprentices who want to evaluate their learning process as a game.
|
15
15
|
* Professional sysadmin who want to monitor remote machines.
|
data/docs/changelog/v2.4.md
CHANGED
@@ -2,18 +2,23 @@
|
|
2
2
|
|
3
3
|
# Check Teuton Test
|
4
4
|
|
5
|
-
|
5
|
+
| Param | Description | Default value |
|
6
|
+
| ---------------- | ---------------------- | ------------- |
|
7
|
+
| --no-panelconfig | Show check information | Enabled |
|
8
|
+
| --panelconfig | Only show config file recomended content | Disabled |
|
9
|
+
| --cpath | Specify path to config file | TEST-FOLDER/config.yaml |
|
10
|
+
| --cname | Specify name to config file | config.yaml |
|
6
11
|
|
7
12
|
Usage:
|
8
13
|
|
9
14
|
```
|
10
|
-
teuton check
|
15
|
+
teuton check PATH-TO-TEST-FOLDER
|
11
16
|
```
|
12
17
|
|
13
18
|
Example:
|
14
19
|
|
15
20
|
```bash
|
16
|
-
❯ teuton check examples/
|
21
|
+
❯ teuton check examples/02-target
|
17
22
|
|
18
23
|
+----------------------------+
|
19
24
|
| GROUP: Learn about targets |
|
@@ -28,7 +33,7 @@ Example:
|
|
28
33
|
+--------------+-------+
|
29
34
|
| Groups | 1 |
|
30
35
|
| Targets | 1 |
|
31
|
-
|
|
36
|
+
| Runs | 1 |
|
32
37
|
| * localhost | 1 |
|
33
38
|
| Uniques | 0 |
|
34
39
|
| Logs | 0 |
|
@@ -39,12 +44,18 @@ Example:
|
|
39
44
|
+----------------------+
|
40
45
|
| Revising CONFIG file |
|
41
46
|
+----------------------+
|
42
|
-
[WARN]
|
47
|
+
[WARN] Configfile not found
|
48
|
+
/home/david/proy/repos/teuton.d/teuton/examples/02-target/config.yaml
|
43
49
|
[INFO] Recomended content:
|
44
50
|
---
|
45
51
|
:global:
|
46
52
|
:cases:
|
47
53
|
- :tt_members: VALUE
|
54
|
+
|
55
|
+
Check OK!
|
48
56
|
```
|
49
57
|
|
50
|
-
|
58
|
+
The check process notifies that
|
59
|
+
* This test hasn't config file
|
60
|
+
* and recommends content for our config file. But it isn't necessary for this example.
|
61
|
+
* Syntax is OK!
|
data/docs/dsl/expect.md
CHANGED
@@ -25,7 +25,9 @@ expect 'obiwan' # Expect previous run command output contains obiwan text
|
|
25
25
|
| expect_one "rogue" | only one line with "rogue" |
|
26
26
|
| expect_one ["obiwan","kenobi"] | only one line with "obiwan" and "kenobi" |
|
27
27
|
| expect_none "vader"| no line with "vader" |
|
28
|
-
| expect_none ["darth", "vader"] | no line with "darth"
|
28
|
+
| expect_none ["darth", "vader"] | no line with "darth" or "vader" |
|
29
|
+
| expect_none | no output lines expected |
|
30
|
+
| expect_nothing | no output lines expected |
|
29
31
|
| expect /Obiwan\|obi-wan/ | one or more line/s with Obiwan or obi-wan. This example uses regular expresions. |
|
30
32
|
|
31
33
|
## Advanced
|
data/lib/teuton/check/show.rb
CHANGED
@@ -69,15 +69,14 @@ class Laboratory
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def recomended_config_content
|
72
|
-
|
73
|
-
|
74
|
-
verboseln Rainbow("
|
75
|
-
verboseln "[INFO] Recomended content:"
|
72
|
+
verboseln Rainbow("[WARN] Configfile not found").bright.yellow
|
73
|
+
verboseln Rainbow(" #{@path[:config]}").white
|
74
|
+
verboseln Rainbow("[INFO] Recomended content:").bright.yellow
|
76
75
|
output = {global: nil, cases: []}
|
77
76
|
output[:cases][0] = {}
|
78
77
|
script_vars = find_script_vars
|
79
78
|
script_vars.each { |i| output[:cases][0][i] = "VALUE" }
|
80
|
-
verboseln YAML.dump(output)
|
79
|
+
verboseln Rainbow(YAML.dump(output)).white
|
81
80
|
end
|
82
81
|
|
83
82
|
def recomended_panelconfig_content
|
@@ -31,11 +31,11 @@ module ConfigFileReader
|
|
31
31
|
begin
|
32
32
|
data = YAML.load(File.open(filepath))
|
33
33
|
rescue => e
|
34
|
-
puts "\n" + ("=" * 80)
|
35
|
-
puts "[ERROR] ConfigFileReader#read <#{filepath}>"
|
36
|
-
puts " I suggest to revise file format!"
|
37
|
-
puts " #{e.message}\n" + ("=" * 80)
|
38
|
-
|
34
|
+
$stderr.puts "\n" + ("=" * 80)
|
35
|
+
$stderr.puts "[ERROR] ConfigFileReader#read <#{filepath}>"
|
36
|
+
$stderr.puts " I suggest to revise file format!"
|
37
|
+
$stderr.puts " #{e.message}\n" + ("=" * 80)
|
38
|
+
exit 1
|
39
39
|
end
|
40
40
|
data = convert_string_keys_to_symbol(data)
|
41
41
|
data[:global] = data[:global] || {}
|
@@ -27,9 +27,7 @@ module NameFileFinder
|
|
27
27
|
# COMPLEX MODE: We use start.rb as main RB file
|
28
28
|
script_path = File.join(folder_path, "start.rb")
|
29
29
|
unless File.exist? script_path
|
30
|
-
|
31
|
-
print Rainbow(script_path).bright.red
|
32
|
-
puts Rainbow(" not found!").red
|
30
|
+
warn Rainbow("[ERROR] File not found: #{script_path}").bright.red
|
33
31
|
exit 1
|
34
32
|
end
|
35
33
|
|
@@ -68,9 +66,8 @@ module NameFileFinder
|
|
68
66
|
# SIMPLE MODE: We use script_path as main RB file
|
69
67
|
# This must be fullpath to DSL script file
|
70
68
|
if File.extname(script_path) != ".rb"
|
71
|
-
|
72
|
-
|
73
|
-
puts Rainbow(" must have rb extension").red
|
69
|
+
warn Rainbow("[ERROR] .rb extension required!").bright.red
|
70
|
+
warn Rainbow(" #{script_path}").white
|
74
71
|
exit 1
|
75
72
|
end
|
76
73
|
|
data/lib/teuton/version.rb
CHANGED
data/lib/teuton.rb
CHANGED
@@ -27,8 +27,13 @@ module Teuton
|
|
27
27
|
|
28
28
|
app = Application.instance
|
29
29
|
lab = Laboratory.new(app.script_path, app.config_path)
|
30
|
-
|
31
|
-
|
30
|
+
if options[:panelconfig]
|
31
|
+
lab.show_panelconfig
|
32
|
+
else
|
33
|
+
lab.show
|
34
|
+
end
|
35
|
+
puts Rainbow("Check OK!").green
|
36
|
+
exit 0
|
32
37
|
end
|
33
38
|
|
34
39
|
private_class_method def self.require_dsl_and_script(dslpath)
|
@@ -36,10 +41,11 @@ module Teuton
|
|
36
41
|
require_relative dslpath
|
37
42
|
begin
|
38
43
|
require_relative app.script_path
|
39
|
-
rescue
|
40
|
-
|
41
|
-
|
42
|
-
|
44
|
+
rescue
|
45
|
+
warn e.to_s
|
46
|
+
warn Rainbow.new("[FAIL ] Reading file #{app.script_path}").red
|
47
|
+
warn Rainbow.new("[ERROR] Syntax Error!").red
|
48
|
+
exit 1
|
43
49
|
end
|
44
50
|
end
|
45
51
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teuton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Vargas Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: colorize
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.8.1
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.8.1
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rainbow
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|