kitchen-yansible-pusher 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -1
- data/lib/kitchen/provisioner/yansible_pusher.rb +39 -5
- data/lib/kitchen/yansible/pusher/version.rb +1 -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: e89aae4dfa7b1870e73abb1adc6b458dd14a3c9668ac6209178bba30927df464
|
4
|
+
data.tar.gz: c23dcdadcb0a35e4c09a68ab3a73587778d59969815ea298b0ad4e058944da28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da81032eb9743c1e1bfe2702bb2c241708433df326de54c02d29f503367d8bdf509b9d41d410902af3e3bed42b359f048dad719e02c51b83cac5bde464b6d0ab
|
7
|
+
data.tar.gz: 2ec83cfc5aebfbeb01c3f5049f27498ac8be74974e27e797196e76c5e154ce54c3e00f58e1947d8d9781fb716f1811fc1cc8a2320e0fc365315c2b85bfaddb4f
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,23 @@
|
|
2
2
|
|
3
3
|
## [Unreleased](https://github.com/jmtx1020/kitchen-yansible-pusher/tree/HEAD)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/jmtx1020/kitchen-yansible-pusher/compare/v0.3.
|
5
|
+
[Full Changelog](https://github.com/jmtx1020/kitchen-yansible-pusher/compare/v0.3.4...HEAD)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- updated to use Open3 to run instead of mixlib::shellout [\#18](https://github.com/jmtx1020/kitchen-yansible-pusher/pull/18) ([jmtx1020](https://github.com/jmtx1020))
|
10
|
+
|
11
|
+
## [v0.3.4](https://github.com/jmtx1020/kitchen-yansible-pusher/tree/v0.3.4) (2024-09-29)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/jmtx1020/kitchen-yansible-pusher/compare/v0.3.3...v0.3.4)
|
14
|
+
|
15
|
+
**Merged pull requests:**
|
16
|
+
|
17
|
+
- fixed issue where Ansibles output was not being preserved in kitchen logs [\#17](https://github.com/jmtx1020/kitchen-yansible-pusher/pull/17) ([jmtx1020](https://github.com/jmtx1020))
|
18
|
+
|
19
|
+
## [v0.3.3](https://github.com/jmtx1020/kitchen-yansible-pusher/tree/v0.3.3) (2024-09-10)
|
20
|
+
|
21
|
+
[Full Changelog](https://github.com/jmtx1020/kitchen-yansible-pusher/compare/v0.3.2...v0.3.3)
|
6
22
|
|
7
23
|
**Merged pull requests:**
|
8
24
|
|
@@ -5,6 +5,7 @@ require 'kitchen/errors'
|
|
5
5
|
require_relative '../yansible/pusher/version'
|
6
6
|
require 'yaml'
|
7
7
|
require 'English'
|
8
|
+
require 'open3'
|
8
9
|
|
9
10
|
module Kitchen
|
10
11
|
module Provisioner
|
@@ -57,11 +58,9 @@ module Kitchen
|
|
57
58
|
end
|
58
59
|
|
59
60
|
def run_command
|
60
|
-
info("Running Ansible Playbook: #{config[:playbook]}")
|
61
61
|
begin
|
62
62
|
create_sandbox
|
63
63
|
run_ansible
|
64
|
-
info('Ansible Playbook Complete!')
|
65
64
|
ensure
|
66
65
|
cleanup_sandbox
|
67
66
|
end
|
@@ -72,9 +71,44 @@ module Kitchen
|
|
72
71
|
|
73
72
|
def run_ansible
|
74
73
|
command = build_ansible_command
|
75
|
-
|
76
|
-
|
77
|
-
|
74
|
+
log_file = ".kitchen/logs/#{instance.name}.log"
|
75
|
+
FileUtils.mkdir_p(File.dirname(log_file))
|
76
|
+
execute_ansible_command(command, log_file)
|
77
|
+
end
|
78
|
+
|
79
|
+
def execute_ansible_command(command, log_file)
|
80
|
+
File.open(log_file, 'w') do |file|
|
81
|
+
log_ansible_init(command, file)
|
82
|
+
execute_and_capture_ansible_output(command, file)
|
83
|
+
log_line('Ansible Playbook Complete!', file)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def log_ansible_init(command, file)
|
88
|
+
log_line("Running Ansible Playbook: #{config[:playbook]}", file)
|
89
|
+
log_line("Running Ansible Command: #{command}", file)
|
90
|
+
end
|
91
|
+
|
92
|
+
def execute_and_capture_ansible_output(command, file)
|
93
|
+
Open3.popen2e(ansible_env_vars, command) do |_stdin, stdout_and_stderr, wait_thr|
|
94
|
+
stdout_and_stderr.each do |line|
|
95
|
+
log_line(line, file)
|
96
|
+
end
|
97
|
+
check_execution_status(wait_thr)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def log_line(line, file)
|
102
|
+
line = line.chomp
|
103
|
+
info(line)
|
104
|
+
file.puts(line)
|
105
|
+
file.flush
|
106
|
+
end
|
107
|
+
|
108
|
+
def check_execution_status(wait_thr)
|
109
|
+
return if wait_thr.value.success?
|
110
|
+
|
111
|
+
raise Kitchen::ActionFailed, 'Ansible playbook execution failed'
|
78
112
|
end
|
79
113
|
|
80
114
|
def create_inventory
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-yansible-pusher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose M. Tobar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A modern & minimalistic Ansible provisioner for Test Kitchen.
|
14
14
|
email:
|