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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4737382a68bd95498f1fcfe7fab7dd674170ac21e56aeea7761cea9c7edb2c58
4
- data.tar.gz: 00bbd221c4251ad369a3829eb67d32fce2d05c15a9af764f76874031bc26dc0f
3
+ metadata.gz: d08e48b0ba8d25877e8e77346605089c59c56553f659d26c16e457907594c5dc
4
+ data.tar.gz: 030e7290d52ddef0087e9d5f4c391f259fc88bd0c20ec4b47500e9ffcf6be6f5
5
5
  SHA512:
6
- metadata.gz: bc557091ed6ae131bf925a0da452b34e01a64ee95ffa1cdc52f17742920614c8126ba66e5c2bd830f901dd3acbb8cc644be604ae267eddd60b3937915d3f3b83
7
- data.tar.gz: 9cd807f54792d0cf64d53a5ff82d03ca8e7e3eaf49338d511948defeaa802731ee1c8cb96ec07192d2c415c8ef113ddd180a3ed60a0bf0421ba12d314b12b601
6
+ metadata.gz: ad340ebd02ca80be898aff768e523f0b8773da4b3c92181db61efbde24a55b67ca02ba243f7f1217d947c28ff8bb3ba552c867ff17ada2d2097de2cf07dd5701
7
+ data.tar.gz: 258e6510a41d0d5e1218e2f42db26c2857207db389158efa69fa0125a4593fbf85f2165b8f1a16f072da8830b44f6803863ba513f4635740583c9ba7ee56d38f
data/README.md CHANGED
@@ -5,11 +5,11 @@
5
5
  ![GitHub](https://img.shields.io/github/license/dvarrui/teuton)
6
6
  ![Gem](https://img.shields.io/gem/dv/teuton/2.4.0)
7
7
 
8
- _Create Unit Test for your machines. Test your infraestructure as code._
8
+ _Create Unit Test for your machines. Test your infrastructure as code._
9
9
 
10
10
  ![logo](./docs/images/logo.png)
11
11
 
12
- Teuton is an intrastructure test tool, useful for:
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.
@@ -1,3 +1,9 @@
1
+ ## [2.4.4]
2
+
3
+ -- Modify: teuton check output colors and exit codes.
4
+ exit code 0 = check OK
5
+ exit code 1 = check error
6
+ -- Fix teuton check docs.
1
7
 
2
8
  ## [2.4.3]
3
9
 
@@ -2,18 +2,23 @@
2
2
 
3
3
  # Check Teuton Test
4
4
 
5
- Objective: Revise Teuton test located into `example\01-target`.
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 examples/01-target
15
+ teuton check PATH-TO-TEST-FOLDER
11
16
  ```
12
17
 
13
18
  Example:
14
19
 
15
20
  ```bash
16
- ❯ teuton check examples/01-target
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
- | Goto | 1 |
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] File .../examples/01-target/config.yaml not found!
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
- > The check process notifies that this Test Unit hasn't config file, and Teuton recommends content for config file. But it isn't necessary for this example.
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" and "vader" |
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
@@ -69,15 +69,14 @@ class Laboratory
69
69
  end
70
70
 
71
71
  def recomended_config_content
72
- verbose Rainbow("[WARN] File ").yellow
73
- verbose Rainbow(@path[:config]).yellow.bright
74
- verboseln Rainbow(" not found!").yellow
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
- raise "[ERROR] ConfigFileReader <#{e}>"
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
- print Rainbow("[ERROR] File ").red
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
- print Rainbow("[ERROR] Script ").red
72
- print Rainbow(script_path).bright.red
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
 
@@ -1,5 +1,5 @@
1
1
  module Teuton
2
- VERSION = "2.4.3"
2
+ VERSION = "2.4.4"
3
3
  APPNAME = "teuton"
4
4
  GEMNAME = "teuton"
5
5
  DOCKERNAME = "dvarrui/#{GEMNAME}"
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
- lab.show unless options[:panelconfig]
31
- lab.show_panelconfig if options[:panelconfig]
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 SyntaxError => e
40
- puts e.to_s
41
- puts Rainbow.new("[FAIL ] Reading file #{app.script_path}").red
42
- puts Rainbow.new("[ERROR] Syntax Error!").red
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.3
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-17 00:00:00.000000000 Z
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